Fix bug Web IME couldn't be launched after first installation 38/33538/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 20 May 2014 12:10:19 +0000 (21:10 +0900)
committerLi Zhang <li2012.zhang@samsung.com>
Mon, 12 Jan 2015 06:30:55 +0000 (14:30 +0800)
[model] Redwood, B1, B2
[binary_type] PDA
[customer] OPEN
[issue#] N/A
[problem] Web IME couldn't be launched after first installation
[cause] The list of Web IME was not updated in scim-launcher
[solution] Update the list of Web IMEs in scim-launcher when updating the list of ISEs
[team] Input Framework
[request] N/A
[horizontal_expansion] N/A

Change-Id: I2689dfc85c9398ac14b1eaad4cf1bca9e9f715af

ism/modules/frontend/Makefile.am
ism/modules/frontend/scim_socket_frontend.cpp
ism/src/scim_panel_agent.cpp

index d70f0ba..2215b55 100644 (file)
@@ -72,13 +72,14 @@ x11_la_LIBADD      = imdkit/libXimd.la \
 
 socket_la_SOURCES  = scim_socket_frontend.cpp
 
-socket_la_CXXFLAGS = @DLOG_CFLAGS@ @ECORE_CFLAGS@
+socket_la_CXXFLAGS = @DLOG_CFLAGS@ @ECORE_CFLAGS@ @PKGMGR_INFO_CFLAGS@
 
 socket_la_LDFLAGS  = -avoid-version \
                      -rpath $(moduledir) \
                      -module \
                      @DLOG_LIBS@ \
                      @ECORE_LIBS@ \
+                     @PKGMGR_INFO_LIBS@ \
                      @LIBTOOL_EXPORT_OPTIONS@
 
 socket_la_LIBADD   = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la
index b7148aa..76e4ff0 100644 (file)
@@ -68,7 +68,9 @@
 #include <unistd.h>
 #include <signal.h>
 #include <dlog.h>
-
+#if HAVE_PKGMGR_INFO
+#include <pkgmgr-info.h>
+#endif
 
 #ifdef LOG_TAG
 # undef LOG_TAG
@@ -310,6 +312,10 @@ void SocketFrontEnd::run_helper (const Socket &client)
             //waitpid (pid, &status, 0);
 
             break;
+        } else {
+            snprintf (buf, sizeof (buf), "time:%ld  pid:%d  %s  %s  Can't find and exec scim_helper_launcher uuid : %s\n",
+                time (0), getpid (), __FILE__, __func__, uuid.c_str ());
+            isf_save_log (buf);
         }
     }
 
@@ -1982,6 +1988,72 @@ SocketFrontEnd::socket_set_display_name (int /*client_id*/)
     m_send_trans.put_command (SCIM_TRANS_CMD_OK);
 }
 
+#if HAVE_PKGMGR_INFO
+int app_list_cb (pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+    int ret;
+    char *app_id = NULL;
+    char *pkg_id = NULL, *pkg_label = NULL, *pkg_type = NULL, *pkg_root_path = NULL, *pkg_icon_path = NULL;
+    pkgmgrinfo_appinfo_h appinfo_handle;
+    pkgmgrinfo_pkginfo_h pkginfo_handle;
+    HelperInfo helper_info;
+    size_t i;
+
+    /* Get appid */
+    ret = pkgmgrinfo_appinfo_get_appid (handle, &app_id);
+    if (ret != PMINFO_R_OK)
+        return 0;
+
+    ret = pkgmgrinfo_appinfo_get_appinfo (app_id, &appinfo_handle);
+    if (ret != PMINFO_R_OK)
+        return 0;
+
+    /* Get package id */
+    pkgmgrinfo_appinfo_get_pkgname (appinfo_handle, &pkg_id);
+
+    /* Get package info handle */
+    ret = pkgmgrinfo_pkginfo_get_pkginfo (pkg_id, &pkginfo_handle);
+    if (ret != PMINFO_R_OK) {
+        pkgmgrinfo_appinfo_destroy_appinfo (appinfo_handle);
+        return 0;
+    }
+
+    /* Get the label of package */
+    pkgmgrinfo_pkginfo_get_label (pkginfo_handle, &pkg_label);
+
+    /* Get the type of package */
+    pkgmgrinfo_pkginfo_get_type (pkginfo_handle, &pkg_type);
+
+    /* Get the root path of package */
+    pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &pkg_root_path);
+
+    /* Get the icon path of package */
+    pkgmgrinfo_pkginfo_get_icon (pkginfo_handle, &pkg_icon_path);
+
+    if (pkg_type && !strncmp (pkg_type, "wgt", 3)) {
+        // FIXME : need to get UUID
+        helper_info.uuid = scim::String (app_id);
+        helper_info.name = scim::String (pkg_label);
+        helper_info.icon = scim::String (pkg_icon_path);
+        helper_info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO |
+            scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART;
+
+        for (i = 0; i < __helpers.size (); ++i) {
+            if (__helpers [i].first.uuid == helper_info.uuid)
+                break;
+        }
+
+        if (i == __helpers.size ())
+            __helpers.push_back (std::make_pair (helper_info, String ("ise-web-helper-agent")));
+    }
+
+    pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
+    pkgmgrinfo_appinfo_destroy_appinfo (appinfo_handle);
+
+    return 0;
+}
+#endif
+
 void
 SocketFrontEnd::socket_update_ise_list (int /*client_id*/)
 {
@@ -2037,6 +2109,22 @@ SocketFrontEnd::socket_update_ise_list (int /*client_id*/)
                 break;
             }
         }
+
+        /* Get the information of Web IMEs */
+#if HAVE_PKGMGR_INFO
+        int ret;
+        pkgmgrinfo_appinfo_filter_h handle;
+        ret = pkgmgrinfo_appinfo_filter_create (&handle);
+        if (ret != PMINFO_R_OK)
+            return;
+
+        ret = pkgmgrinfo_appinfo_filter_add_string (handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");
+        if (ret == PMINFO_R_OK) {
+            pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, app_list_cb, NULL);
+        }
+
+        pkgmgrinfo_appinfo_filter_destroy (handle);
+#endif
     }
 
     m_send_trans.put_command (SCIM_TRANS_CMD_OK);
index d725ae8..8fc19f3 100644 (file)
@@ -2744,8 +2744,6 @@ public:
         if (m_recv_trans.get_data (mode)) {
             m_signal_set_keyboard_mode (mode);
         }
-
-
     }
 
     void candidate_will_hide_ack (int client_id)