#include <string.h>
#include <Eina.h>
#include <Ecore.h>
-#include <Ecore_File.h>
#include <malloc.h>
#include "scim_private.h"
#include "scim.h"
static const double _ise_check_pid_alive_time = 1.0f;
static String _ise_check_pid_alive_uuid;
-static Ecore_Timer *g_monitor_user_data_path_timer = NULL;
-
enum {
EMOJI_IMAGE_WIDTH = 0,
EMOJI_IMAGE_HEIGHT,
}
}
- LOGW ("Failed to launch IME (%s), %d", uuid.c_str (), _ime_info.size());
-
- return false;
-}
-
-/**
- * @brief Set temporary ISE.
- *
- * @param uuid The ISE's uuid.
- *
- * @return false if ISE change is failed, otherwise return true.
- */
-static bool set_temporary_ise (const String &uuid)
-{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- LOGD ("set temporary ISE (%s)", uuid.c_str ());
-
- if (uuid.length () <= 0)
- return false;
-
- bool ise_changed = false;
-
- if (_ime_info.size () == 0) {
-#ifdef HAVE_PKGMGR_INFO
- pkgmgrinfo_appinfo_filter_h handle;
- int ret = pkgmgrinfo_appinfo_filter_create (&handle);
- if (ret == PMINFO_R_OK) {
- /* Add the package info for the IME that matches with our uuid only */
- ret = pkgmgrinfo_appinfo_filter_add_string (handle, PMINFO_APPINFO_PROP_APP_ID, uuid.c_str ());
- if (ret == PMINFO_R_OK)
- ret = pkgmgrinfo_appinfo_filter_foreach_appinfo (handle, get_ime_app_list_cb, NULL);
- else {
- LOGE ("pkgmgrinfo_appinfo_filter_add_string failed(%d)", ret);
- }
- pkgmgrinfo_appinfo_filter_destroy (handle);
- } else {
- LOGE ("pkgmgrinfo_appinfo_filter_create failed(%d)", ret);
- }
-#endif
- }
-
-#ifdef HAVE_PKGMGR_INFO
- pkgmgrinfo_appinfo_h handle = NULL;
- int ret = pkgmgr_get_appinfo (uuid.c_str (), &handle);
- if (ret != PMINFO_R_OK) {
- LOGW ("appid \"%s\" is invalid.", uuid.c_str ());
- return false;
- }
-
- if (handle) {
- char *label = NULL;
- ret = pkgmgrinfo_appinfo_get_label (handle, &label);
- if (ret != PMINFO_R_OK) {
- LOGW ("Could not get label for appid '%s'", uuid.c_str ());
- pkgmgrinfo_appinfo_destroy_appinfo (handle);
- return false;
- }
-
- ise_changed = set_helper_ise (uuid, true);
-
- if (ise_changed) {
- _info_manager->set_current_toolbar_mode (TOOLBAR_HELPER_MODE);
- if (_TV)
- _info_manager->set_current_helper_option (SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO |
- SCIM_HELPER_AUTO_RESTART | ISM_HELPER_PROCESS_KEYBOARD_KEYEVENT);
- else
- _info_manager->set_current_helper_option (SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO |
- SCIM_HELPER_AUTO_RESTART);
- String label_string = label;
- _info_manager->set_current_ise_name (label_string);
-
-#ifdef HAVE_VCONF
- vconf_set_str (VCONFKEY_ISF_ACTIVE_KEYBOARD_UUID, uuid.c_str ());
-#endif
- } else {
- LOGW ("Failed to launch IME (%s)", uuid.c_str ());
- }
-
- pkgmgrinfo_appinfo_destroy_appinfo (handle);
-
- return ise_changed;
- }
-#endif
+ LOGW ("Failed to launch IME (%s)", uuid.c_str ());
return false;
}
String scim_helper_path;
- delete_ise_check_pid_alive_timer ();
+ delete_ise_check_pid_alive_timer();
#ifdef HAVE_PKGMGR_INFO
char *execpath = NULL;
return;
}
- LOGD ("exec path : %s %d", execpath, _ime_info.size ());
+ LOGD ("exec path : %s", execpath);
scim_helper_path = String (execpath);
if (appinfo_handle) {
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
- String helper_uuid = _config->read (SCIM_CONFIG_DEFAULT_HELPER_ISE, String(""));
- if (helper_uuid.length () > 0) {
- /* Start default ISE */
- change_keyboard_mode (TOOLBAR_HELPER_MODE);
- } else {
- set_temporary_ise (_initial_ise_uuid);
- }
+ /* Start default ISE */
+ change_keyboard_mode (TOOLBAR_HELPER_MODE);
}
static String sanitize_string (const char *str, int maxlen = 32)
return ret;
}
-static Eina_Bool monitor_user_data_path_timer(void *data)
-{
- const char *path = static_cast<const char*>(data);
- bool user_data_path_exists = ecore_file_exists (path);
- bool user_data_path_is_dir = ecore_file_is_dir (path);
- if (user_data_path_exists && user_data_path_is_dir) {
- LOGW ("'%s' exists : %d, is_dir : %d", path,
- (user_data_path_exists ? 1 : 0), (user_data_path_is_dir ? 1 : 0));
-
- /* Flush config before reloading */
- scim_global_config_flush ();
- scim_global_config_reload ();
-
- load_config ();
-
- /* Read all ime info from db */
- _ime_info.clear ();
- isf_pkg_select_all_ime_info_db (_ime_info);
-
- bool launch = true;
- if (_info_manager->get_current_toolbar_mode () != TOOLBAR_HELPER_MODE) {
- launch = false;
- }
- if (_launch_ise_on_request) {
- launch = false;
- }
- String default_ise_uuid = scim_global_config_read (String (SCIM_GLOBAL_CONFIG_DEFAULT_ISE_UUID), _initial_ise_uuid);
- set_active_ise (default_ise_uuid, launch);
-
- g_monitor_user_data_path_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
-
- return ECORE_CALLBACK_RENEW;
-}
-
int main (int argc, char *argv [])
{
struct tms tiks_buf;
String display_name = String ();
char buf[256] = {0};
- String user_data_path = String ();
- bool user_data_path_exists = false;
- bool user_data_path_is_dir = false;
-
#ifdef HAVE_ECOREX
Ecore_Event_Handler *xclient_message_handler = NULL;
Ecore_Event_Handler *xwindow_property_handler = NULL;
#endif /* CANDIDATE */
/* Load ISF configuration */
- user_data_path = scim_get_user_data_dir ();
- user_data_path_exists = ecore_file_exists (user_data_path.c_str ());
- user_data_path_is_dir = ecore_file_is_dir (user_data_path.c_str ());
- if (user_data_path_exists && user_data_path_is_dir) {
- load_config ();
- } else {
- LOGW ("'%s' exists : %d, is_dir : %d", user_data_path.c_str (),
- (user_data_path_exists ? 1 : 0), (user_data_path_is_dir ? 1 : 0));
- g_monitor_user_data_path_timer = ecore_timer_add (1.0, monitor_user_data_path_timer, user_data_path.c_str ());
- }
- check_time("load_config");
+ load_config ();
+ check_time ("load_config");
#ifdef HAVE_VCONF
char *lang_str;
_config->flush ();
ret = 0;
- if (g_monitor_user_data_path_timer) {
- ecore_timer_del (g_monitor_user_data_path_timer);
- g_monitor_user_data_path_timer = NULL;
- }
-
#ifdef HAVE_BLUETOOTH
/* deinitialize the callback function of Bluetooth connection */
ret = bt_hid_host_deinitialize ();