Merge missed development codes.
authorBum-Sung Cho <bs0111.cho@samsung.com>
Mon, 18 Mar 2013 07:32:34 +0000 (16:32 +0900)
committerBum-Sung Cho <bs0111.cho@samsung.com>
Mon, 18 Mar 2013 07:32:34 +0000 (16:32 +0900)
Change-Id: I09747605ea0701a6db0546bd26bcefa6cb94929b
Signed-off-by: Bum-Sung Cho <bs0111.cho@samsung.com>
17 files changed:
CMakeLists.txt
inc/FUiIme.h
inc/FUiImeIInputMethodListener.h
inc/FUiImeIInputMethodProvider.h
inc/FUiImeInputMethod.h
inc/FUiImeInputMethodInfo.h
inc/FUiImeInputMethodManager.h
inc/FUiImeTypes.h [new file with mode: 0644]
src/FUiImeInputMethodInfo.cpp
src/FUiIme_InputMethodImpl.cpp
src/FUiIme_InputMethodInfoImpl.cpp
src/FUiIme_InputMethodInfoImpl.h
src/FUiIme_InputMethodManagerImpl.cpp
src/FUiIme_InputServiceSignalListener.cpp
src/FUiIme_InputServiceSignalListener.h
src/FUiIme_ScimDataConverter.cpp
src/FUiIme_ScimDataConverter.h

index 8b66515..85bd8b2 100644 (file)
@@ -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")
index d12ec64..b614c94 100644 (file)
@@ -30,6 +30,7 @@
 #include <FUiImeInputMethod.h>\r
 #include <FUiImeInputMethodInfo.h>\r
 #include <FUiImeInputMethodManager.h>\r
+#include <FUiImeTypes.h>\r
 \r
 /**\r
  * @namespace Tizen::Ui::Ime\r
index 06381c2..31591ec 100644 (file)
@@ -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
index 36e52ec..6762c9b 100644 (file)
@@ -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
index 04c5fa0..fdeddbc 100644 (file)
@@ -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
index f547ff2..061c5f4 100644 (file)
@@ -30,6 +30,7 @@
 #include <FBaseObject.h>\r
 #include <FBaseString.h>\r
 #include <FOspConfig.h>\r
+#include <FUiImeTypes.h>\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
@@ -103,6 +104,19 @@ public:
         */\r
        Tizen::Base::String GetName(void) const;\r
 \r
+       /**\r
+        * Gets the type of an input method.\r
+        *\r
+        * @since 2.1\r
+        * @privlevel platform\r
+        * @privilege http://tizen.org/privilege/imemanager\r
+        *\r
+        * @return The type\r
+        * @exception E_SUCCESS The method is successful.\r
+        * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+        */\r
+       InputMethodType GetType(void) const;\r
+\r
 private:\r
        //\r
        // This Equals() is intentionally declared as private so that only the platform can compare the object received as an input parameter with this object.\r
index e59aac5..a025f04 100644 (file)
@@ -68,7 +68,7 @@ public:
         */\r
        static InputMethodManager* GetInstance(void);\r
 \r
-       /*\r
+       /**\r
         * Gets the %InputMethodInfo of the active input method.\r
         *\r
         * @since 2.1\r
@@ -78,7 +78,7 @@ public:
         * @return An instance of the InputMethodInfo\r
         * @exception E_SUCCESS The method is successful.\r
         * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
-        * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+        * @remarks If an error occurs then this function returns @c null and the specific error code can be accessed using the GetLastResult() method.\r
         */\r
        InputMethodInfo* GetActiveInputMethodInfoN(void) const;\r
 \r
@@ -111,7 +111,7 @@ public:
         */\r
        result SetInputMethod(const Tizen::App::AppId& id);\r
 \r
-       /*\r
+       /**\r
         * Checks whether an input method is active or not.\r
         *\r
         * @since 2.1\r
diff --git a/inc/FUiImeTypes.h b/inc/FUiImeTypes.h
new file mode 100644 (file)
index 0000000..fe09a9b
--- /dev/null
@@ -0,0 +1,46 @@
+//\r
+// Open Service Platform\r
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiImeTypes.h\r
+ * @brief This is the header file for the data types.\r
+ *\r
+ * This header file contains the declarations of the data types.\r
+ */\r
+\r
+#ifndef _FUI_IME_TYPES_H_\r
+#define _FUI_IME_TYPES_H_\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+ * @enum InputMethodType\r
+ *\r
+ * Defines the types of the input method.\r
+ *\r
+ * @since      2.1\r
+ * \r
+ */\r
+enum InputMethodType\r
+{\r
+       INPUT_METHOD_TYPE_SOFTWARE, /**< On-screen soft input panel */\r
+       INPUT_METHOD_TYPE_HARDWARE /**< Hardware input engine */\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_TYPES_H_\r
index 5c6c566..46c25d5 100644 (file)
@@ -103,4 +103,15 @@ InputMethodInfo::GetName(void) const
        return __pInputMethodInfoImpl->GetName();\r
 }\r
 \r
+InputMethodType\r
+InputMethodInfo::GetType(void) const\r
+{\r
+       result r = E_SUCCESS;\r
+\r
+       r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+       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.");\r
+\r
+       return __pInputMethodInfoImpl->GetType();\r
+}\r
+\r
 }}} // Tizen::Ui::Ime\r
index 779bc4c..831a6de 100644 (file)
@@ -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");
 }
 
index 37120ff..95ec838 100644 (file)
@@ -60,7 +60,9 @@ _InputMethodInfoImpl::_InputMethodInfoImpl(const _InputMethodInfoImpl& impl)
        result r = E_SUCCESS;\r
 \r
        __appId = impl.__appId;\r
+       __uuid = impl.__uuid;\r
        __name = impl.__name;\r
+       __type = impl.__type;\r
 \r
        std::unique_ptr<ArrayList> pLanguageList(new(std::nothrow) ArrayList(SingleObjectDeleter));\r
        SysTryReturnVoidResult(NID_UI_IME, pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
@@ -107,7 +109,9 @@ _InputMethodInfoImpl::operator=(const _InputMethodInfoImpl& impl)
        if (&impl != this)\r
        {\r
                __appId = impl.__appId;\r
+               __uuid = impl.__uuid;\r
                __name = impl.__name;\r
+               __type = impl.__type;\r
 \r
                r = SetLanguageList(*(impl.__pLanguageList));\r
                SysTryReturn(NID_UI_IME, r == E_SUCCESS, *this, r, "[%s] Propagating.", GetErrorMessage(r));\r
@@ -149,6 +153,12 @@ _InputMethodInfoImpl::GetName(void) const
        return __name;\r
 }\r
 \r
+InputMethodType\r
+_InputMethodInfoImpl::GetType(void) const\r
+{\r
+       return __type;\r
+}\r
+\r
 const char*\r
 _InputMethodInfoImpl::GetUuid(void) const\r
 {\r
@@ -222,6 +232,12 @@ _InputMethodInfoImpl::SetName(const scim::String& name)
        _ScimDataConverter::ConvertString(name, __name);\r
 }\r
 \r
+void\r
+_InputMethodInfoImpl::SetType(Tizen::Ui::Ime::InputMethodType type)\r
+{\r
+       __type = type;\r
+}\r
+\r
 result\r
 _InputMethodInfoImpl::AddLanguage(const char* language)\r
 {\r
index 790eeb1..1c946b9 100644 (file)
@@ -38,6 +38,7 @@
 #include <FBaseString.h>\r
 #include <FLclLocale.h>\r
 #include <FUiImeInputMethodInfo.h>\r
+#include <FUiImeTypes.h>\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
@@ -59,6 +60,7 @@ public:
        Tizen::App::AppId GetAppId(void) const;\r
        const Tizen::Base::Collection::IList* GetLanguageList(void) const;\r
        Tizen::Base::String GetName(void) const;\r
+       Tizen::Ui::Ime::InputMethodType GetType(void) const;\r
        const char* GetUuid(void) const;\r
 \r
        void SetAppId(Tizen::App::AppId id);\r
@@ -66,6 +68,7 @@ public:
        result SetLanguageList(const Tizen::Base::Collection::IList& list);\r
        void SetName(const Tizen::Base::String& name);\r
        void SetName(const scim::String& name);\r
+       void SetType(Tizen::Ui::Ime::InputMethodType type);\r
 \r
        result AddLanguage(const char* language);\r
 \r
@@ -80,6 +83,7 @@ private:
        Tizen::App::AppId __appId;\r
        Tizen::Base::String __uuid;\r
        Tizen::Base::String __name;\r
+       Tizen::Ui::Ime::InputMethodType __type;\r
 \r
        Tizen::Base::Collection::ArrayList* __pLanguageList;\r
 \r
index 45afd12..4262609 100644 (file)
@@ -40,6 +40,7 @@
 \r
 #include "FUiIme_InputMethodInfoImpl.h"\r
 #include "FUiIme_InputMethodManagerImpl.h"\r
+#include "FUiIme_ScimDataConverter.h"\r
 \r
 using namespace Tizen::App;\r
 using namespace Tizen::App::Package;\r
@@ -95,6 +96,7 @@ _InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath)
        // declare variables\r
        xmlDocPtr pXmlDoc = null;\r
        xmlNodePtr pXmlRootElement = null;\r
+       _InputMethodInfoImpl* pInputMethodInfoImpl = null;\r
 \r
        // get the manifest file path\r
        const char* _MANIFEST_FILE_PATH = "/info/manifest.xml";\r
@@ -119,6 +121,9 @@ _InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath)
        r = ParseInputMethodInfo(pXmlRootElement, pInputMethodInfo.get());\r
        SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
 \r
+       pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*(pInputMethodInfo.get()));\r
+       pInputMethodInfoImpl->SetType(INPUT_METHOD_TYPE_SOFTWARE);\r
+\r
        if (pXmlDoc)\r
        {\r
                xmlFreeDoc(pXmlDoc);\r
@@ -372,6 +377,7 @@ _InputMethodManagerImpl::GetInputMethodInfoListN(void) const
        pInputMethodInfoImpl->SetAppId(PRELOADED_IME_APPID);\r
        pInputMethodInfoImpl->SetUuid(dpList[preloadedImeIndex]);\r
        pInputMethodInfoImpl->SetName(String(pName));\r
+       pInputMethodInfoImpl->SetType(_ScimDataConverter::ConvertType(type));\r
        pLanguageList.reset(GetInputMethodLanguageListN(pLanguage));\r
        r = GetLastResult();\r
        SysTryCatch(NID_UI_IME, pLanguageList, , r, "[%s] Propagating.", GetErrorMessage(r));\r
index fc77ebe..3133bd3 100644 (file)
@@ -174,10 +174,10 @@ _InputServiceSignalListener::GetLanguage(const scim::HelperAgent* pHelperAgent,
 {\r
        SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
 \r
-       //Locale language = __pIInputMethodProvider->GetLanguage();\r
-       //std::unique_ptr<char[]> pLanguage(_ScimDataConverter::ConvertLanguageN(language));\r
+       Locale language = __pIInputMethodProvider->GetLanguage();\r
+       std::unique_ptr<char[]> pLanguage(_ScimDataConverter::ConvertLanguageN(language));\r
 \r
-       //*pLocale = strdup(pLanguage.get());\r
+       *pLocale = strdup(pLanguage.get());\r
 }\r
 \r
 void\r
@@ -372,6 +372,14 @@ _InputServiceSignalListener::OnCursorPositionChanged(const scim::HelperAgent* pH
 }\r
 \r
 void\r
+_InputServiceSignalListener::OnOpaqueCommandReceived(const scim::HelperAgent* pHelperAgent, char* pBuffer, size_t& length)\r
+{\r
+       SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+       __pIInputMethodListener->OnOpaqueCommandReceived(String(pBuffer));\r
+}\r
+\r
+void\r
 _InputServiceSignalListener::OnSurroundingTextReceived(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& text, int cursorPosition)\r
 {\r
        SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
index 1ebd54f..9bc6d25 100644 (file)
@@ -65,6 +65,7 @@ public:
 \r
        static void OnCursorPositionChanged(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid,\r
                                                                                        int position);\r
+       static void OnOpaqueCommandReceived(const scim::HelperAgent* pHelperAgent, char* pBuffer, size_t& length);\r
        static void OnSurroundingTextReceived(const scim::HelperAgent* pHelperAgent, int inputContext,\r
                                                                                                const scim::String& text, int cursorPosition);\r
        static void OnTerminate(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid);\r
index 95cb143..a9bacf3 100644 (file)
@@ -49,6 +49,23 @@ _ScimDataConverter::~_ScimDataConverter()
 \r
 }\r
 \r
+Tizen::Ui::Ime::InputMethodType\r
+_ScimDataConverter::ConvertType(ISE_TYPE_T type)\r
+{\r
+       InputMethodType inputMethodType = INPUT_METHOD_TYPE_SOFTWARE;\r
+\r
+       if (type == HARDWARE_KEYBOARD_ISE)\r
+       {\r
+               inputMethodType = INPUT_METHOD_TYPE_HARDWARE;\r
+       }\r
+       else if (type == SOFTWARE_KEYBOARD_ISE)\r
+       {\r
+               inputMethodType = INPUT_METHOD_TYPE_SOFTWARE;\r
+       }\r
+\r
+       return inputMethodType;\r
+}\r
+\r
 result\r
 _ScimDataConverter::ConvertKey(KeyCode code, KeyState state, scim::KeyEvent& event)\r
 {\r
index f1f30e9..6f2cf5b 100644 (file)
@@ -27,6 +27,7 @@
 \r
 #include <string> // basic_string in scim_types.h\r
 \r
+#include <isf_control.h>\r
 #define Uses_SCIM_EVENT\r
 #define Uses_SCIM_TYPES\r
 #undef null\r
@@ -38,6 +39,7 @@
 #include <FGrpRectangle.h>\r
 #include <FLclLocale.h>\r
 #include <FUiIKeyEventListener.h>\r
+#include <FUiImeTypes.h>\r
 \r
 namespace Tizen { namespace Ui { namespace Ime {\r
 \r
@@ -50,6 +52,8 @@ namespace Tizen { namespace Ui { namespace Ime {
 class _ScimDataConverter\r
 {\r
 public:\r
+       static Tizen::Ui::Ime::InputMethodType ConvertType(ISE_TYPE_T type);\r
+\r
        static result ConvertKey(Tizen::Ui::KeyCode keyCode, Tizen::Ui::KeyState keyState, scim::KeyEvent& keyEvent);\r
 \r
        static char* ConvertLanguageN(const Tizen::Locales::Locale& language);\r