Пример #1
0
void
HangulFactory::reload_config(const ConfigPointer &config)
{
    if (config.null())
	return;

    m_show_candidate_comment = config->read(String(SCIM_CONFIG_SHOW_CANDIDATE_COMMENT),
					    m_show_candidate_comment);

    m_keyboard_layout = config->read(String(SCIM_CONFIG_LAYOUT), String("2"));

    m_use_ascii_mode = config->read(String(SCIM_CONFIG_USE_ASCII_MODE),
				    false);
    m_commit_by_word = config->read(String(SCIM_CONFIG_COMMIT_BY_WORD),
				    false);
    m_hanja_mode = config->read(String(SCIM_CONFIG_HANJA_MODE),
				    false);

    String str;
    str = config->read(String(SCIM_CONFIG_HANGUL_KEY),
		       String("Hangul,Shift+space"));
    scim_string_to_key_list(m_hangul_keys, str);

    str = config->read(String (SCIM_CONFIG_HANJA_KEY),
		       String ("Hangul_Hanja,F9"));
    scim_string_to_key_list(m_hanja_keys, str);

    str = config->read(String (SCIM_CONFIG_HANJA_MODE_KEY),
		       String (""));
    scim_string_to_key_list(m_hanja_mode_keys, str);

    m_lookup_table_vertical = config->read(String(SCIM_CONFIG_PANEL_LOOKUP_TABLE_VERTICAL),
					   false);
}
Пример #2
0
static void on_destroy (ui_gadget_h ug, service_h s, void *priv)
{
    if ( ug == NULL|| priv == NULL)
        return;

    if (imf_context != NULL) {
        ecore_imf_context_del(imf_context);
        imf_context = NULL;
    }

    struct ug_data *ugd = (struct ug_data *) priv;

    if (ugd->naviframe != NULL) {
        evas_object_del (ugd->naviframe);
        ugd->naviframe = NULL;
    }

    if (ugd->layout_main != NULL) {
        evas_object_del (ugd->layout_main);
        ugd->layout_main = NULL;
    }

    if (!_config.null ()) {
        _config->flush ();
        _config.reset ();
    }
}
Пример #3
0
static void *on_create (ui_gadget_h ug, enum ug_mode mode, service_h s, void *priv)
{
    Evas_Object *parent = NULL;
    Evas_Object *content = NULL;

    if ( ug == NULL || priv == NULL)
        return NULL;

    bindtextdomain (WIZARD_PACKAGE, WIZARD_LOCALEDIR);

    struct ug_data *ugd = (struct ug_data *)priv;
    ugd->ug = ug;
    ugd->data = s;
    parent = (Evas_Object *) ug_get_parent_layout (ug);
    if (parent == NULL)
        return NULL;
    //-------------------------- ise infomation ----------------------------

    const char *ctx_id = ecore_imf_context_default_id_get ();
    if (ctx_id != NULL) {
        imf_context = ecore_imf_context_add (ctx_id);
    }

    _config = isf_imf_context_get_config ();
    if (_config.null ()) {
        std::cerr << "Create dummy config!!!\n";
        _config = new DummyConfig ();
    }

    if (_config.null ()) {
        std::cerr << "Can not create Config Object!\n";
    }

    //only helper ISEs will be needed in isfsetting according to phone requirement.
    isf_load_ise_information (HELPER_ONLY, _config);
    // Request ISF to update ISE list, below codes are very important, dont remove
    char **iselist = NULL;
    int count = isf_control_get_ise_list (&iselist);
    for (unsigned int i = 0; i < (unsigned int)count; i++) {
        SCIM_DEBUG_MAIN (3) << " [" << i << " : " << iselist[i] << "] \n";
        if (iselist[i] != NULL)
            delete []  (iselist[i]);
    }

    if (iselist!=NULL)
        free(iselist);
    //-------------------------- ise infomation ----------------------------

    //construct the UI part of the isfsetting module
    if (mode == UG_MODE_FULLVIEW)
        ugd->layout_main = create_fullview (parent, ugd);
    else
        ugd->layout_main = create_frameview (parent, ugd);

    if (ugd->layout_main != NULL) {
        content = isf_setting_main_view_tizen(ugd);
        elm_object_part_content_set (ugd->layout_main, "elm.swallow.content", content);
    }
    return (void *)ugd->layout_main;
}
void save_config(const ConfigPointer& config)
{
    //Don't save to a null config file.
    if (config.null())
        return;

    //Flash our file: burmese_numerals
    int id = 0;
    for (int i=0; i<__burmese_numerals_config_opts; i++) {
        if (__config_burmese_numerals == __burmese_numerals_config_vals[i])
	    id = i;
    }
    config->write(String(SCIM_CONFIG_IMENGINE_WAITZAR_BURMESE_NUMERALS), String(__burmese_numerals_config_string[id]));

    //Flash our file: default_encoding
    id = 0;
    for (int i=0; i<__default_encoding_config_opts; i++) {
        if (__config_default_encoding == __default_encoding_config_vals[i])
	    id = i;
    }
    config->write(String(SCIM_CONFIG_IMENGINE_WAITZAR_DEFAULT_ENCODING), String(__default_encoding_config_string[id]));

    //The update is complete
    __has_changed = false;
}
void load_config (const ConfigPointer& config)
{
    //Don't parse null configurations
    if (!config)
	return;

    //Read option 1: burmese_numerals
    String str = config->read(String(SCIM_CONFIG_IMENGINE_WAITZAR_BURMESE_NUMERALS), String(__burmese_numerals_config_string[0]));
    __config_burmese_numerals = __burmese_numerals_config_vals[0];
    for (int i=0; i<__burmese_numerals_config_opts; i++) {
        if (str == __burmese_numerals_config_string[i])
            __config_burmese_numerals = __burmese_numerals_config_vals[i];
    }

    //Read option 2: default_encoding
    str = config->read(String(SCIM_CONFIG_IMENGINE_WAITZAR_DEFAULT_ENCODING), String(__default_encoding_config_string[0]));
    __config_default_encoding = __default_encoding_config_vals[0];
    for (int i=0; i<__default_encoding_config_opts; i++) {
        if (str == __default_encoding_config_string[i])
            __config_default_encoding = __default_encoding_config_vals[i];
    }

    //Reset the radio buttons
    setup_widget_value ();
}
Пример #6
0
void
FrontEndHotkeyMatcher::save_hotkeys (const ConfigPointer &config) const
{
    if (config.null () || !config->valid ()) return;

    KeyEventList keys;
    String keystr;

    for (int i = SCIM_FRONTEND_HOTKEY_TRIGGER; i <= SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU; ++i) {
        if (m_impl->m_matcher.find_hotkeys (i, keys) > 0 && scim_key_list_to_string (keystr, keys))
            config->write (String (__scim_frontend_hotkey_config_paths [i]), keystr);
    }
}
Пример #7
0
void ScimBridgeAgentImpl::slot_reload_config (const ConfigPointer &config)
{
    scim_bridge_pdebugln (8, "slot_reload_config ()");

    scim_frontend_hotkey_matcher.load_hotkeys (scim_config);
    scim_imengine_hotkey_matcher.load_hotkeys (scim_config);
    
    KeyEvent key;
    scim_string_to_key (key,
        config->read (String (SCIM_CONFIG_HOTKEYS_FRONTEND_VALID_KEY_MASK),
                      String ("Shift+Control+Alt+Lock")));

    int key_mask = (key.mask > 0) ? key.mask : 0xFFFF;
    key_mask |= SCIM_KEY_ReleaseMask;
    // Special treatment for two backslash keys on jp106 keyboard.
    key_mask |= SCIM_KEY_QuirkKanaRoMask;
    
    valid_key_mask = key_mask;

    ScimBridgeAgentIMContext::set_enabled_by_default (scim_config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), ScimBridgeAgentIMContext::is_enabled_by_default ()));
    ScimBridgeAgentIMContext::set_imengine_shared (scim_config->read (String (SCIM_CONFIG_FRONTEND_SHARED_INPUT_METHOD), ScimBridgeAgentIMContext::is_imengine_shared ()));
    ScimBridgeAgentIMContext::set_on_the_spot_enabled (scim_config->read (String (SCIM_CONFIG_FRONTEND_ON_THE_SPOT), ScimBridgeAgentIMContext::is_on_the_spot_enabled ()));

    // Get keyboard layout setting
    // Flush the global config first, in order to load the new configs from disk.
    scim_global_config_flush ();

    scim_keyboard_layout = scim_get_default_keyboard_layout ();

    // Hot key name, hot key config key.
    // ! Update hotkey_list_length according to updated list length.
    int hotkey_list_length = 6;
    String hotkey_list[][2] = {
        { "Toggle on/off - ", "/Hotkeys/FrontEnd/Trigger" },
        { "Turn on - ", "/Hotkeys/FrontEnd/On" },
        { "Turn off - ", "/Hotkeys/FrontEnd/Off" },
        { "Next input method - ", "/Hotkeys/FrontEnd/NextFactory" },
        { "Previous input method - ", "/Hotkeys/FrontEnd/PreviousFactory" },
        { "Show input method menu - ", "/Hotkeys/FrontEnd/ShowFactoryMenu" }
    };
                           
    // Undefined hot keys are hidden from help window.
    String help_hotkeys = "\nGlobal Hotkeys:";
    for ( int i = 0; i < hotkey_list_length; i++ ) {
        String tmp_hotkeys = scim_config->read (String (hotkey_list[i][1]), String (""));
        if ( tmp_hotkeys != "" )
            help_hotkeys += "\n" + hotkey_list[i][0] + "<" + tmp_hotkeys + ">";
    }
    ScimBridgeAgentIMContext::set_help_hotkeys (help_hotkeys);
}
Пример #8
0
void
FrontEndHotkeyMatcher::load_hotkeys (const ConfigPointer &config)
{
    clear ();

    if (config.null () || !config->valid ()) return;

    KeyEventList keys;

    // Load the least important hotkeys first.
    for (int i = SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU; i >= SCIM_FRONTEND_HOTKEY_TRIGGER; --i) {
        if (scim_string_to_key_list (keys, config->read (String (__scim_frontend_hotkey_config_paths [i]), String (__scim_frontend_hotkey_defaults [i]))))
            m_impl->m_matcher.add_hotkeys (keys, i);
    }
}
Пример #9
0
void
romaji_page_save_config (const ConfigPointer &config)
{
    __config_romaji_theme_file
        = config->write (String (SCIM_ANTHY_CONFIG_ROMAJI_THEME_FILE),
                         String (__config_romaji_theme_file));
}
Пример #10
0
void
romaji_page_load_config (const ConfigPointer &config)
{
    __config_romaji_theme_file
        = config->read (String (SCIM_ANTHY_CONFIG_ROMAJI_THEME_FILE),
                        String (SCIM_ANTHY_CONFIG_ROMAJI_THEME_FILE_DEFAULT));
    setup_romaji_page ();
}
Пример #11
0
 void scim_module_exit (void)
 {
     if (_scim_config)
         _scim_config.reset ();
     if (scim_skkdict) {
         scim_skkdict->dump_userdict();
         delete scim_skkdict;
     }
 }
Пример #12
0
void
IMEngineHotkeyMatcher::save_hotkeys (const ConfigPointer &config) const
{
    if (config.null () || !config->valid () || !m_impl->m_uuids.size ()) return;

    KeyEventList keys;
    String keystr;
    std::vector <String> uuids;

    for (size_t i = 0; i < m_impl->m_uuids.size (); ++i) {
        if (m_impl->m_matcher.find_hotkeys ((int) i, keys) > 0 && scim_key_list_to_string (keystr, keys)) {
            config->write (String (SCIM_CONFIG_HOTKEYS_IMENGINE "/") + m_impl->m_uuids [i], keystr);
            uuids.push_back (m_impl->m_uuids [i]);
        }
    }

    config->write (String (SCIM_CONFIG_HOTKEYS_IMENGINE_LIST), scim_combine_string_list (uuids));
}
Пример #13
0
void signalhandler(int sig)
{
    if (config != NULL) {
        config->flush ();
    }

    std::cerr << "SCIM successfully exited.\n";

    exit (0);
}
Пример #14
0
void
ArrayFactory::reload_config(const ConfigPointer &config)
{
    if (config.null())
        return;

    String str;
    str = config->read(String(SCIM_CONFIG_IMENGINE_ARRAY_ENCHKEY),
                    String(""));
    scim_string_to_key_list(m_ench_key, str);

    str = config->read(String(SCIM_CONFIG_IMENGINE_ARRAY_HFKEY),
                    String("Shift+space"));
    scim_string_to_key_list(m_full_half_key, str);

    m_show_special = config->read(String(SCIM_CONFIG_IMENGINE_ARRAY_SHOW_SPECIAL),
                    false);

    m_special_code_only = config->read(String(SCIM_CONFIG_IMENGINE_ARRAY_SPECIAL_CODE_ONLY),
                    false);
}
Пример #15
0
retval_t ScimBridgeAgentImpl::initialize ()
{
    accept_listener = ScimBridgeAgentAcceptListener::alloc (this);
    if (accept_listener == NULL) return RETVAL_FAILED;
    clients.push_back (accept_listener);
    
    display = scim_bridge_alloc_display ();
    if (scim_bridge_display_fetch_current (display)) {
        scim_bridge_perrorln ("Failed to allocate the current display");
        return RETVAL_FAILED;
    }

    if (initialize_scim ()) {
        scim_bridge_perrorln ("Failed to initialize scim");
        return RETVAL_FAILED;
    }

    scim_bridge_pdebugln (4, "Loading configurations...");
    slot_reload_config (scim_config);
    scim_config->signal_connect_reload (slot (this, &ScimBridgeAgentImpl::slot_reload_config));

    interruption_listener = ScimBridgeAgentInterruptionListener::alloc ();
    if (interruption_listener == NULL) return RETVAL_FAILED;
    clients.push_back (interruption_listener);

    panel_listener = ScimBridgeAgentPanelListener::alloc (scim_config->get_name (), display, this);
    if (panel_listener == NULL) return RETVAL_FAILED;
    clients.push_back (panel_listener);

    signal_listener = ScimBridgeAgentSignalListener::alloc (this);
    if (signal_listener == NULL) return RETVAL_FAILED;
    clients.push_back (signal_listener);

    ScimBridgeAgentIMContext::static_initialize (panel_listener, scim_language, scim_backend);

    scim_bridge_pdebugln (4, "ScimBridgeAgent is now ready");
    return RETVAL_SUCCEEDED;
}
Пример #16
0
retval_t ScimBridgeAgentImpl::finalize_scim ()
{
    scim_bridge_pdebugln (6, "Finalizing scim...");
    
    scim_backend.reset ();
    scim_config.reset ();

    if (scim_config_module != NULL) {
        delete scim_config_module;
        scim_config_module = NULL;
    }

    return RETVAL_SUCCEEDED;
}
Пример #17
0
void
IMEngineHotkeyMatcher::load_hotkeys (const ConfigPointer &config)
{
    clear ();

    if (config.null () || !config->valid ()) return;

    std::vector <String> uuids;

    scim_split_string_list (uuids, config->read (String (SCIM_CONFIG_HOTKEYS_IMENGINE_LIST), String ("")));

    std::sort (uuids.begin (), uuids.end ());
    uuids.erase (std::unique (uuids.begin (), uuids.end ()), uuids.end ());

    if (uuids.size ()) {
        KeyEventList keys;
        for (std::vector <String>::iterator uit = uuids.begin (); uit != uuids.end (); ++uit) {
            if (scim_string_to_key_list (keys, config->read (String (SCIM_CONFIG_HOTKEYS_IMENGINE "/") + *uit, String ("")))) {
                m_impl->m_matcher.add_hotkeys (keys, (int) m_impl->m_uuids.size ());
                m_impl->m_uuids.push_back (*uit);
            }
        }
    }
}
Пример #18
0
/**
 * @brief Get keyboard ISE
 *
 * @param ise_uuid The keyboard ISE uuid.
 * @param ise_name The keyboard ISE name.
 */
void isf_get_keyboard_ise (String &ise_uuid, String &ise_name, const ConfigPointer &config)
{
    String language = String ("~other");
    String uuid     = config->read (String (SCIM_CONFIG_DEFAULT_IMENGINE_FACTORY) + String ("/") + language, String ("d75857a5-4148-4745-89e2-1da7ddaf7999"));
    if (ise_uuid.length () > 0)
        uuid = ise_uuid;
    for (unsigned int i = 0; i < _uuids.size (); i++) {
        if (uuid == _uuids[i]) {
            ise_name = _names[i];
            ise_uuid = uuid;
            return;
        }
    }
    ise_name = String ("");
    ise_uuid = String ("");
}
Пример #19
0
// implementation of Array
ArrayFactory::ArrayFactory (const ConfigPointer &config) 
    : m_status_property (SCIM_PROP_STATUS, "English/Chinese Input"),
      m_letter_property (SCIM_PROP_LETTER, "Full/Half Letter"),
      m_use_phrases(config->read(
                  String(SCIM_CONFIG_IMENGINE_ARRAY_USE_PHRASES), false))
{
    m_config = config;

    SCIM_DEBUG_IMENGINE(2) << "Start loading scim-array module\n";

    SCIM_DEBUG_IMENGINE(2) << "scim-array: start loading array30.cin from " << SCIM_ARRAY_MAIN_CIN_TABLE << "\n";
    arrayCins[0] = new ArrayCIN((char*)SCIM_ARRAY_MAIN_CIN_TABLE);

    SCIM_DEBUG_IMENGINE(2) << "scim-array: start loading array-shortcode.cin from " << SCIM_ARRAY_SHORT_CODE_CIN_TABLE << "\n";
    arrayCins[1] = new ArrayCIN((char*)SCIM_ARRAY_SHORT_CODE_CIN_TABLE);

    SCIM_DEBUG_IMENGINE(2) << "scim-array: start loading array-special.cin from " << SCIM_ARRAY_SPECIAL_CIN_TABLE << "\n";
    arrayCins[2] = new ArrayCIN((char*)SCIM_ARRAY_SPECIAL_CIN_TABLE, true);

    SCIM_DEBUG_IMENGINE(2) << "scim-array: start loading array-phrases.cin from " << SCIM_ARRAY_PHRASE_CIN_TABLE << "\n";
    if (m_use_phrases)
    {
        arrayCins[3] = new ArrayCIN((char*)SCIM_ARRAY_PHRASE_CIN_TABLE, false, false);
        load_user_phrases();
    }
    else
        arrayCins[3] = NULL;


    m_status_property.set_tip(_("The status of the current input method. Click to change it."));
    m_letter_property.set_tip(_("The input mode of the letters. Click to toggle between half and full."));

    reload_config(config);

    m_reload_signal_connection = m_config->signal_connect_reload(slot(this, &ArrayFactory::reload_config));
}
Пример #20
0
int main (int argc, char *argv [])
{
    BackEndPointer      backend;

    std::vector<String> engine_list;

    String config_name   ("simple");
    String frontend_name ("socket");

    int   new_argc = 0;
    char *new_argv [40];

    int i = 0;
    bool daemon = false;

    new_argv [new_argc ++] = argv [0];

    while (i<argc) {
        if (++i >= argc) break;

        if (String ("-f") == argv [i] ||
                String ("--frontend") == argv [i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv [i-1] << "\n";
                return -1;
            }
            frontend_name = argv [i];
            continue;
        }

        if (String ("-c") == argv [i] ||
                String ("--config") == argv [i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv [i-1] << "\n";
                return -1;
            }
            config_name = argv [i];
            continue;
        }

        if (String ("-d") == argv [i] ||
                String ("--daemon") == argv [i]) {
            daemon = true;
            continue;
        }

        if (String ("-e") == argv [i] ||
                String ("--engines") == argv [i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv [i-1] << "\n";
                return -1;
            }
            if (String (argv [i]) == "all") {
                scim_get_imengine_module_list (engine_list);
                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") {
                scim_split_string_list (engine_list, String (argv [i]), ',');
            }
            continue;
        }

        if (String ("-v") == argv [i] ||
                String ("--verbose") == argv [i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv [i-1] << "\n";
                return -1;
            }
            DebugOutput::set_verbose_level (atoi (argv [i]));
            continue;
        }

        if (String ("-m") == argv [i] ||
                String ("--mask") == argv [i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv [i-1] << "\n";
                return -1;
            }
            if (String (argv [i]) != "none") {
                std::vector<String> debug_mask_list;
                scim_split_string_list (debug_mask_list, argv [i], ',');
                DebugOutput::disable_debug (SCIM_DEBUG_AllMask);
                for (size_t j=0; j<debug_mask_list.size (); j++)
                    DebugOutput::enable_debug_by_name (debug_mask_list [j]);
            }
            continue;
        }

        if (String ("-o") == argv [i] ||
                String ("--output") == argv [i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv [i-1] << "\n";
                return -1;
            }
            DebugOutput::set_output (String (argv [i]));
            continue;
        }

        if (String ("--") == argv [i])
            break;

        new_argv [new_argc ++] = argv [i];
    } //End of command line parsing.

    // Construct new argv array for FrontEnd.
    new_argv [new_argc ++] = const_cast <char *> ("-c");
    new_argv [new_argc ++] = const_cast <char *> (config_name.c_str ());

    // Store the rest argvs into new_argv.
    for (++i; i < argc && new_argc < 40; ++i) {
        new_argv [new_argc ++] = argv [i];
    }

    new_argv [new_argc] = 0;

    try {
        // Try to load config module
        std::cerr << "Loading " << config_name << " Config module ...\n";
        if (config_name != "dummy") {
            //load config module
            config_module = new ConfigModule (config_name);

            if (!config_module->valid ()) {
                std::cerr << "Can not load " << config_name << " Config module. Using dummy module instead.\n";
                delete config_module;
                config_module = 0;
            }

        }

        if (config_module) {
            config = config_module->create_config ();
        } else {
            config = new DummyConfig ();
        }

        if (config.null ()) {
            std::cerr << "Can not create Config Object!\n";
            return 1;
        }

        // create backend
        std::cerr << "Creating backend ...\n";
        backend = new CommonBackEnd (config, engine_list);

        //load FrontEnd module
        std::cerr << "Loading " << frontend_name << " FrontEnd module ...\n";
        frontend_module = new FrontEndModule (frontend_name, backend, config, new_argc, new_argv);

        if (!frontend_module || !frontend_module->valid ()) {
            std::cerr << "Failed to load " << frontend_name << " FrontEnd module.\n";
            return 1;
        }

        //reset backend pointer, in order to destroy backend automatically.
        backend.reset ();

        signal(SIGQUIT, signalhandler);
        signal(SIGTERM, signalhandler);
        signal(SIGINT,  signalhandler);
        signal(SIGHUP,  signalhandler);

        if (daemon) {
            std::cerr << "Starting SCIM as daemon ...\n";
            scim_daemon ();
        } else {
            std::cerr << "Starting SCIM ...\n";
        }

        frontend_module->run ();
    } catch (const std::exception & err) {
        std::cerr << err.what () << "\n";
        return 1;
    }

    return 0;
}
Пример #21
0
 void scim_module_exit (void)
 {
     _scim_test_factory.reset ();
     _scim_config.reset ();
 }
Пример #22
0
void ScimBridgeAgentImpl::save_config ()
{
    scim_bridge_pdebugln (6, "save_config ()");

    scim_config->write (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), ScimBridgeAgentIMContext::is_enabled_by_default ());
}
Пример #23
0
int main(int argc, char* argv[])
{
    String config_name("simple");
    String display_name;
    bool daemon = false;
    bool should_resident = true;

    //parse command options
    int i = 1;
    while (i < argc) {
        if (String("-l") == argv[i] || String("--list") == argv[i]) {
            std::cout << "\n";
            std::cout << "Available Config module:\n";
            // get config module list
            std::vector<String> config_list;
            scim_get_config_module_list(config_list);
            config_list.push_back("dummy");
            std::vector<String>::iterator it = config_list.begin();
            for (; it != config_list.end(); ++it) {
                std::cout << "    " << *it << "\n";
            }
            return 0;
        }
        else if (String("-c") == argv[i] || String("--config") == argv[i]) {
            if (++i >= argc) {
                std::cerr << "no argument for option " << argv[i-1] << "\n";
                return -1;
            }
            config_name = argv[i];
        }
        else if (String("-h") == argv[i] || String("--help") == argv[i]) {
            std::cout << "Usage: " << argv [0] << " [option]...\n\n"
                      << "The options are: \n"
                      << "  --display DISPLAY    Run on display DISPLAY.\n"
                      << "  -l, --list           List all of available config modules.\n"
                      << "  -c, --config NAME    Uses specified Config module.\n"
                      << "  -d, --daemon         Run " << argv [0] << " as a daemon.\n"
                      << "  -ns, --no-stay       Quit if no connected client.\n"
                      << "  -h, --help           Show this help message.\n";
            return 0;
        }
        else if (String("-d") == argv[i] || String("--daemon") == argv[i]) {
            daemon = true;
        }
        else if (String("-ns") == argv[i] || String("--no-stay") == argv[i]) {
            should_resident = false;
        }
        else if (String("--display") == argv[i]) {
            if (++i >= argc) {
                std::cerr << "No argument for option " << argv[i-1] << "\n";
                return -1;
            }
            display_name = argv[i];
        }
        else {
            std::cerr << "Invalid command line option: " << argv[i] << "\n";
            return -1;
        }
        ++i;
    }

    // Make up DISPLAY env.
    if (display_name.length()) {
        setenv("DISPLAY", display_name.c_str(), 1);
    }

    if (config_name == "dummy") {
        _config = new DummyConfig();
    }
    else {
        _config_module = new ConfigModule(config_name);
        if (!_config_module || !_config_module->valid()) {
            std::cerr << "Can not load " << config_name << " Config module.\n";
            return -1;
        }
        _config = _config_module->create_config();
    }

    if (_config.null()) {
        std::cerr << "Failed to create instance from " << config_name << " Config module.\n";
        return -1;
    }


    signal(SIGTERM, niam);
    signal(SIGINT, niam);

    if (!initialize_panel_agent(config_name, display_name, should_resident)) {
        std::cerr << "Failed to initialize PanelAgent.\n";
        return -1;
    }

    if (daemon)
        scim_daemon();

    if (!run_panel_agent()) {
        std::cerr << "Failed to run Socket Server!\n";
        return -1;
    }

    start_auto_start_helpers();

    DBus::default_dispatcher = &dispatcher;

    DBus::Connection conn = DBus::Connection::SessionBus();
    conn.request_name("org.kde.impanel.inputmethod");

    panel = new Panel(conn);

    /// add initial helper as helper property
    PropertyList props;
    std::vector<HelperInfo>::const_iterator it = _helper_list.begin();
    std::vector<HelperInfo>::const_iterator end = _helper_list.end();
    while (it != end) {
        if ((it->option & SCIM_HELPER_STAND_ALONE)
                && !(it->option & SCIM_HELPER_AUTO_START)) {
            props.push_back(Property(String(helper_prop_prefix) + it->uuid,
                                     it->name,
                                     it->icon,
                                     it->description));
        }
        ++it;
    }
    if (props.size()) {
        helper_props_map[0] = props;
    }

    dispatcher.enter();

    delete panel;

    return 0;
}
Пример #24
0
 void scim_module_exit (void)
 {
     _scim_pinyin_factory.reset ();
     _scim_config.reset ();
 }
Пример #25
0
void ScimConsoleImpl::slot_reload_config (const ConfigPointer &config)
{
    scim_frontend_hotkey_matcher.load_hotkeys (scim_config);
    scim_imengine_hotkey_matcher.load_hotkeys (scim_config);

    panel_hotkey_matcher.clear ();
    vector<String> strings;
    KeyEventList hotkeys;

    hotkeys.clear ();
    if (config->read ("/FrontEnd/Console/Hotkeys/Menu", &strings)) {
        for (vector<String>::iterator i = strings.begin (); i != strings.end (); ++i) {
            const String &string = *i;
            KeyEventList keys;
            if (scim_string_to_key_list (keys, string)) {
                for (KeyEventList::iterator j = keys.begin (); j != keys.end (); ++j) {
                    KeyEvent &key = *j;
                    hotkeys.push_back (key);
                }
            }
        }
    }
    if (hotkeys.empty ()) {
        hotkeys.push_back (KeyEvent (SCIM_KEY_F2));
        hotkeys.push_back (KeyEvent (SCIM_KEY_Menu));
    }
    panel_hotkey_matcher.add_hotkeys (hotkeys, PANEL_HOTKEY_MENU);

    hotkeys.clear ();
    if (config->read ("/FrontEnd/Console/Hotkeys/Cancel", &strings)) {
        for (vector<String>::iterator i = strings.begin (); i != strings.end (); ++i) {
            const String &string = *i;
            KeyEventList keys;
            if (scim_string_to_key_list (keys, string)) {
                for (KeyEventList::iterator j = keys.begin (); j != keys.end (); ++j) {
                    KeyEvent &key = *j;
                    hotkeys.push_back (key);
                }
            }
        }
    }
    if (hotkeys.empty ()) {
        hotkeys.push_back (KeyEvent (SCIM_KEY_Escape));
        hotkeys.push_back (KeyEvent (SCIM_KEY_BackSpace));
        hotkeys.push_back (KeyEvent (SCIM_KEY_Delete));
    }
    panel_hotkey_matcher.add_hotkeys (hotkeys, PANEL_HOTKEY_CANCEL);

    hotkeys.clear ();
    if (config->read ("/FrontEnd/Console/Hotkeys/OK", &strings)) {
        for (vector<String>::iterator i = strings.begin (); i != strings.end (); ++i) {
            const String &string = *i;
            KeyEventList keys;
            if (scim_string_to_key_list (keys, string)) {
                for (KeyEventList::iterator j = keys.begin (); j != keys.end (); ++j) {
                    KeyEvent &key = *j;
                    hotkeys.push_back (key);
                }
            }
        }
    }
    if (hotkeys.empty ()) {
        hotkeys.push_back (KeyEvent (SCIM_KEY_Return));
        hotkeys.push_back (KeyEvent (SCIM_KEY_space));
    }
    panel_hotkey_matcher.add_hotkeys (hotkeys, PANEL_HOTKEY_OK);

    hotkeys.clear ();
    if (config->read ("/FrontEnd/Console/Hotkeys/Previous", &strings)) {
        for (vector<String>::iterator i = strings.begin (); i != strings.end (); ++i) {
            const String &string = *i;
            KeyEventList keys;
            if (scim_string_to_key_list (keys, string)) {
                for (KeyEventList::iterator j = keys.begin (); j != keys.end (); ++j) {
                    KeyEvent &key = *j;
                    hotkeys.push_back (key);
                }
            }
        }
    }
    if (hotkeys.empty ()) {
        hotkeys.push_back (KeyEvent (SCIM_KEY_Left));
        hotkeys.push_back (KeyEvent (SCIM_KEY_Up));
    }
    panel_hotkey_matcher.add_hotkeys (hotkeys, PANEL_HOTKEY_PREVIOUS);
    
    hotkeys.clear ();
    if (config->read ("/FrontEnd/Console/Hotkeys/Next", &strings)) {
        for (vector<String>::iterator i = strings.begin (); i != strings.end (); ++i) {
            const String &string = *i;
            KeyEventList keys;
            if (scim_string_to_key_list (keys, string)) {
                for (KeyEventList::iterator j = keys.begin (); j != keys.end (); ++j) {
                    KeyEvent &key = *j;
                    hotkeys.push_back (key);
                }
            }
        }
    }
    if (hotkeys.empty ()) {
        hotkeys.push_back (KeyEvent (SCIM_KEY_Right));
        hotkeys.push_back (KeyEvent (SCIM_KEY_Down));
    }
    panel_hotkey_matcher.add_hotkeys (hotkeys, PANEL_HOTKEY_NEXT);

    // Get keyboard layout setting
    // Flush the global config first, in order to load the new configs from disk.
    scim_global_config_flush ();

    scim_keyboard_layout = scim_get_default_keyboard_layout ();
}
Пример #26
0
 virtual void ReloadConfig() {
     panel_agent->reload_config();
     if (!_config.null())
         _config->reload();
 }
Пример #27
0
static void slot_reload_config(void)
{
    std::cerr << "slot_reload_config\n";
    _config->reload();
}
    void
save_config (const ConfigPointer &config)
{
    if (!config.null ()) {
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_AUTO_SNAP),
                __config_toolbar_auto_snap);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_HIDE_TIMEOUT),
                __config_toolbar_hide_timeout);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_SHOW_FACTORY_ICON),
                __config_toolbar_show_factory_icon);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_SHOW_FACTORY_NAME),
                __config_toolbar_show_factory_name);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_SHOW_MENU_ICON),
                __config_toolbar_show_menu_icon);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_SHOW_HELP_ICON),
                __config_toolbar_show_help_icon);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_TOOLBAR_SHOW_PROPERTY_LABEL),
                __config_toolbar_show_property_label);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_FONT),
                __config_font);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_VKB_PROGRAM),
                __config_vkb_program);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_VKB_PARAMETERS),
                __config_vkb_parameters);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_VKB_WIDTH),
                __config_vkb_window_width);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_VKB_HEIGHT),
                __config_vkb_window_height);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_DOCK_PANEL),
                __config_vkb_dockpanel);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_PANEL_EXTEND),
                __config_vkb_panel_extend);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_ENABLE_VKB),
                __config_vkb_enable);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_PANEL_NORMAL_TEXT_COLOR),
                __config_vkb_panel_normal_text_color);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_PANEL_NORMAL_BG_COLOR),
                __config_vkb_panel_normal_bg_color);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_PANEL_ACTIVE_TEXT_COLOR),
                __config_vkb_panel_active_text_color);
        config->write (String (SCIM_CONFIG_PANEL_VKB_GTK_PANEL_ACTIVE_BG_COLOR),
                __config_vkb_panel_active_bg_color);

        __have_changed = false;
    }
}
Пример #29
0
static void
save_config (const ConfigPointer &config)
{
    if (!config.null ()) {
    //    config->write (String (SCIM_CONFIG_IMENGINE_ANTHY_USE_KANA),
    //                    __config_use_kana);
        config->write (String (SCIM_CONFIG_WNN_SERVER),
                       __config_server);
        config->write (String (SCIM_CONFIG_WNN_RC),
                       __config_wnn_rc);
        config->write (String (SCIM_CONFIG_WNN_SERVERTYPE),
                       __config_servertype);
        config->write (String (SCIM_CONFIG_WNN_DEFAULT_PREEDITOR),
                       __config_preeditor);
        config->write (String (SCIM_CONFIG_WNN_ALP),
                       __config_alp);
        config->write (String (SCIM_CONFIG_WNN_NUMKEY_SELECT),
                       __config_numkeyselect);
        config->write (String (SCIM_CONFIG_WNN_AUTO_CONVERSION),
                       __config_autoconversion);
        config->write (String (SCIM_CONFIG_WNN_YOSOKU),
                       __config_yosoku);
        config->write (String (SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE),
                       __config_romkan_table);

        for (unsigned j = 0; j < __key_conf_pages_num; j++) {
            for (unsigned int i = 0; __key_conf_pages[j].data[i].key; ++ i) {
                config->write (String (__key_conf_pages[j].data[i].key),
                               __key_conf_pages[j].data[i].data);
            }
        }

        __have_changed = false;
    }
}
Пример #30
0
static Evas_Object *isf_setting_main_view_tizen(ug_data * ugd)
{
   String tmpStr = _config->read(SCIM_CONFIG_DEFAULT_HELPER_ISE,String("b70bf6cc-ff77-47dc-a137-60acc32d1e0c"));
   snprintf (_active_ise_name, sizeof (_active_ise_name), "%s", (uuid_to_name(tmpStr)).c_str());
   snprintf (ise_bak, sizeof (ise_bak), "%s", _active_ise_name);
   LOGD("Default ISE Name : %s", ise_bak);

    ugd->naviframe = _create_naviframe_layout (ugd->layout_main);
    char *navi_btn_l_lable = NULL;
    char *navi_btn_r_lable = NULL;
    service_get_extra_data(ugd->data, "navi_btn_left",&navi_btn_l_lable);
    service_get_extra_data(ugd->data, "navi_btn_right",&navi_btn_r_lable);
    if (sw_radio_grp != NULL)
    {
        evas_object_del(sw_radio_grp);
        sw_radio_grp = NULL;
    }

    Evas_Object *genlist = elm_genlist_add(ugd->naviframe);
    elm_object_style_set(genlist, "dialogue");
    evas_object_show(genlist);

    Elm_Object_Item *nf_it;
    Evas_Object *cbar = elm_toolbar_add (ugd->naviframe);
    elm_toolbar_shrink_mode_set(cbar, ELM_TOOLBAR_SHRINK_EXPAND);
    if (cbar == NULL) return NULL;

    if (navi_btn_l_lable!= NULL) {
        elm_toolbar_item_append(cbar, NULL, navi_btn_l_lable, sw_keyboard_selection_view_back_cb, ugd);
        elm_toolbar_item_append(cbar, NULL, navi_btn_r_lable, sw_keyboard_selection_view_set_cb, ugd);

        nf_it = elm_naviframe_item_push(ugd->naviframe, T_("Keyboard"), NULL, NULL, genlist, NULL);
        elm_object_item_part_content_set(nf_it, "controlbar", cbar);
    }
    else {
        elm_toolbar_item_append(cbar, NULL, navi_btn_r_lable, sw_keyboard_selection_view_set_cb, ugd);
        nf_it = elm_naviframe_item_push(ugd->naviframe, T_("Keyboard"), NULL, NULL, genlist, NULL);
        elm_object_item_part_content_set(nf_it, "controlbar", cbar);
    }

    if (navi_btn_l_lable!= NULL)
        free(navi_btn_l_lable);
    if (navi_btn_r_lable!= NULL)
        free(navi_btn_r_lable);
    unsigned int i = 0;

    sw_iselist.clear();
    std::vector<String> selected_langs, all_langs;

    isf_get_all_languages (all_langs);
    isf_get_helper_names_in_languages (all_langs, sw_iselist);
    std::sort (sw_iselist.begin (), sw_iselist.end ());

    if (sw_iselist.size () > 0) {
        // Set item class for dialogue group seperator
        itcSeparator.item_style = "dialogue/separator/21/with_line";
        itcSeparator.func.text_get = NULL;
        itcSeparator.func.content_get = NULL;
        itcSeparator.func.state_get = NULL;
        itcSeparator.func.del = NULL;

        //separator
        Elm_Object_Item *item;
        item = elm_genlist_item_append(
                    genlist,                // genlist object
                    &itcSeparator,          // item class
                    NULL,                   // data
                    NULL,
                    ELM_GENLIST_ITEM_NONE,
                    NULL,
                    NULL);
        elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
    }

    for (i = 0; i < sw_iselist.size (); i++) {
        if (strcmp (_active_ise_name, sw_iselist[i].c_str ()) == 0) {
            mark = i;
            break;
        }
    }

    //set item class for 1text.1icon(text+radiobutton)
    itc1.item_style = "dialogue/1text.1icon.2";
    itc1.func.text_get = _gl_label_get;
    itc1.func.content_get = _gl_icon_get;
    itc1.func.state_get = _gl_state_get;
    itc1.func.del = _gl_del;
    for (i = 0;i < sw_iselist.size();i++) {
        elm_genlist_item_append(genlist, &itc1,
                    (void *)(i), NULL, ELM_GENLIST_ITEM_NONE, _gl_sel,
                    (void *)(i));
    }

    return ugd->naviframe;
}