From a1dd0955482d10ed8ec823fd7cafe00fa9894d75 Mon Sep 17 00:00:00 2001 From: Bum-Sung Cho Date: Mon, 18 Mar 2013 16:32:34 +0900 Subject: [PATCH] Merge missed development codes. Change-Id: I09747605ea0701a6db0546bd26bcefa6cb94929b Signed-off-by: Bum-Sung Cho --- CMakeLists.txt | 2 +- inc/FUiIme.h | 1 + inc/FUiImeIInputMethodListener.h | 31 +++++++++++---------- inc/FUiImeIInputMethodProvider.h | 34 +++++++++++------------ inc/FUiImeInputMethod.h | 4 +-- inc/FUiImeInputMethodInfo.h | 14 ++++++++++ inc/FUiImeInputMethodManager.h | 6 ++-- inc/FUiImeTypes.h | 46 +++++++++++++++++++++++++++++++ src/FUiImeInputMethodInfo.cpp | 11 ++++++++ src/FUiIme_InputMethodImpl.cpp | 5 +++- src/FUiIme_InputMethodInfoImpl.cpp | 16 +++++++++++ src/FUiIme_InputMethodInfoImpl.h | 4 +++ src/FUiIme_InputMethodManagerImpl.cpp | 6 ++++ src/FUiIme_InputServiceSignalListener.cpp | 14 ++++++++-- src/FUiIme_InputServiceSignalListener.h | 1 + src/FUiIme_ScimDataConverter.cpp | 17 ++++++++++++ src/FUiIme_ScimDataConverter.h | 4 +++ 17 files changed, 175 insertions(+), 41 deletions(-) create mode 100644 inc/FUiImeTypes.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b66515..85bd8b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,8 +70,8 @@ ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES}) ## SET LINKER FLAGS SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed") -TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw") TARGET_LINK_LIBRARIES(${this_target} "-losp-uifw") +TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw") TARGET_LINK_LIBRARIES(${this_target} "-ldlog") TARGET_LINK_LIBRARIES(${this_target} "-ldl") TARGET_LINK_LIBRARIES(${this_target} "-lecore") diff --git a/inc/FUiIme.h b/inc/FUiIme.h index d12ec64..b614c94 100644 --- a/inc/FUiIme.h +++ b/inc/FUiIme.h @@ -30,6 +30,7 @@ #include #include #include +#include /** * @namespace Tizen::Ui::Ime diff --git a/inc/FUiImeIInputMethodListener.h b/inc/FUiImeIInputMethodListener.h index 06381c2..31591ec 100644 --- a/inc/FUiImeIInputMethodListener.h +++ b/inc/FUiImeIInputMethodListener.h @@ -64,7 +64,7 @@ class _OSP_EXPORT_ IInputMethodListener : virtual public Tizen::Base::Runtime::IEventListener { public: - /** + /** * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this * interface is called. * @@ -74,7 +74,7 @@ public: */ virtual ~IInputMethodListener(void) {} - /** + /** * Called when the position of the cursor in an associated text input UI control changes. * * @since 2.1 @@ -85,7 +85,21 @@ public: */ virtual void OnCursorPositionChanged(int position) {} - /** + /** + * Called when a client of the input method sends the opaque command. + * + * @since 2.1 + * @privlevel partner + * @privilege http://tizen.org/privilege/ime + * + * @param[in] command The opaque command + * @remarks The opaque command is the engaged command between the certain input method and their clients which know opaque commands. It is for + * additional options that the input method does not provide. A string format of the opaque command can be described as like + * "org.tizen.MyApp.OpaqueCommand=True". + */ + virtual void OnOpaqueCommandReceived(const Tizen::Base::String& command) {} + + /** * Called when an associated text input UI control responds to a request with the surrounding text. * * @since 2.1 @@ -143,17 +157,6 @@ protected: // @since 2.1 // virtual void IInputMethodListener_Reserved4(void) {} - - // - // This method is for internal use only. Using this method can cause behavioral, security-related, - // and consistency-related issues in the application. - // - // Following method is reserved and may change its name at any time without - // prior notice. - // - // @since 2.1 - // - virtual void IInputMethodListener_Reserved5(void) {} }; }}} // Tizen::Ui::Ime diff --git a/inc/FUiImeIInputMethodProvider.h b/inc/FUiImeIInputMethodProvider.h index 36e52ec..6762c9b 100644 --- a/inc/FUiImeIInputMethodProvider.h +++ b/inc/FUiImeIInputMethodProvider.h @@ -83,7 +83,10 @@ public: * * @return The enter key action of the input panel */ - virtual Tizen::Ui::InputPanelAction GetEnterKeyAction(void) {return Tizen::Ui::INPUT_PANEL_ACTION_ENTER;} + virtual Tizen::Ui::InputPanelAction GetEnterKeyAction(void) + { + return Tizen::Ui::INPUT_PANEL_ACTION_ENTER; + } /** * Called when the associated text input UI control requests the position and size of the input panel. @@ -106,9 +109,12 @@ public: * * @return A style of the input panel */ - virtual Tizen::Ui::InputPanelStyle GetInputPanelStyle(void) {return Tizen::Ui::INPUT_PANEL_STYLE_NORMAL;} + virtual Tizen::Ui::InputPanelStyle GetInputPanelStyle(void) + { + return Tizen::Ui::INPUT_PANEL_STYLE_NORMAL; + } - /* + /** * Called when the associated text input UI control requests the language of the input method. * * @since 2.1 @@ -117,8 +123,10 @@ public: * * @return A language of the input method */ - virtual Tizen::Locales::Locale GetLanguage(void) {return Tizen::Locales::Locale(Tizen::Locales::LANGUAGE_ENG, - Tizen::Locales::COUNTRY_US);} + virtual Tizen::Locales::Locale GetLanguage(void) + { + return Tizen::Locales::Locale(Tizen::Locales::LANGUAGE_ENG, Tizen::Locales::COUNTRY_US); + } /** * Called when the associated text input UI control requests the input panel to enable or disable the caps mode. @@ -185,7 +193,10 @@ public: * * @return The state of the enter key action */ - virtual bool IsEnterKeyActionEnabled(void) {return false;} + virtual bool IsEnterKeyActionEnabled(void) + { + return false; + } /** * Called when the associated text input UI control requests the input panel to show itself. @@ -242,17 +253,6 @@ protected: // @since 2.1 // virtual void IInputMethodProvider_Reserved4(void) {} - - // - // This method is for internal use only. Using this method can cause behavioral, security-related, - // and consistency-related issues in the application. - // - // Following method is reserved and may change its name at any time without - // prior notice. - // - // @since 2.1 - // - virtual void IInputMethodProvider_Reserved5(void) {} }; }}} // Tizen::Ui::Ime diff --git a/inc/FUiImeInputMethod.h b/inc/FUiImeInputMethod.h index 04c5fa0..fdeddbc 100644 --- a/inc/FUiImeInputMethod.h +++ b/inc/FUiImeInputMethod.h @@ -101,7 +101,7 @@ class _OSP_EXPORT_ InputMethod : public Tizen::Base::Object { public: - /** + /** * Gets an instance of the %InputMethod. * * @since 2.1 @@ -179,7 +179,7 @@ public: */ result NotifyInputPanelState(Tizen::Ui::InputPanelShowState state); - /* + /** * Notifies a point of time when the language of the input method changes. * * @since 2.1 diff --git a/inc/FUiImeInputMethodInfo.h b/inc/FUiImeInputMethodInfo.h index f547ff2..061c5f4 100644 --- a/inc/FUiImeInputMethodInfo.h +++ b/inc/FUiImeInputMethodInfo.h @@ -30,6 +30,7 @@ #include #include #include +#include namespace Tizen { namespace Ui { namespace Ime { @@ -103,6 +104,19 @@ public: */ Tizen::Base::String GetName(void) const; + /** + * Gets the type of an input method. + * + * @since 2.1 + * @privlevel platform + * @privilege http://tizen.org/privilege/imemanager + * + * @return The type + * @exception E_SUCCESS The method is successful. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + */ + InputMethodType GetType(void) const; + private: // // This Equals() is intentionally declared as private so that only the platform can compare the object received as an input parameter with this object. diff --git a/inc/FUiImeInputMethodManager.h b/inc/FUiImeInputMethodManager.h index e59aac5..a025f04 100644 --- a/inc/FUiImeInputMethodManager.h +++ b/inc/FUiImeInputMethodManager.h @@ -68,7 +68,7 @@ public: */ static InputMethodManager* GetInstance(void); - /* + /** * Gets the %InputMethodInfo of the active input method. * * @since 2.1 @@ -78,7 +78,7 @@ public: * @return An instance of the InputMethodInfo * @exception E_SUCCESS The method is successful. * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. - * @remarks The specific error code can be accessed using the GetLastResult() method. + * @remarks If an error occurs then this function returns @c null and the specific error code can be accessed using the GetLastResult() method. */ InputMethodInfo* GetActiveInputMethodInfoN(void) const; @@ -111,7 +111,7 @@ public: */ result SetInputMethod(const Tizen::App::AppId& id); - /* + /** * Checks whether an input method is active or not. * * @since 2.1 diff --git a/inc/FUiImeTypes.h b/inc/FUiImeTypes.h new file mode 100644 index 0000000..fe09a9b --- /dev/null +++ b/inc/FUiImeTypes.h @@ -0,0 +1,46 @@ +// +// Open Service Platform +// Copyright (c) 2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUiImeTypes.h + * @brief This is the header file for the data types. + * + * This header file contains the declarations of the data types. + */ + +#ifndef _FUI_IME_TYPES_H_ +#define _FUI_IME_TYPES_H_ + +namespace Tizen { namespace Ui { namespace Ime { + +/** + * @enum InputMethodType + * + * Defines the types of the input method. + * + * @since 2.1 + * + */ +enum InputMethodType +{ + INPUT_METHOD_TYPE_SOFTWARE, /**< On-screen soft input panel */ + INPUT_METHOD_TYPE_HARDWARE /**< Hardware input engine */ +}; + +}}} // Tizen::Ui::Ime + +#endif // _FUI_IME_TYPES_H_ diff --git a/src/FUiImeInputMethodInfo.cpp b/src/FUiImeInputMethodInfo.cpp index 5c6c566..46c25d5 100644 --- a/src/FUiImeInputMethodInfo.cpp +++ b/src/FUiImeInputMethodInfo.cpp @@ -103,4 +103,15 @@ InputMethodInfo::GetName(void) const return __pInputMethodInfoImpl->GetName(); } +InputMethodType +InputMethodInfo::GetType(void) const +{ + result r = E_SUCCESS; + + r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER); + SysTryReturn(NID_UI_IME, r == E_SUCCESS, INPUT_METHOD_TYPE_SOFTWARE, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."); + + return __pInputMethodInfoImpl->GetType(); +} + }}} // Tizen::Ui::Ime diff --git a/src/FUiIme_InputMethodImpl.cpp b/src/FUiIme_InputMethodImpl.cpp index 779bc4c..831a6de 100644 --- a/src/FUiIme_InputMethodImpl.cpp +++ b/src/FUiIme_InputMethodImpl.cpp @@ -317,12 +317,15 @@ _InputMethodImpl::SetInputServiceSignalCallback(void) __pHelperAgent->signal_connect_set_return_key_disable(scim::slot(_InputServiceSignalListener::SetEnterKeyActionEnabled)); __pHelperAgent->signal_connect_set_return_key_type(scim::slot(_InputServiceSignalListener::SetEnterKeyAction)); - __pHelperAgent->signal_connect_exit(scim::slot(_InputServiceSignalListener::OnTerminate)); __pHelperAgent->signal_connect_ise_hide(scim::slot(_InputServiceSignalListener::HideInputPanel)); __pHelperAgent->signal_connect_ise_show(scim::slot(_InputServiceSignalListener::ShowInputPanel)); + __pHelperAgent->signal_connect_update_cursor_position(scim::slot(_InputServiceSignalListener::OnCursorPositionChanged)); + __pHelperAgent->signal_connect_set_imdata(scim::slot(_InputServiceSignalListener::OnOpaqueCommandReceived)); __pHelperAgent->signal_connect_update_surrounding_text(scim::slot(_InputServiceSignalListener::OnSurroundingTextReceived)); + __pHelperAgent->signal_connect_exit(scim::slot(_InputServiceSignalListener::OnTerminate)); + SysLog(NID_UI_IME, "The signal callback functions of the input service have been set"); } diff --git a/src/FUiIme_InputMethodInfoImpl.cpp b/src/FUiIme_InputMethodInfoImpl.cpp index 37120ff..95ec838 100644 --- a/src/FUiIme_InputMethodInfoImpl.cpp +++ b/src/FUiIme_InputMethodInfoImpl.cpp @@ -60,7 +60,9 @@ _InputMethodInfoImpl::_InputMethodInfoImpl(const _InputMethodInfoImpl& impl) result r = E_SUCCESS; __appId = impl.__appId; + __uuid = impl.__uuid; __name = impl.__name; + __type = impl.__type; std::unique_ptr pLanguageList(new(std::nothrow) ArrayList(SingleObjectDeleter)); SysTryReturnVoidResult(NID_UI_IME, pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); @@ -107,7 +109,9 @@ _InputMethodInfoImpl::operator=(const _InputMethodInfoImpl& impl) if (&impl != this) { __appId = impl.__appId; + __uuid = impl.__uuid; __name = impl.__name; + __type = impl.__type; r = SetLanguageList(*(impl.__pLanguageList)); SysTryReturn(NID_UI_IME, r == E_SUCCESS, *this, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -149,6 +153,12 @@ _InputMethodInfoImpl::GetName(void) const return __name; } +InputMethodType +_InputMethodInfoImpl::GetType(void) const +{ + return __type; +} + const char* _InputMethodInfoImpl::GetUuid(void) const { @@ -222,6 +232,12 @@ _InputMethodInfoImpl::SetName(const scim::String& name) _ScimDataConverter::ConvertString(name, __name); } +void +_InputMethodInfoImpl::SetType(Tizen::Ui::Ime::InputMethodType type) +{ + __type = type; +} + result _InputMethodInfoImpl::AddLanguage(const char* language) { diff --git a/src/FUiIme_InputMethodInfoImpl.h b/src/FUiIme_InputMethodInfoImpl.h index 790eeb1..1c946b9 100644 --- a/src/FUiIme_InputMethodInfoImpl.h +++ b/src/FUiIme_InputMethodInfoImpl.h @@ -38,6 +38,7 @@ #include #include #include +#include namespace Tizen { namespace Ui { namespace Ime { @@ -59,6 +60,7 @@ public: Tizen::App::AppId GetAppId(void) const; const Tizen::Base::Collection::IList* GetLanguageList(void) const; Tizen::Base::String GetName(void) const; + Tizen::Ui::Ime::InputMethodType GetType(void) const; const char* GetUuid(void) const; void SetAppId(Tizen::App::AppId id); @@ -66,6 +68,7 @@ public: result SetLanguageList(const Tizen::Base::Collection::IList& list); void SetName(const Tizen::Base::String& name); void SetName(const scim::String& name); + void SetType(Tizen::Ui::Ime::InputMethodType type); result AddLanguage(const char* language); @@ -80,6 +83,7 @@ private: Tizen::App::AppId __appId; Tizen::Base::String __uuid; Tizen::Base::String __name; + Tizen::Ui::Ime::InputMethodType __type; Tizen::Base::Collection::ArrayList* __pLanguageList; diff --git a/src/FUiIme_InputMethodManagerImpl.cpp b/src/FUiIme_InputMethodManagerImpl.cpp index 45afd12..4262609 100644 --- a/src/FUiIme_InputMethodManagerImpl.cpp +++ b/src/FUiIme_InputMethodManagerImpl.cpp @@ -40,6 +40,7 @@ #include "FUiIme_InputMethodInfoImpl.h" #include "FUiIme_InputMethodManagerImpl.h" +#include "FUiIme_ScimDataConverter.h" using namespace Tizen::App; using namespace Tizen::App::Package; @@ -95,6 +96,7 @@ _InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath) // declare variables xmlDocPtr pXmlDoc = null; xmlNodePtr pXmlRootElement = null; + _InputMethodInfoImpl* pInputMethodInfoImpl = null; // get the manifest file path const char* _MANIFEST_FILE_PATH = "/info/manifest.xml"; @@ -119,6 +121,9 @@ _InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath) r = ParseInputMethodInfo(pXmlRootElement, pInputMethodInfo.get()); SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*(pInputMethodInfo.get())); + pInputMethodInfoImpl->SetType(INPUT_METHOD_TYPE_SOFTWARE); + if (pXmlDoc) { xmlFreeDoc(pXmlDoc); @@ -372,6 +377,7 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const pInputMethodInfoImpl->SetAppId(PRELOADED_IME_APPID); pInputMethodInfoImpl->SetUuid(dpList[preloadedImeIndex]); pInputMethodInfoImpl->SetName(String(pName)); + pInputMethodInfoImpl->SetType(_ScimDataConverter::ConvertType(type)); pLanguageList.reset(GetInputMethodLanguageListN(pLanguage)); r = GetLastResult(); SysTryCatch(NID_UI_IME, pLanguageList, , r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/FUiIme_InputServiceSignalListener.cpp b/src/FUiIme_InputServiceSignalListener.cpp index fc77ebe..3133bd3 100644 --- a/src/FUiIme_InputServiceSignalListener.cpp +++ b/src/FUiIme_InputServiceSignalListener.cpp @@ -174,10 +174,10 @@ _InputServiceSignalListener::GetLanguage(const scim::HelperAgent* pHelperAgent, { SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist."); - //Locale language = __pIInputMethodProvider->GetLanguage(); - //std::unique_ptr pLanguage(_ScimDataConverter::ConvertLanguageN(language)); + Locale language = __pIInputMethodProvider->GetLanguage(); + std::unique_ptr pLanguage(_ScimDataConverter::ConvertLanguageN(language)); - //*pLocale = strdup(pLanguage.get()); + *pLocale = strdup(pLanguage.get()); } void @@ -372,6 +372,14 @@ _InputServiceSignalListener::OnCursorPositionChanged(const scim::HelperAgent* pH } void +_InputServiceSignalListener::OnOpaqueCommandReceived(const scim::HelperAgent* pHelperAgent, char* pBuffer, size_t& length) +{ + SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist."); + + __pIInputMethodListener->OnOpaqueCommandReceived(String(pBuffer)); +} + +void _InputServiceSignalListener::OnSurroundingTextReceived(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& text, int cursorPosition) { SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist."); diff --git a/src/FUiIme_InputServiceSignalListener.h b/src/FUiIme_InputServiceSignalListener.h index 1ebd54f..9bc6d25 100644 --- a/src/FUiIme_InputServiceSignalListener.h +++ b/src/FUiIme_InputServiceSignalListener.h @@ -65,6 +65,7 @@ public: static void OnCursorPositionChanged(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid, int position); + static void OnOpaqueCommandReceived(const scim::HelperAgent* pHelperAgent, char* pBuffer, size_t& length); static void OnSurroundingTextReceived(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& text, int cursorPosition); static void OnTerminate(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid); diff --git a/src/FUiIme_ScimDataConverter.cpp b/src/FUiIme_ScimDataConverter.cpp index 95cb143..a9bacf3 100644 --- a/src/FUiIme_ScimDataConverter.cpp +++ b/src/FUiIme_ScimDataConverter.cpp @@ -49,6 +49,23 @@ _ScimDataConverter::~_ScimDataConverter() } +Tizen::Ui::Ime::InputMethodType +_ScimDataConverter::ConvertType(ISE_TYPE_T type) +{ + InputMethodType inputMethodType = INPUT_METHOD_TYPE_SOFTWARE; + + if (type == HARDWARE_KEYBOARD_ISE) + { + inputMethodType = INPUT_METHOD_TYPE_HARDWARE; + } + else if (type == SOFTWARE_KEYBOARD_ISE) + { + inputMethodType = INPUT_METHOD_TYPE_SOFTWARE; + } + + return inputMethodType; +} + result _ScimDataConverter::ConvertKey(KeyCode code, KeyState state, scim::KeyEvent& event) { diff --git a/src/FUiIme_ScimDataConverter.h b/src/FUiIme_ScimDataConverter.h index f1f30e9..6f2cf5b 100644 --- a/src/FUiIme_ScimDataConverter.h +++ b/src/FUiIme_ScimDataConverter.h @@ -27,6 +27,7 @@ #include // basic_string in scim_types.h +#include #define Uses_SCIM_EVENT #define Uses_SCIM_TYPES #undef null @@ -38,6 +39,7 @@ #include #include #include +#include namespace Tizen { namespace Ui { namespace Ime { @@ -50,6 +52,8 @@ namespace Tizen { namespace Ui { namespace Ime { class _ScimDataConverter { public: + static Tizen::Ui::Ime::InputMethodType ConvertType(ISE_TYPE_T type); + static result ConvertKey(Tizen::Ui::KeyCode keyCode, Tizen::Ui::KeyState keyState, scim::KeyEvent& keyEvent); static char* ConvertLanguageN(const Tizen::Locales::Locale& language); -- 2.7.4