[N_SE-43551] Support the multilingual display name for the IME application. submit/tizen_2.2/20130714.152926
authorbs0111.cho <bs0111.cho@samsung.com>
Fri, 28 Jun 2013 13:38:27 +0000 (22:38 +0900)
committerbs0111.cho <bs0111.cho@samsung.com>
Fri, 28 Jun 2013 13:38:27 +0000 (22:38 +0900)
Change-Id: Ia5d0e25e8a070d94b6128f4bfc266c50ba4c764a
Signed-off-by: bs0111.cho <bs0111.cho@samsung.com>
src/app/FApp_ImeEntry.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index a381d13..9517878
@@ -26,6 +26,7 @@
 #include <libxml/tree.h>
 #include <limits.h> // PATH_MAX
 #include <linux/capability.h>
+#include <pkgmgr-info.h>
 #include <privilege-control.h>
 #include <string.h>
 #include <unique_ptr.h>
@@ -54,7 +55,7 @@ static const char* _MANIFEST_FILE_PATH = "info/manifest.xml";
 static int __argc = 0;
 static char** __pArgv = NULL;
 
-static char __appId[_MAX_BUFFER_SIZE];
+static char __pkgId[_MAX_BUFFER_SIZE];
 static char __uuid[_MAX_BUFFER_SIZE];
 static char __name[_MAX_BUFFER_SIZE];
 static char __exeName[_MAX_BUFFER_SIZE];
@@ -265,11 +266,11 @@ ParseXmlNode(const xmlNodePtr pXmlNode)
 
                                if (pXmlChar)
                                {
-                                       strncpy(__appId, reinterpret_cast<char*>(pXmlChar), strlen(reinterpret_cast<char*>(pXmlChar)));
+                                       strncpy(__pkgId, reinterpret_cast<char*>(pXmlChar), strlen(reinterpret_cast<char*>(pXmlChar)));
                                        xmlFree(pXmlChar);
                                }
 
-                               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __appId is %s.", __func__, __LINE__, __appId);
+                               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > __pkgId is %s.", __func__, __LINE__, __pkgId);
                        }
                        else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Uuid")))
                        {
@@ -387,7 +388,7 @@ scim_helper_module_set_path_info(const char* path)
 {
        LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The path is %s.", __func__, __LINE__, path);
 
-       memset(__appId, '\0', _MAX_BUFFER_SIZE);
+       memset(__pkgId, '\0', _MAX_BUFFER_SIZE);
        memset(__uuid, '\0', _MAX_BUFFER_SIZE);
        memset(__name, '\0', _MAX_BUFFER_SIZE);
        memset(__exeName, '\0', _MAX_BUFFER_SIZE);
@@ -427,8 +428,21 @@ scim_helper_module_get_helper_info (unsigned int idx, scim::HelperInfo& info)
 
        if (idx == 0)
        {
-               info = scim::HelperInfo(__uuid, __name, "", "",
+               char appId[_MAX_BUFFER_SIZE];
+               memset(appId, '\0', _MAX_BUFFER_SIZE);
+               snprintf(appId, _MAX_BUFFER_SIZE - 1, "%s.%s", __pkgId, __exeName);
+               pkgmgrinfo_appinfo_h appInfoHandle = null;
+               char* pDisplayName = null;
+
+               pkgmgrinfo_appinfo_get_appinfo(appId, &appInfoHandle);
+               pkgmgrinfo_appinfo_get_label(appInfoHandle, &pDisplayName);
+
+               info = scim::HelperInfo(__uuid, pDisplayName, "", "",
                                                                scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | scim::SCIM_HELPER_AUTO_RESTART);
+               LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The application display name is %s.", __func__, __LINE__, pDisplayName);
+
+               pkgmgrinfo_appinfo_destroy_appinfo(appInfoHandle);
+
                return true;
        }
 
@@ -465,7 +479,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe
        char binaryPath[_MAX_BUFFER_SIZE];
        memset(binaryPath, '\0', _MAX_BUFFER_SIZE);
 
-       snprintf(binaryPath, _MAX_BUFFER_SIZE - 1, "/opt/apps/%s/bin/%s", __appId, __exeName);
+       snprintf(binaryPath, _MAX_BUFFER_SIZE - 1, "/opt/apps/%s/bin/%s", __pkgId, __exeName);
        LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The binary path is %s.", __func__, __LINE__, binaryPath);
 
        // set __pArgv
@@ -487,7 +501,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe
                char packageName[_MAX_PACKAGE_NAME];
                memset(packageName, '\0', _MAX_PACKAGE_NAME);
 
-               GetPackageNameFromAppIdAppExecutableName(__appId, __exeName, packageName, _MAX_PACKAGE_NAME);
+               GetPackageNameFromAppIdAppExecutableName(__pkgId, __exeName, packageName, _MAX_PACKAGE_NAME);
                AdjustPrivilege(packageName);
        }
 
@@ -502,7 +516,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe
                return;
        }
 
-       InitAppInfo(__appId, __exeName, __argc, __pArgv, fd);
+       InitAppInfo(__pkgId, __exeName, __argc, __pArgv, fd);
 
        //
        OspMain(__argc, __pArgv);