bin_PROGRAMS = $(CONFIG_SCIM_PANEL_EFL)
isf_panel_efl_SOURCES = isf_panel_efl.cpp \
- isf_panel_utility.cpp
+ isf_panel_utility.cpp \
+ $(top_builddir)/ism/src/isf_pkg.cpp
isf_panel_efl_CXXFLAGS = @EFL_CFLAGS@ \
@ECOREX_CFLAGS@ \
#include "isf_panel_utility.h"
#include "isf_query_utility.h"
#include <app_control.h>
+#include "isf_pkg.h"
using namespace scim;
return index;
}
-/**
- * @brief Read data from ime category manifest and insert initial db
- *
- * @param handle pkgmgrinfo_appinfo_h pointer
- * @param user_data The data to pass to this callback.
- *
- * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.
- *
- * @see _ime_app_list_cb function in scim.cpp; it's slightly different.
- */
-static int _filtered_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
-{
- int ret = 0;
- char *appid = NULL, *pkgid = NULL, *pkgtype = NULL, *exec = NULL, *label = NULL, *path = NULL;
- pkgmgrinfo_pkginfo_h pkginfo_handle = NULL;
- ImeInfoDB ime_db;
- bool *result = static_cast<bool*>(user_data);
-
- if (result) /* in this case, need to check category */ {
- bool exist = true;
- ret = pkgmgrinfo_appinfo_is_category_exist (handle, "http://tizen.org/category/ime", &exist);
- if (ret != PMINFO_R_OK || !exist) {
- return 0;
- }
- }
-
- /* appid */
- ret = pkgmgrinfo_appinfo_get_appid (handle, &appid);
- if (ret == PMINFO_R_OK)
- ime_db.appid = String (appid ? appid : "");
- else {
- ISF_SAVE_LOG ("appid is not available!\n");
- return 0;
- }
-
- ime_db.iconpath = "";
-
- /* pkgid */
- ret = pkgmgrinfo_appinfo_get_pkgid (handle, &pkgid);
- if (ret == PMINFO_R_OK)
- ime_db.pkgid = String (pkgid ? pkgid : "");
- else {
- ISF_SAVE_LOG ("pkgid is not available!\n");
- return 0;
- }
-
- /* exec path */
- ret = pkgmgrinfo_appinfo_get_exec (handle, &exec);
- if (ret == PMINFO_R_OK)
- ime_db.exec = String (exec ? exec : "");
- else {
- ISF_SAVE_LOG ("exec is not available!\n");
- return 0;
- }
-
- /* label */
- ret = pkgmgrinfo_appinfo_get_label (handle, &label);
- if (ret == PMINFO_R_OK)
- ime_db.label = String (label ? label : "");
-
- /* get pkgmgrinfo_pkginfo_h */
- ret = pkgmgrinfo_pkginfo_get_pkginfo (pkgid, &pkginfo_handle);
- if (ret == PMINFO_R_OK && pkginfo_handle) {
- /* pkgtype */
- ret = pkgmgrinfo_pkginfo_get_type(pkginfo_handle, &pkgtype);
-
- if (ret == PMINFO_R_OK)
- ime_db.pkgtype = String(pkgtype ? pkgtype : "");
- else {
- ISF_SAVE_LOG ("pkgtype is not available!");
- pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_handle);
- return 0;
- }
-
- /* pkgrootpath */
- ret = pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &path);
- }
-
- ime_db.languages = "en";
- ime_db.display_lang = "";
-
- if (ime_db.pkgtype.compare ("rpm") == 0 && //1 Inhouse IMEngine ISE(IME)
- ime_db.exec.find ("scim-launcher") != String::npos) // Some IMEngine's pkgid doesn't have "ise-engine" prefix.
- {
- ime_db.mode = TOOLBAR_KEYBOARD_MODE;
- ime_db.options = 0;
- ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
- + String (SCIM_PATH_DELIM_STRING) + String ("IMEngine");
- ime_db.module_name = ime_db.pkgid;
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- ime_db.has_option = 0; // It doesn't matter. No option for IMEngine...
- }
- else {
- ime_db.mode = TOOLBAR_HELPER_MODE;
- if (ime_db.pkgtype.compare ("rpm") == 0) //1 Inhouse Helper ISE(IME)
- {
-#ifdef _TV
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT;
-#else
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
-#endif
- ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
- + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
- ime_db.module_name = ime_db.pkgid;
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- ime_db.has_option = 1; // Let's assume the inhouse IME always has an option menu.
- }
-#ifdef _WEARABLE
- else if (ime_db.pkgtype.compare ("wgt") == 0) //1 Download Web IME
- {
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
- | SCIM_HELPER_NEED_SPOT_LOCATION_INFO | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
- ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
- + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
- ime_db.module_name = String ("ise-web-helper-agent");
- if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- }
- else {
- ime_db.is_enabled = 0;
- ime_db.is_preinstalled = 0;
- }
- ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
- }
-#endif
- else if (ime_db.pkgtype.compare ("tpk") == 0) //1 Download Native IME
- {
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
- | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
- if (path)
- ime_db.module_path = String (path) + String ("/lib");
- else
- ime_db.module_path = String ("/opt/usr/apps/") + ime_db.pkgid + String ("/lib");
- ime_db.module_name = String ("lib") + ime_db.exec.substr (ime_db.exec.find_last_of (SCIM_PATH_DELIM) + 1);
- if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- }
- else {
- ime_db.is_enabled = 0;
- ime_db.is_preinstalled = 0;
- }
- ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
- }
- else {
- ISF_SAVE_LOG ("Unsupported pkgtype(%s)\n", ime_db.pkgtype.c_str ());
- if (pkginfo_handle) {
- pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
- pkginfo_handle = NULL;
- }
- return 0;
- }
- }
-
- ret = isf_db_insert_ime_info (&ime_db);
- if (ret < 1)
- ret = isf_db_update_ime_info (&ime_db);
-
- if (pkginfo_handle) {
- pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
- pkginfo_handle = NULL;
- }
-
- if (result && ret)
- *result = true;
-
- return 0;
-}
-
#if HAVE_PKGMGR_INFO
/**
* @brief Insert ime_info data with pkgid.
return 0;
}
- ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, _filtered_app_list_cb, (void *)&isImePkg);
+ ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, isf_pkg_ime_app_list_cb, (void *)&isImePkg);
if (ret != PMINFO_R_OK) {
LOGW("pkgmgrinfo_appinfo_get_list failed(%d)", ret);
ret = 0;
/* Update ISE list */
std::vector<String> list;
if (update_ise_list (list) == false) { // If there is no IME, that is, if ime_info DB is empty... But probably it's already made by scim process.
- pkgmgrinfo_appinfo_filter_h handle;
- int result = pkgmgrinfo_appinfo_filter_create (&handle);
- if (result == PMINFO_R_OK) {
- result = pkgmgrinfo_appinfo_filter_add_string (handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");
- if (result == PMINFO_R_OK) {
- result = pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, _filtered_app_list_cb, NULL);
- }
- pkgmgrinfo_appinfo_filter_destroy (handle);
- }
-
+ isf_pkg_reload_ime_info_db();
update_ise_list (list);
}
*
*/
-#ifndef __ISE_PANEL_EFL_H__
-#define __ISE_PANEL_EFL_H__
+#ifndef __ISF_PANEL_EFL_H__
+#define __ISF_PANEL_EFL_H__
#include <dlog.h>
#endif
#define LOG_TAG "ISF_PANEL_EFL"
-#endif /* __ISE_PANEL_EFL_H__ */
+#endif /* __ISF_PANEL_EFL_H__ */
scim_keyboard_layout_data.h \
scim_keyevent_data.h \
scim_stl_map.h \
- isf_query_utility.h
+ isf_query_utility.h \
+ isf_pkg.h
libscimincludedir = $(includedir)/scim@SCIM_EPOCH@
bin_PROGRAMS = scim isf-log
-scim_SOURCES = scim.cpp
+scim_SOURCES = scim.cpp isf_pkg.cpp
scim_CXXFLAGS = @EFL_CFLAGS@ @PRIVILEGE_CONTROL_CFLAGS@ @VCONF_CFLAGS@ @PKGMGR_INFO_CFLAGS@ @ECORE_IPC_CFLAGS@ -fPIE
scim_LDADD = libscim@SCIM_EPOCH@.la
scim_LDFLAGS = @LTLIBINTL@ @EFL_LIBS@ @PRIVILEGE_CONTROL_LIBS@ @VCONF_LIBS@ @PKGMGR_INFO_LIBS@ @ECORE_IPC_LIBS@ -pie
libexecdir = $(libdir)/scim@SCIM_EPOCH@
libexec_PROGRAMS = scim-launcher scim-helper-launcher
-scim_launcher_SOURCES = scim_launcher.cpp
+scim_launcher_SOURCES = scim_launcher.cpp isf_pkg.cpp
scim_launcher_LDADD = libscim@SCIM_EPOCH@.la
-scim_launcher_CXXFLAGS = @PRIVILEGE_CONTROL_CFLAGS@ @VCONF_CFLAGS@ -fPIE
-scim_launcher_LDFLAGS = @LTLIBINTL@ @PRIVILEGE_CONTROL_LIBS@ @VCONF_LIBS@ -pie
+scim_launcher_CXXFLAGS = @PRIVILEGE_CONTROL_CFLAGS@ @VCONF_CFLAGS@ @PKGMGR_INFO_CFLAGS@ -fPIE
+scim_launcher_LDFLAGS = @LTLIBINTL@ @PRIVILEGE_CONTROL_LIBS@ @VCONF_LIBS@ @PKGMGR_INFO_LIBS@ -pie
scim_helper_launcher_SOURCES = scim_helper_launcher.cpp ise_preexec.cpp
scim_helper_launcher_CXXFLAGS = @PRIVILEGE_CONTROL_CFLAGS@ @EFL_CFLAGS@ @PKGMGR_INFO_CFLAGS@ @DLOG_CFLAGS@ @ECORE_IPC_CFLAGS@ -fPIE
--- /dev/null
+/* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
+
+/*
+ * Smart Common Input Method
+ *
+ * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
+ *
+ * $Id: scim_launcher.cpp,v 1.9 2005/06/15 00:19:08 suzhe Exp $
+ *
+ */
+
+#define Uses_SCIM_HELPER
+
+#include <unistd.h>
+#include "scim_private.h"
+#include "scim.h"
+#include <pkgmgr-info.h>
+#include <scim_panel_common.h>
+#include "isf_query_utility.h"
+#include "isf_pkg.h"
+
+using namespace scim;
+
+
+/**
+ * @brief Read data from ime category manifest and insert initial db
+ *
+ * @param handle pkgmgrinfo_appinfo_h pointer
+ * @param user_data The data to pass to this callback.
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.
+ */
+int isf_pkg_ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ int ret = 0;
+ char *appid = NULL, *pkgid = NULL, *pkgtype = NULL, *exec = NULL, *label = NULL, *path = NULL;
+ pkgmgrinfo_pkginfo_h pkginfo_handle = NULL;
+ ImeInfoDB ime_db;
+ bool *result = static_cast<bool*>(user_data);
+
+ if (result) /* in this case, need to check category */ {
+ bool exist = true;
+ ret = pkgmgrinfo_appinfo_is_category_exist (handle, "http://tizen.org/category/ime", &exist);
+ if (ret != PMINFO_R_OK || !exist) {
+ return 0;
+ }
+ }
+
+ /* appid */
+ ret = pkgmgrinfo_appinfo_get_appid (handle, &appid);
+ if (ret == PMINFO_R_OK)
+ ime_db.appid = String (appid ? appid : "");
+ else {
+ ISF_SAVE_LOG ("appid is not available!\n");
+ return 0;
+ }
+
+ ime_db.iconpath = "";
+
+ /* pkgid */
+ ret = pkgmgrinfo_appinfo_get_pkgid (handle, &pkgid);
+ if (ret == PMINFO_R_OK)
+ ime_db.pkgid = String (pkgid ? pkgid : "");
+ else {
+ ISF_SAVE_LOG ("pkgid is not available!\n");
+ return 0;
+ }
+
+ /* exec path */
+ ret = pkgmgrinfo_appinfo_get_exec (handle, &exec);
+ if (ret == PMINFO_R_OK)
+ ime_db.exec = String (exec ? exec : "");
+ else {
+ ISF_SAVE_LOG ("exec is not available!\n");
+ return 0;
+ }
+
+ /* label */
+ ret = pkgmgrinfo_appinfo_get_label (handle, &label);
+ if (ret == PMINFO_R_OK)
+ ime_db.label = String (label ? label : "");
+
+ /* get pkgmgrinfo_pkginfo_h */
+ ret = pkgmgrinfo_pkginfo_get_pkginfo (pkgid, &pkginfo_handle);
+ if (ret == PMINFO_R_OK && pkginfo_handle) {
+ /* pkgtype */
+ ret = pkgmgrinfo_pkginfo_get_type(pkginfo_handle, &pkgtype);
+
+ if (ret == PMINFO_R_OK)
+ ime_db.pkgtype = String(pkgtype ? pkgtype : "");
+ else {
+ ISF_SAVE_LOG ("pkgtype is not available!");
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_handle);
+ return 0;
+ }
+
+ /* pkgrootpath */
+ ret = pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &path);
+ }
+
+ ime_db.languages = "en";
+ ime_db.display_lang = "";
+
+ if (ime_db.pkgtype.compare ("rpm") == 0 && //1 Inhouse IMEngine ISE(IME)
+ ime_db.exec.find ("scim-launcher") != String::npos) // Some IMEngine's pkgid doesn't have "ise-engine" prefix.
+ {
+ ime_db.mode = TOOLBAR_KEYBOARD_MODE;
+ ime_db.options = 0;
+ ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+ + String (SCIM_PATH_DELIM_STRING) + String ("IMEngine");
+ ime_db.module_name = ime_db.pkgid;
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ ime_db.has_option = 0; // It doesn't matter. No option for IMEngine...
+ }
+ else {
+ ime_db.mode = TOOLBAR_HELPER_MODE;
+ if (ime_db.pkgtype.compare ("rpm") == 0) //1 Inhouse Helper ISE(IME)
+ {
+#ifdef _TV
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT;
+#else
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
+#endif
+ ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+ + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
+ ime_db.module_name = ime_db.pkgid;
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ ime_db.has_option = 1; // Let's assume the inhouse IME always has an option menu.
+ }
+#ifdef _WEARABLE
+ else if (ime_db.pkgtype.compare ("wgt") == 0) //1 Download Web IME
+ {
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
+ | SCIM_HELPER_NEED_SPOT_LOCATION_INFO | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
+ ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+ + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
+ ime_db.module_name = String ("ise-web-helper-agent");
+ if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ }
+ else {
+ ime_db.is_enabled = 0;
+ ime_db.is_preinstalled = 0;
+ }
+ ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
+ }
+#endif
+ else if (ime_db.pkgtype.compare ("tpk") == 0) //1 Download Native IME
+ {
+ ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
+ | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
+ if (path)
+ ime_db.module_path = String (path) + String ("/lib");
+ else
+ ime_db.module_path = String ("/opt/usr/apps/") + ime_db.pkgid + String ("/lib");
+ ime_db.module_name = String ("lib") + ime_db.exec.substr (ime_db.exec.find_last_of (SCIM_PATH_DELIM) + 1);
+ if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
+ ime_db.is_enabled = 1;
+ ime_db.is_preinstalled = 1;
+ }
+ else {
+ ime_db.is_enabled = 0;
+ ime_db.is_preinstalled = 0;
+ }
+ ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
+ }
+ else {
+ ISF_SAVE_LOG ("Unsupported pkgtype(%s)\n", ime_db.pkgtype.c_str ());
+ if (pkginfo_handle) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
+ pkginfo_handle = NULL;
+ }
+ return 0;
+ }
+ }
+
+ ret = isf_db_insert_ime_info (&ime_db);
+ if (ret < 1) {
+ if (result)
+ ret = isf_db_update_ime_info (&ime_db);
+ if (ret < 1)
+ ISF_SAVE_LOG("isf_db_%s_ime_info failed(%d). appid=%s pkgid=%s\n", (result? "update" : "insert"), ret, ime_db.appid.c_str(), ime_db.pkgid.c_str());
+ }
+
+ if (pkginfo_handle) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
+ pkginfo_handle = NULL;
+ }
+
+ if (result && ret)
+ *result = true;
+
+ return 0;
+}
+
+
+/**
+ * @brief Reload ime_info DB. This needs to be called when ime_info table is empty.
+ */
+void isf_pkg_reload_ime_info_db(void)
+{
+ pkgmgrinfo_appinfo_filter_h handle;
+ int ret = pkgmgrinfo_appinfo_filter_create (&handle);
+ if (ret == PMINFO_R_OK) {
+ ret = pkgmgrinfo_appinfo_filter_add_string (handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");
+ if (ret == PMINFO_R_OK) {
+ ret = pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, isf_pkg_ime_app_list_cb, NULL);
+ }
+ pkgmgrinfo_appinfo_filter_destroy (handle);
+ }
+}
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
+
--- /dev/null
+/*
+ * ISF(Input Service Framework)
+ *
+ * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
+ * Copyright (c) 2012-2014 Samsung Electronics Co., Ltd.
+ *
+ * Contact: Sungmin Kwak <sungmin.kwak@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __ISF_PKG_H__
+#define __ISF_PKG_H__
+
+int isf_pkg_ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data);
+void isf_pkg_reload_ime_info_db(void);
+
+#endif /* __ISF_PKG_H__ */
+
*
*/
-#ifndef __ISF_QUERY_UTILITY_H
-#define __ISF_QUERY_UTILITY_H
+#ifndef __ISF_QUERY_UTILITY_H__
+#define __ISF_QUERY_UTILITY_H__
/* For multi-user support */
#include <tzplatform_config.h>
/////////////////////////////////////////////////////////////////////////////
// Declaration of macro.
/////////////////////////////////////////////////////////////////////////////
-#define USER_ENGINE_LIST_PATH "/home/app/.scim"
typedef struct {
String name;
EAPI int isf_db_insert_ime_info(ImeInfoDB *ime_db);
EAPI int isf_db_delete_ime_info_by_pkgid(const char *pkgid);
-#endif /* __ISF_QUERY_UTILITY_H */
+#endif /* __ISF_QUERY_UTILITY_H__ */
/*
vi:ts=4:ai:nowrap:expandtab
#include <sys/resource.h>
#include <sched.h>
#include <pkgmgr-info.h>
-#include <scim_panel_common.h>
-#include "isf_query_utility.h"
+#include "isf_pkg.h"
using namespace scim;
using std::cout;
return true;
}
-/**
- * @brief Read data from ime category manifest and insert initial db
- *
- * @param handle pkgmgrinfo_appinfo_h pointer
- * @param user_data The data to pass to this callback.
- *
- * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.
- *
- * @see _filtered_app_list_cb function in isf_panel_efl.cpp; it's slightly different.
- */
-static int _ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
-{
- int ret = 0;
- char *appid = NULL, *pkgid = NULL, *pkgtype = NULL, *exec = NULL, *label = NULL, *path = NULL;
- pkgmgrinfo_pkginfo_h pkginfo_handle = NULL;
- ImeInfoDB ime_db;
-
- /* appid */
- ret = pkgmgrinfo_appinfo_get_appid (handle, &appid);
- if (ret == PMINFO_R_OK)
- ime_db.appid = String (appid ? appid : "");
- else {
- ISF_SAVE_LOG ("appid is not available!\n");
- return 0;
- }
-
- ime_db.iconpath = "";
-
- /* pkgid */
- ret = pkgmgrinfo_appinfo_get_pkgid (handle, &pkgid);
- if (ret == PMINFO_R_OK)
- ime_db.pkgid = String (pkgid ? pkgid : "");
- else {
- ISF_SAVE_LOG ("pkgid is not available!\n");
- return 0;
- }
-
- /* exec path */
- ret = pkgmgrinfo_appinfo_get_exec (handle, &exec);
- if (ret == PMINFO_R_OK)
- ime_db.exec = String (exec ? exec : "");
- else {
- ISF_SAVE_LOG ("exec is not available!\n");
- return 0;
- }
-
- /* label */
- ret = pkgmgrinfo_appinfo_get_label (handle, &label);
- if (ret == PMINFO_R_OK)
- ime_db.label = String (label ? label : "");
-
- /* get pkgmgrinfo_pkginfo_h */
- ret = pkgmgrinfo_pkginfo_get_pkginfo (pkgid, &pkginfo_handle);
- if (ret == PMINFO_R_OK && pkginfo_handle) {
- /* pkgtype */
- ret = pkgmgrinfo_pkginfo_get_type(pkginfo_handle, &pkgtype);
-
- if (ret == PMINFO_R_OK)
- ime_db.pkgtype = String(pkgtype ? pkgtype : "");
- else {
- ISF_SAVE_LOG ("pkgtype is not available!");
- pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo_handle);
- return 0;
- }
-
- /* pkgrootpath */
- ret = pkgmgrinfo_pkginfo_get_root_path (pkginfo_handle, &path);
- }
-
- ime_db.languages = "en";
- ime_db.display_lang = "";
-
- if (ime_db.pkgtype.compare ("rpm") == 0 && //1 Inhouse IMEngine ISE(IME)
- ime_db.exec.find ("scim-launcher") != String::npos) // Some IMEngine's pkgid doesn't have "ise-engine" prefix.
- {
- ime_db.mode = TOOLBAR_KEYBOARD_MODE;
- ime_db.options = 0;
- ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
- + String (SCIM_PATH_DELIM_STRING) + String ("IMEngine");
- ime_db.module_name = ime_db.pkgid;
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- ime_db.has_option = 0; // It doesn't matter. No option for IMEngine...
- }
- else {
- ime_db.mode = TOOLBAR_HELPER_MODE;
- if (ime_db.pkgtype.compare ("rpm") == 0) //1 Inhouse Helper ISE(IME)
- {
-#ifdef _TV
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT;
-#else
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
-#endif
- ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
- + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
- ime_db.module_name = ime_db.pkgid;
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- ime_db.has_option = 1; // Let's assume the inhouse IME always has an option menu.
- }
-#ifdef _WEARABLE
- else if (ime_db.pkgtype.compare ("wgt") == 0) //1 Download Web IME
- {
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
- | SCIM_HELPER_NEED_SPOT_LOCATION_INFO | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
- ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
- + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
- ime_db.module_name = String ("ise-web-helper-agent");
- if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- }
- else {
- ime_db.is_enabled = 0;
- ime_db.is_preinstalled = 0;
- }
- ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
- }
-#endif
- else if (ime_db.pkgtype.compare ("tpk") == 0) //1 Download Native IME
- {
- ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART
- | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT | ISM_HELPER_WITHOUT_IMENGINE;
- if (path)
- ime_db.module_path = String (path) + String ("/lib");
- else
- ime_db.module_path = String ("/opt/usr/apps/") + ime_db.pkgid + String ("/lib");
- ime_db.module_name = String ("lib") + ime_db.exec.substr (ime_db.exec.find_last_of (SCIM_PATH_DELIM) + 1);
- if (ime_db.exec.compare (0, 5, "/usr/") == 0) {
- ime_db.is_enabled = 1;
- ime_db.is_preinstalled = 1;
- }
- else {
- ime_db.is_enabled = 0;
- ime_db.is_preinstalled = 0;
- }
- ime_db.has_option = -1; // At this point, we can't know IME has an option (setting) or not; -1 means unknown.
- }
- else {
- ISF_SAVE_LOG ("Unsupported pkgtype(%s)\n", ime_db.pkgtype.c_str ());
- if (pkginfo_handle) {
- pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
- pkginfo_handle = NULL;
- }
- return 0;
- }
- }
-
- ret = isf_db_insert_ime_info (&ime_db);
- if (ret < 1) {
- ISF_SAVE_LOG("isf_db_insert_ime_info failed(%d). appid=%s pkgid=%s\n", ret, ime_db.appid.c_str(), ime_db.pkgid.c_str());
- }
-
- if (pkginfo_handle) {
- pkgmgrinfo_pkginfo_destroy_pkginfo (pkginfo_handle);
- pkginfo_handle = NULL;
- }
-
- return 0;
-}
-
-
/* The broker for launching OSP based IMEs */
// {
scim_get_helper_module_list (helper_list);
if (helper_list.size () < 1) { // If there is no IME, that is, if ime_info DB is empty...
- pkgmgrinfo_appinfo_filter_h handle;
- int ret = pkgmgrinfo_appinfo_filter_create (&handle);
- if (ret == PMINFO_R_OK) {
- ret = pkgmgrinfo_appinfo_filter_add_string (handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");
- if (ret == PMINFO_R_OK) {
- ret = pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, _ime_app_list_cb, NULL);
- }
- pkgmgrinfo_appinfo_filter_destroy (handle);
- }
-
+ isf_pkg_reload_ime_info_db();
scim_get_helper_module_list (helper_list); // Assuming ime_info DB is initialized, try again.
}
#define Uses_C_LOCALE
#define Uses_SCIM_UTILITY
#define Uses_SCIM_PANEL_AGENT
+#define Uses_SCIM_HELPER_MODULE
#include "scim_private.h"
#include "scim.h"
#include <signal.h>
#include <privilege-control.h>
#include <vconf.h>
-#include "isf_query_utility.h"
+#include <pkgmgr-info.h>
+#include "isf_pkg.h"
using namespace scim;
static ConfigModule *config_module = 0;
static ConfigPointer config;
+#define USER_ENGINE_LIST_PATH "/home/app/.scim"
+
void signalhandler (int sig)
{
if (!config.null ())
String config_name ("simple");
String frontend_name ("socket");
+ String list;
int new_argc = 0;
char *new_argv [40];
std::cerr << "No argument for option " << argv [i-1] << "\n";
return -1;
}
+
+ new_argv [new_argc ++] = const_cast <char *> ("-e");
+
if (String (argv [i]) == "all") {
scim_get_imengine_module_list (engine_list);
+ if (engine_list.size () <= 1) { // If there is no IME, only "socket" is given by scim_get_imengine_module_list().
+ isf_pkg_reload_ime_info_db();
+ scim_get_imengine_module_list (engine_list); // Assuming ime_info DB is initialized, try again.
+ }
+
for (size_t j = 0; j < engine_list.size (); ++j) {
if (engine_list [j] == "socket") {
engine_list.erase (engine_list.begin () + j);
break;
}
}
- } else if (String (argv [i]) != "none") {
+
+ list = scim_combine_string_list(engine_list, ',');
+ if (list.length () < 1)
+ new_argv [new_argc ++] = argv [i];
+ else
+ new_argv [new_argc ++] = const_cast<char *>(list.c_str ());
+ }
+ else if (String (argv [i]) == "none") { // If ime_info DB is empty, scim_launch() function gives "none" argument as engine list because of pkgmgr-info dependency change
+ std::vector<String> imengine_list;
+ std::vector<String> helper_list;
+ std::vector<String>::iterator it;
+
+ //get modules list
+ scim_get_imengine_module_list (imengine_list);
+ if (imengine_list.size () <= 1) { // If there is no IME, only "socket" is given by scim_get_imengine_module_list().
+ isf_pkg_reload_ime_info_db();
+ scim_get_imengine_module_list (imengine_list); // Assuming ime_info DB is initialized, try again.
+ }
+ scim_get_helper_module_list (helper_list);
+
+ for (it = imengine_list.begin (); it != imengine_list.end (); it++) {
+ if (*it != "socket")
+ engine_list.push_back (*it);
+ }
+ for (it = helper_list.begin (); it != helper_list.end (); it++)
+ engine_list.push_back (*it);
+
+ list = scim_combine_string_list(engine_list, ',');
+ if (list.length () < 1)
+ new_argv [new_argc ++] = argv [i];
+ else
+ new_argv [new_argc ++] = const_cast<char *>(list.c_str ());
+ }
+ else {
scim_split_string_list (engine_list, String (argv [i]), ',');
+
+ new_argv [new_argc ++] = argv [i];
}
- new_argv [new_argc ++] = const_cast <char *> ("-e");
- new_argv [new_argc ++] = argv [i];
+
continue;
}