From: Chulheon Date: Thu, 2 May 2013 07:52:52 +0000 (+0900) Subject: applied code to change the internal string when the locale setting is changed. X-Git-Tag: submit/tizen_2.1/20130514.054411~118 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9870f7fadcfa40f8a5d0e3e2e5b672e788ac632;p=framework%2Fosp%2Fuifw.git applied code to change the internal string when the locale setting is changed. Change-Id: Ied2b1c8a21510301b425652dfb74cf1207bce696 --- diff --git a/src/ui/controls/FUiCtrl_Edit.cpp b/src/ui/controls/FUiCtrl_Edit.cpp index 0bbf971..951eae0 100644 --- a/src/ui/controls/FUiCtrl_Edit.cpp +++ b/src/ui/controls/FUiCtrl_Edit.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #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 diff --git a/src/ui/controls/FUiCtrl_EditModel.cpp b/src/ui/controls/FUiCtrl_EditModel.cpp index cd89882..6cc771c 100644 --- a/src/ui/controls/FUiCtrl_EditModel.cpp +++ b/src/ui/controls/FUiCtrl_EditModel.cpp @@ -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 diff --git a/src/ui/controls/FUiCtrl_EditPresenter.cpp b/src/ui/controls/FUiCtrl_EditPresenter.cpp index 2ef819a..ffbe02c 100644 --- a/src/ui/controls/FUiCtrl_EditPresenter.cpp +++ b/src/ui/controls/FUiCtrl_EditPresenter.cpp @@ -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 diff --git a/src/ui/controls/FUiCtrl_Keypad.cpp b/src/ui/controls/FUiCtrl_Keypad.cpp index b837545..f210ee2 100644 --- a/src/ui/controls/FUiCtrl_Keypad.cpp +++ b/src/ui/controls/FUiCtrl_Keypad.cpp @@ -24,6 +24,7 @@ #include #include +#include #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 diff --git a/src/ui/inc/FUiCtrl_Edit.h b/src/ui/inc/FUiCtrl_Edit.h index b161e1a..f7d73a4 100644 --- a/src/ui/inc/FUiCtrl_Edit.h +++ b/src/ui/inc/FUiCtrl_Edit.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -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; diff --git a/src/ui/inc/FUiCtrl_EditModel.h b/src/ui/inc/FUiCtrl_EditModel.h index 85ff7c9..045b2a3 100644 --- a/src/ui/inc/FUiCtrl_EditModel.h +++ b/src/ui/inc/FUiCtrl_EditModel.h @@ -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); diff --git a/src/ui/inc/FUiCtrl_EditPresenter.h b/src/ui/inc/FUiCtrl_EditPresenter.h index d5ad4c6..1948910 100644 --- a/src/ui/inc/FUiCtrl_EditPresenter.h +++ b/src/ui/inc/FUiCtrl_EditPresenter.h @@ -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; diff --git a/src/ui/inc/FUiCtrl_Keypad.h b/src/ui/inc/FUiCtrl_Keypad.h index e6fc82e..25c4b01 100644 --- a/src/ui/inc/FUiCtrl_Keypad.h +++ b/src/ui/inc/FUiCtrl_Keypad.h @@ -24,6 +24,7 @@ #ifndef _FUI_CTRL_INTERNAL_KEYPAD_H_ #define _FUI_CTRL_INTERNAL_KEYPAD_H_ +#include #include #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);