Fix N_SE-44420/42499/44520
authorTaejun <tj.twt.park@samsung.com>
Thu, 4 Jul 2013 07:20:16 +0000 (16:20 +0900)
committerTaejun <tj.twt.park@samsung.com>
Thu, 4 Jul 2013 07:20:16 +0000 (16:20 +0900)
Change-Id: Ic6b5f749fa8204c9c61dbfe61e4968d27847c9cf

src/ui/controls/FUiCtrl_EditCopyPasteManager.cpp
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/controls/FUiCtrl_Keypad.cpp
src/ui/inc/FUiCtrl_EditPresenter.h

index b0e46f9..9e387b4 100644 (file)
@@ -1809,13 +1809,13 @@ _EditCopyPasteManager::CreateCopyPastePopup(void)
                return;
        }
 
-       if (__pEdit->GetTextLength() == 0 && (__pEdit->IsViewModeEnabled()))
+       if (__pEdit->GetTextLength() == 0 && (__pEditPresenter->IsViewModeEnabled()))
        {
                return;
        }
 
        __contextMenuHeight = contextMenuHeight + contextMenuTopMargin + contextMenuBottomMargin + contextMenuArrowHeight;
-       if (isClipped && __pEdit->IsViewModeEnabled() == false && __pEdit->GetTextLength() > 0 && orientation == _CONTROL_ORIENTATION_PORTRAIT)
+       if (isClipped && __pEditPresenter->IsViewModeEnabled() == false && __pEdit->GetTextLength() > 0 && orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
                __contextMenuHeight = __contextMenuHeight + contextMenuHeight;
        }
@@ -2047,7 +2047,7 @@ _EditCopyPasteManager::CreateCopyPastePopup(void)
                        GET_STRING_CONFIG(IDS_TPLATFORM_OPT_CUT, cutText);
 
                        __pCopyPastePopup->AddItem(copyText, COPY_PASTE_COPY_ID, null, null, null);
-                       if (!__pEdit->IsViewModeEnabled())
+                       if (!__pEditPresenter->IsViewModeEnabled())
                        {
                                __pCopyPastePopup->AddItem(cutText, COPY_PASTE_CUT_ID, null, null, null);
                        }
@@ -2067,7 +2067,7 @@ _EditCopyPasteManager::CreateCopyPastePopup(void)
 
        if (isClipped)
        {
-               if (!__pEdit->IsViewModeEnabled())
+               if (!__pEditPresenter->IsViewModeEnabled())
                {
                        String pasteText;
                        String clipboardText;
index d654fc0..be93ce1 100755 (executable)
@@ -1310,6 +1310,24 @@ _EditPresenter::IsUsbKeyboardConnected(void) const
        }
 }
 
+bool
+_EditPresenter::IsCurrentFocused(void) const
+{
+       _ControlManager* pControlManager = _ControlManager::GetInstance();
+       if (pControlManager)
+       {
+               _Control* pControl = pControlManager->GetFocusControl();
+               if (pControl != __pEdit)
+               {
+                       return false;
+               }
+               else
+               {
+                       return true;
+               }
+       }
+}
+
 _EditPresenter*
 _EditPresenter::CreateInstanceN(void)
 {
@@ -1582,7 +1600,7 @@ _EditPresenter::DrawChangeableBackground(Canvas& canvas, bool focused, int bitma
                }
        }
 
-       if (GetSearchBarFlag() && __pEdit->IsFocused() && __pEdit->IsSearchFieldFocused())
+       if (GetSearchBarFlag() && IsCurrentFocused() && __pEdit->IsSearchFieldFocused())
        {
                Bitmap* pFocusBitmap = null;
                Bitmap* pReplacementColorFocusBitmap = null;
@@ -1610,7 +1628,6 @@ _EditPresenter::DrawChangeableBackground(Canvas& canvas, bool focused, int bitma
                pReplacementColorFocusBitmap = null;
        }
 
-
        if (borderRoundEnable)
        {
                if (pEditBgBitmap)
@@ -1662,7 +1679,7 @@ _EditPresenter::DrawBackground(Canvas& canvas, bool drawTitleText)
        }
        else
        {
-               DrawBackgroundBitmap(canvas, __pEdit->IsFocused());
+               DrawBackgroundBitmap(canvas, IsCurrentFocused());
        }
 
        DrawFocusRing(canvas);
@@ -1717,7 +1734,7 @@ _EditPresenter::DrawTitleText()
        pTitleTextCanvas->Clear();
 
        titleAction = __pTitleTextObject->GetAction();
-       if (__pEdit->IsFocused() == true)
+       if (IsCurrentFocused() == true)
        {
                __pTitleTextObject->SetForegroundColor(__pEdit->GetTitleTextColor(EDIT_STATUS_HIGHLIGHTED), 0, __pTitleTextObject->GetTextLength());
 
@@ -2007,7 +2024,7 @@ _EditPresenter::DrawTextForEntireFontSetting(Canvas& canvas)
 {
        result r = E_SUCCESS;
 
-       if (!(__pEdit->GetEditStyle() & EDIT_STYLE_PASSWORD) && __pEdit->IsFocused() == false)
+       if (!(__pEdit->GetEditStyle() & EDIT_STYLE_PASSWORD) && IsCurrentFocused() == false)
        {
                __pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
        }
@@ -2048,7 +2065,7 @@ _EditPresenter::DrawTextForEntireFontSetting(Canvas& canvas)
 
        EditStatus editStatus = GetCurrentStatus();
 
-       if (__pEdit->IsFocused() == false)
+       if (IsCurrentFocused() == false)
        {
                if (__isCursorChanged == true)
                {
@@ -2133,7 +2150,7 @@ _EditPresenter::DrawSingleLineBackground(Canvas& canvas, bool drawTitleText)
        }
        else
        {
-               DrawSingleLineBackgroundBitmap(canvas, __pEdit->IsFocused());
+               DrawSingleLineBackgroundBitmap(canvas, IsCurrentFocused());
        }
 
        DrawFocusRing(canvas);
@@ -2285,7 +2302,7 @@ _EditPresenter::Draw(Canvas& canvas)
                r = InitializeAtFirstDrawing();
                SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Faild to initialize.");
 
-               if (__pEdit->IsFocused() == true &&  __isInputConnectionBound == false)
+               if (IsCurrentFocused() == true &&  __isInputConnectionBound == false)
                {
                        if (IsViewModeEnabled() == false)
                        {
@@ -3196,7 +3213,7 @@ _EditPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchI
                }
                else
                {
-                       if (!__pEdit->IsFocused())
+                       if (!IsCurrentFocused())
                        {
                                __pEdit->SetFocused();
                        }
@@ -3304,7 +3321,7 @@ _EditPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchI
                        }
                        if (!__isCopyPasteManagerExist) // Copy&Paste
                        {
-                               if ((__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE) == true && __pEdit->IsFocused() == false)
+                               if ((__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE) == true && IsCurrentFocused() == false)
                                {
                                        __isCursorChanged = true;
                                }
@@ -3347,7 +3364,7 @@ _EditPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchI
                                needToCreatePopup = false;
                        }
 
-                       if (__pEdit->IsFocused() && !tokenEditting && needToCreatePopup)
+                       if (IsCurrentFocused() && !tokenEditting && needToCreatePopup)
                        {
                                __pCopyPasteManager = new (std::nothrow) _EditCopyPasteManager(*__pEdit);
                                SysTryReturn(NID_UI_CTRL, __pCopyPasteManager != null, false, E_SYSTEM, "Unable to create _EditCopyPasteManager instance.");
@@ -3369,7 +3386,7 @@ _EditPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchI
                                        {
                                                if (IsViewModeEnabled() == false)
                                                {
-                                                       if (__pEdit->IsFocused())
+                                                       if (IsCurrentFocused())
                                                        {
                                                                ShowKeypad(false);
                                                        }
@@ -3396,7 +3413,7 @@ _EditPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchI
                                        {
                                                if (IsViewModeEnabled() == false)
                                                {
-                                                       if (__pEdit->IsFocused())
+                                                       if (IsCurrentFocused())
                                                        {
                                                                ShowKeypad(false);
                                                        }
@@ -4550,7 +4567,7 @@ _EditPresenter::OnLongPressGestureDetected(void)
        {
                return true;
        }
-       else if (__pEdit->IsFocused() == false && !IsViewModeEnabled())
+       else if (IsCurrentFocused() == false && !IsViewModeEnabled())
        {
                return true;
        }
@@ -4608,7 +4625,7 @@ _EditPresenter::OnTapGestureDetected(void)
                return false;
        }
 
-       if (__pEdit->IsFocused() == false)
+       if (IsCurrentFocused() == false)
        {
                return true;
        }
@@ -5746,7 +5763,7 @@ _EditPresenter::IsViewModeEnabled(bool internal) const
 result
 _EditPresenter::SetViewModeEnabled(bool enable)
 {
-       if (!enable && __pEditModel->IsViewModeEnabled() && __pEdit->IsFocused() && (__pEdit->GetInputStyle() == INPUT_STYLE_OVERLAY))
+       if (!enable && __pEditModel->IsViewModeEnabled() && IsCurrentFocused() && (__pEdit->GetInputStyle() == INPUT_STYLE_OVERLAY))
        {
                __pEdit->SetFocused(false);
        }
@@ -6377,9 +6394,21 @@ _EditPresenter::ChangeToUnbindState(void)
                InitializeCopyPasteManager();
        }
 
-       if (__pEdit->IsFocused())
+       if (__isInputConnectionBound)
        {
-               HideKeypad(false);
+               if (__isKeypadExist)
+               {
+                       HideKeypad(false);
+               }
+
+               if (__isClipboardExist)
+               {
+                       if (__pClipboard)
+                       {
+                               __pClipboard->HidePopup();
+                               OnClipboardPopupClosed();
+                       }
+               }
        }
 
        if (__isKeypadHiding)
@@ -6490,7 +6519,7 @@ _EditPresenter::GetCurrentStatus(void) const
 
        if (__pEdit->IsEnabled())
        {
-               if (__pEdit->IsFocused())
+               if (IsCurrentFocused())
                {
                        editState = EDIT_STATUS_HIGHLIGHTED;
                }
@@ -7002,6 +7031,19 @@ _EditPresenter::ShowFullscreenKeypad(void)
                __pFullscreenKeypad = null;
        }
 
+       __isKeypadExist = CheckKeypadExist(__pEdit->GetOrientation());
+       if (__isKeypadExist) //overlay style keypad exist before create fullscreen edit.
+       {
+               AdjustParentPanelHeight(true);
+
+               if (__pParentForm)
+               {
+                       SysLog(NID_UI_CTRL, "Form deflate RESET!!!!!!!!!!");
+                       __pParentForm->DeflateClientRectHeight(0);
+                       __pParentForm->Draw();
+               }
+       }
+
        int editStyle = __pEdit->GetEditStyle();
 
        _KeypadStyleInfo keypadStyleInfo;
@@ -7323,7 +7365,11 @@ _EditPresenter::ShowKeypad(bool focus)
 
                if (__isKeypadExist) //edit switiching
                {
-                       sendKeypadEventForcely = !__pParentForm->IsDeflated();
+                       if (__pParentForm)
+                       {
+                               sendKeypadEventForcely = !__pParentForm->IsDeflated();
+                       }
+
                        if (sendKeypadEventForcely)
                        {
                                __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_CREATED);
@@ -7334,6 +7380,7 @@ _EditPresenter::ShowKeypad(bool focus)
                        ChangeLayoutInternal(__pEdit->GetOrientation());
                        AdjustParentPanelHeight(false);
                        ScrollPanelToCursorPosition();
+
                        if (__pParentForm)
                        {
                                __pParentForm->Draw();
@@ -7805,7 +7852,6 @@ _EditPresenter::HideKeypad(bool focus)
        __pInputConnection->HideInputPanel();
        __pInputConnection->UnbindInputMethod();
 
-
        if (__isKeypadExist)
        {
                __isKeypadHiding = true;
@@ -7894,7 +7940,7 @@ _EditPresenter::InitializeCursor(void)
 {
        StopCursorTimer();
 
-       if (__isCursorDisabled == false && __pEdit->IsFocused() && __isTextBlocked == false)
+       if (__isCursorDisabled == false && IsCurrentFocused() && __isTextBlocked == false)
        {
                FloatRectangle cursorBounds;
                CalculateCursorBounds(__textObjectBounds, cursorBounds);
@@ -8072,7 +8118,7 @@ _EditPresenter::MoveCursor(const FloatRectangle& fromRect, const FloatRectangle&
 void
 _EditPresenter::OnCursorTimerExpired(void)
 {
-       if (!__pEdit->IsFocused() && __isCursorDisabled)
+       if (!IsCurrentFocused() && __isCursorDisabled)
        {
                StopCursorTimer();
                return;
@@ -9305,7 +9351,7 @@ _EditPresenter::OnTitleSlidingTimerExpired(void)
 {
        result r = E_SUCCESS;
 
-       if (!__pEdit->IsFocused())
+       if (!IsCurrentFocused())
        {
                StopTitleSlidingTimer();
                return r;
@@ -9421,7 +9467,7 @@ _EditPresenter::OnPasswordTimerExpired(void)
 {
        result r = E_SUCCESS;
 
-       if (!__pEdit->IsFocused())
+       if (!IsCurrentFocused())
        {
                return E_SYSTEM;
        }
@@ -9685,11 +9731,6 @@ _EditPresenter::GetParentForm(void)
                return null;
        }
 
-       if (__pEdit->GetInputStyle() == INPUT_STYLE_FULLSCREEN)
-       {
-               return null;
-       }
-
        if (__pParentForm == null)
        {
                result r = E_SUCCESS;
@@ -11381,7 +11422,7 @@ _EditPresenter::DrawFocusRing(Tizen::Graphics::Canvas& canvas) const
        Bitmap* pFocusRing = null;
        Color color = __pEdit->GetColor(EDIT_STATUS_HIGHLIGHTED);
 
-       if (__pEdit->IsFocused() && color.GetAlpha())
+       if (IsCurrentFocused() && color.GetAlpha())
        {
                Color focusColor;
                GET_COLOR_CONFIG(EDIT::CURSOR_NORMAL, focusColor);
index 0bf8e14..4acc884 100755 (executable)
@@ -425,11 +425,8 @@ _Keypad::ChangeLayoutInternal(LayoutChangeState layoutChangeState)
        bool isKeypadExist = false;
        bool isClipboardExist = false;
 
-       if (__isInitialized == true)
-       {
-               isKeypadExist = __pChildEdit->CheckKeypadExist(orientation);
-               isClipboardExist = __pChildEdit->IsClipboardExist();
-       }
+       isKeypadExist = __pChildEdit->CheckKeypadExist(orientation);
+       isClipboardExist = __pChildEdit->IsClipboardExist();
 
        if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
@@ -532,6 +529,7 @@ _Keypad::OnAttachedToMainTree(void)
                __pIndicator->OnAttachedToMainTree();
                __pIndicator->AddIndicatorObject(this, GetRootWindow());
                __pIndicator->SetIndicatorShowState(true);
+               __pIndicator->SetIndicatorAutoHide(false, true);
        }
 
        Invalidate(true);
@@ -558,12 +556,6 @@ _Keypad::OnDetachingFromMainTree(void)
 void
 _Keypad::OnNativeWindowActivated(void)
 {
-       if (__isFirstCall)
-       {
-               __pChildEdit->SetFocused();
-               __isFirstCall = false;
-       }
-
        return;
 }
 
@@ -580,6 +572,12 @@ _Keypad::OnDraw(void)
        GET_COLOR_CONFIG(EDIT::BG_NORMAL, backgroundColor);
        SetBackgroundColor(backgroundColor);
 
+       if (__isFirstCall)
+       {
+               __pChildEdit->SetFocused();
+               __isFirstCall = false;
+       }
+
        return;
 }
 
index 73de884..029331f 100755 (executable)
@@ -262,6 +262,7 @@ public:
        bool IsClipboardExist(void) const;
        void CheckUSBKeyboardStatus(void);
        bool IsUsbKeyboardConnected(void) const;
+       bool IsCurrentFocused(void) const;
 
        result AppendCharacter(const Tizen::Base::Character& character);
        result AppendText(const Tizen::Base::String& text);