2 * ISF(Input Service Framework)
4 * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
5 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
7 * Contact: Haifeng Deng <haifeng.deng@samsung.com>, Hengliang Luo <hl.luo@samsung.com>
9 * This library is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License as published by the
11 * Free Software Foundation; either version 2.1 of the License, or (at your option)
14 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software Foundation, Inc., 51
21 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #define Uses_SCIM_DEBUG
26 #define Uses_SCIM_CONFIG
27 #define Uses_SCIM_CONFIG_MODULE
28 #define Uses_SCIM_CONFIG_PATH
29 #define Uses_SCIM_UTILITY
30 #define Uses_SCIM_PANEL_AGENT
38 #include "scim_private.h"
40 #include "isf_query_utility.h"
41 #include <privilege-control.h>
47 static void print_help (void)
49 std::cout << "Usage: isf-query-engines [option] ISE_MODULE_NAME\n\n"
50 << "The options are: \n"
51 << " -u, --uninstall If this option is not specified, the default action is to install.\n"
52 << " -t, --type isetype If this option is not specified, the default type is 0(keyboardISE).\n"
53 << " -h, --help Show this help message.\n";
56 int main (int argc, char *argv[])
66 if (String ("-t") == String (argv[i]) || String ("--type") == String (argv[i])) {
68 std::cerr << "No argument for option " << argv [i-1] << "\n";
71 isetype = atoi (argv[i]);
76 if (String ("-u") == String (argv[i]) || String ("--uninstall") == String (argv[i])) {
82 if (String ("-h") == String (argv[i]) || String ("--help") == String (argv[i])) {
91 String sys_file_name = String (SYS_ENGINE_FILE_NAME);
92 String user_file_name = String (USER_ENGINE_FILE_NAME);
93 String engine_file_name = sys_file_name;
95 if (access (engine_file_name.c_str (), F_OK | W_OK) != 0) {
96 FILE *filp = fopen (engine_file_name.c_str (), "a");
98 engine_file_name = user_file_name;
99 // Create folder for saving engine list
100 scim_make_dir (USER_ENGINE_LIST_PATH);
106 if (uninstall == 1) {
107 isf_remove_ise_info_from_file (engine_file_name.c_str (), isename);
111 ConfigModule *_config_module = 0;
112 ConfigPointer _config;
114 _config_module = new ConfigModule ("simple");
115 if (_config_module != NULL && _config_module->valid ())
116 _config = _config_module->create_config ();
117 if (_config.null ()) {
118 std::cerr << "Config module cannot be loaded, using dummy Config.\n";
120 if (_config_module) delete _config_module;
121 _config_module = NULL;
123 _config = new DummyConfig ();
126 char *lang_str = vconf_get_str (VCONFKEY_LANGSET);
128 if (strlen (lang_str)) {
129 setenv ("LANG", lang_str, 1);
130 setlocale (LC_MESSAGES, lang_str);
133 setenv ("LANG", "en_US.utf8", 1);
134 setlocale (LC_MESSAGES, "en_US.utf8");
138 isf_update_ise_info_to_file (engine_file_name.c_str (), _config);
143 isf_add_keyboard_info_to_file (engine_file_name.c_str (), isename, _config);
145 isf_add_helper_info_to_file (engine_file_name.c_str (), isename);
151 vi:ts=4:nowrap:ai:expandtab