applied code to change the internal string when the locale setting is changed.
authorChulheon <ch.jeong47@samsung.com>
Thu, 2 May 2013 07:52:52 +0000 (16:52 +0900)
committerChulheon <ch.jeong47@samsung.com>
Thu, 2 May 2013 07:55:46 +0000 (16:55 +0900)
Change-Id: Ied2b1c8a21510301b425652dfb74cf1207bce696

src/ui/controls/FUiCtrl_Edit.cpp
src/ui/controls/FUiCtrl_EditModel.cpp
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/controls/FUiCtrl_Keypad.cpp
src/ui/inc/FUiCtrl_Edit.h
src/ui/inc/FUiCtrl_EditModel.h
src/ui/inc/FUiCtrl_EditPresenter.h
src/ui/inc/FUiCtrl_Keypad.h

index 0bbf971..951eae0 100644 (file)
@@ -25,6 +25,7 @@
 #include <FGrpFont.h>
 #include <FGrp_BitmapImpl.h>
 #include <FGrp_FontImpl.h>
+#include <FSys_SettingInfoImpl.h>
 #include "FUi_AccessibilityContainer.h"
 #include "FUi_AccessibilityElement.h"
 #include "FUi_CoordinateSystemUtils.h"
@@ -44,7 +45,7 @@ using namespace Tizen::Ui::Animations;
 using namespace Tizen::Locales;
 using namespace Tizen::Graphics::_Text;
 using namespace Tizen::Base::Collection;
-
+using namespace Tizen::System;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
@@ -367,6 +368,8 @@ _Edit::~_Edit(void)
                __pToolbarAccessibilityElement->Activate(false);
                __pToolbarAccessibilityElement = null;
        }
+
+       _SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
 }
 
 _Edit*
@@ -493,6 +496,9 @@ _Edit::Initialize(int editStyle, InputStyle inputStyle, int limitLength, GroupSt
                __isAccessibilityCreated = true;
        }
 
+       r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
+       SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
        return r;
 }
 
@@ -3276,5 +3282,14 @@ _Edit::SendOpaqueCommand (const String& command)
        return;
 }
 
+void
+_Edit::OnSettingChanged(String& key)
+{
+       const wchar_t* LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
+       if (key == LOCALE_LANGUAGE)
+       {
+               _pEditPresenter->UpdateKeypadCommandString();
+       }
+}
 
 }}} // Tizen::Ui::Controls
index cd89882..6cc771c 100644 (file)
@@ -290,4 +290,11 @@ _EditModel::GetKeypadCommandButtonActionId(CommandButtonPosition position) const
        }
 }
 
+void
+_EditModel::UpdateKeypadCommandButtonText(void)
+{
+       GET_STRING_CONFIG(IDS_COM_SK_DONE, __leftCommandButtonText);
+       GET_STRING_CONFIG(IDS_COM_SK_CANCEL, __rightCommandButtonText);
+}
+
 }}} // Tizen::Ui::Controls
index 2ef819a..ffbe02c 100644 (file)
@@ -177,6 +177,7 @@ _EditPresenter::_EditPresenter(void)
        , __isTextBlocked(false)
        , __isGuideTextColorChanged(false)
        , __isKeypadCommandButtonVisible(false)
+       , __isKeypadCommandButtonUserSetting(false)
        , __isTextComposing(false)
        , __isCopyPasteManagerExist(false)
        , __isCursorChanged(false)
@@ -8723,6 +8724,7 @@ _EditPresenter::SetKeypadCommandButton(CommandButtonPosition position, const Str
        FooterItem footerItem;
        footerItem.Construct(actionId);
        footerItem.SetText(text);
+       __isKeypadCommandButtonUserSetting = true;
 
        __pEditModel->SetCommandButtonItem(position, actionId, text);
        if (__pCommandButton)
@@ -10134,4 +10136,26 @@ _EditPresenter::AdjustRTLTextAlignment(const _EditTextType textType)
        return false;
 }
 
+void
+_EditPresenter::UpdateKeypadCommandString(void)
+{
+       if (!__isKeypadCommandButtonUserSetting)
+       {
+               __pEditModel->UpdateKeypadCommandButtonText();
+               if (__pCommandButton)
+               {
+                       _Button* pLeftButton = __pCommandButton->GetItem(COMMAND_BUTTON_POSITION_LEFT);
+                       if (pLeftButton)
+                       {
+                               pLeftButton->SetText(__pEditModel->GetKeypadCommandButtonText(COMMAND_BUTTON_POSITION_LEFT));
+                       }
+                       _Button* pRightButton = __pCommandButton->GetItem(COMMAND_BUTTON_POSITION_RIGHT);
+                       if (pRightButton)
+                       {
+                               pRightButton->SetText(__pEditModel->GetKeypadCommandButtonText(COMMAND_BUTTON_POSITION_RIGHT));
+                       }
+               }
+       }
+}
+
 }}} // Tizen::Ui::Controls
index b837545..f210ee2 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <FBaseSysLog.h>
 #include <FGrp_BitmapImpl.h>
+#include <FSys_SettingInfoImpl.h>
 #include "FUi_AccessibilityContainer.h"
 #include "FUi_AccessibilityElement.h"
 #include "FUi_EcoreEvas.h"
@@ -42,6 +43,7 @@ using namespace Tizen::Base;
 using namespace Tizen::Base::Runtime;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
@@ -214,6 +216,9 @@ _Keypad::Initialize(int editStyle, _KeypadStyleInfo keypadStyleInfo, int limitLe
 
        __isInitialized = true;
 
+       r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
+       SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
        return r;
 
 CATCH:
@@ -244,6 +249,9 @@ _Keypad::Dispose(void)
                delete __pTextEvent;
                __pTextEvent = null;
        }
+
+       _SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
+
        return r;
 }
 
@@ -908,4 +916,24 @@ _Keypad::OnChangeLayout(_ControlOrientation orientation)
 
        return;
 }
+
+void
+_Keypad::OnSettingChanged(String& key)
+{
+       const wchar_t* LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
+       if (key == LOCALE_LANGUAGE)
+       {
+               if (__pFooter)
+               {
+                       _Button* pButton = __pFooter->GetItem(0);
+                       if (pButton)
+                       {
+                               String doneText;
+                               GET_STRING_CONFIG(IDS_COM_SK_DONE, doneText);
+                               pButton->SetText(doneText);
+                       }
+               }
+       }
+}
+
 } } } // Tizen::Ui::Controls
index b161e1a..f7d73a4 100644 (file)
@@ -31,6 +31,7 @@
 #include <FGrpPoint.h>
 #include <FGrpRectangle.h>
 #include <FGrp_TextTextObject.h>
+#include <FSysISettingEventListener.h>
 #include <FUiControl.h>
 #include <FUiCtrlControlsTypes.h>
 #include <FUiCtrlEditTypes.h>
@@ -172,6 +173,7 @@ class _OSP_EXPORT_ _Edit
        , public _ITouchTapGestureEventListener
        , public IClipboardPopupEventListener
        , public _IEditTextFilter
+       , virtual public Tizen::System::ISettingEventListener
 {
 public:
        DECLARE_CLASS_BEGIN(_Edit, _Control);
@@ -489,6 +491,7 @@ public:
        virtual void OnAncestorEnableStateChanged(const _Control& control);
        virtual result OnDetachingFromMainTree(void);
        virtual void OnVisibleStateChanged(void);
+       virtual void OnSettingChanged(Tizen::Base::String& key);
 
        _EditPresenter* GetPresenter(void) const;
        Tizen::Graphics::Dimension GetContentSizeInternal(void) const;
index 85ff7c9..045b2a3 100644 (file)
@@ -320,6 +320,7 @@ public:
        result SetCommandButtonItem(CommandButtonPosition buttonPosition, int actionId, const Tizen::Base::String& text);
        Tizen::Base::String GetKeypadCommandButtonText(CommandButtonPosition position) const;
        int GetKeypadCommandButtonActionId(CommandButtonPosition position) const;
+       void UpdateKeypadCommandButtonText(void);
 
 private:
        _EditModel(const _EditModel& value);
index d5ad4c6..1948910 100644 (file)
@@ -330,6 +330,7 @@ public:
        result CalculateCursorBounds(const Tizen::Graphics::Rectangle& textBounds, Tizen::Graphics::Rectangle& cursorBounds, int curPos = -1);
        result CalculateCursorBounds(const Tizen::Graphics::FloatRectangle& textBounds, Tizen::Graphics::FloatRectangle& cursorBounds, int curPos = -1);
        virtual void ResetTextBounds(void){}
+       void UpdateKeypadCommandString(void);
 
 protected:
        void StopTitleSlidingTimer(void);
@@ -509,6 +510,7 @@ private:
        bool __isTextBlocked;
        bool __isGuideTextColorChanged;
        bool __isKeypadCommandButtonVisible;
+       bool __isKeypadCommandButtonUserSetting;
        bool __isTextComposing;
        bool __isCopyPasteManagerExist;
        bool __isCursorChanged;
index e6fc82e..25c4b01 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef _FUI_CTRL_INTERNAL_KEYPAD_H_
 #define _FUI_CTRL_INTERNAL_KEYPAD_H_
 
+#include <FSysISettingEventListener.h>
 #include <FUiCtrlEditTypes.h>
 #include "FUi_Window.h"
 #include "FUiCtrl_Button.h"
@@ -61,6 +62,7 @@ class _OSP_EXPORT_ _Keypad
        , public Tizen::Ui::_Window
        , public _IActionEventListener
        , public _IKeypadEventListener
+       , virtual public Tizen::System::ISettingEventListener
 {
        DECLARE_CLASS_BEGIN(_Keypad, _Control);
        DECLARE_PROPERTY("singleLineEnabled", GetPropertySingleLineEnabled, SetPropertySingleLineEnabled);
@@ -102,6 +104,7 @@ public:
        virtual void OnChangeLayout(_ControlOrientation orientation);
        virtual void OnNativeWindowActivated(void);
        virtual bool IsRotationSynchronized(void) const;
+       virtual void OnSettingChanged(Tizen::Base::String& key);
 
 private:
        _Keypad(void);