src/languages.cpp
src/ise-language-change.cpp
src/config.cpp
- src/option.cpp
src/imdata.cpp
src/ise-stt-mode.cpp
src/ise-stt-option.cpp
src/sdk/ise_lang_table.cpp
src/sdk/cji.cpp
src/sdk/sdk.cpp
- src/sdk/sdk_option.cpp
src/candidate/candidate-factory.cpp
src/candidate/candidate.cpp
src/candidate/efl/candidate-efl.cpp
src/w-input-smartreply.cpp
)
+SET(ISE_SETTING_SRCS
+ src/config.cpp
+ src/option.cpp
+ src/sdk/sdk_option.cpp
+ src/eflutil.cpp
+ src/languages.cpp
+ src/sdk/ise_lang_table.cpp
+)
+
SET(ISE_PACKAGE ${PROJECT_NAME})
SET(ISE_PKGNAME ${PACKAGE})
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+SET(SETTING_PKGS_CHECK_MODULES
+ elementary
+ efl-extension
+ dlog
+ vconf
+ libxml-2.0
+ capi-appfw-application
+ capi-appfw-preference
+ )
+
+pkg_check_modules(ISE_SETTING_PKGS REQUIRED ${SETTING_PKGS_CHECK_MODULES})
+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIE -Wall")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -finstrument-functions")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+ADD_DEFINITIONS("-DEXPORTED=__attribute__((visibility(\"default\")))")
ADD_DEFINITIONS("-DPACKAGE=\"${ISE_PACKAGE}\"")
ADD_DEFINITIONS("-DPACKAGE_NAME=\"${ISE_PKGNAME}\"")
ADD_DEFINITIONS("-DRESDIR=\"${ISE_RESDIR}\"")
ADD_EXECUTABLE(${PROJECT_NAME} ${ISE_SRCS})
+ADD_EXECUTABLE(${PROJECT_NAME}-setting ${ISE_SETTING_SRCS})
+
# For edc File
ADD_CUSTOM_TARGET(
candidate-single.edj
# For edc File end
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ISE_PKGS_LDFLAGS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME}-setting ${ISE_SETTING_PKGS_LDFLAGS})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${ISE_BINDIR})
+INSTALL(TARGETS ${PROJECT_NAME}-setting DESTINATION ${ISE_BINDIR})
INSTALL(FILES ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.xml DESTINATION
${TZ_SYS_RO_PACKAGES})
<description/>
<label>Tizen keyboard</label>
<icon/>
-<ui-application appid="ise-default" exec="ise-default" nodisplay="true" taskmanage="false" multiple="false" type="capp" hw-acceleration="use-system-setting" mainapp="true">
+<ui-application appid="ise-default" exec="ise-default" nodisplay="true" taskmanage="false" multiple="false" type="capp" hw-acceleration="use-system-setting">
<category name="http://tizen.org/category/ime"/>
<label>Tizen keyboard</label>
<label xml:lang="ar-ae">لوحة مفاتيح Tizen</label>
<label xml:lang="zh-tw">Tizen 鍵盤</label>
<icon/>
</ui-application>
+<ui-application appid="org.tizen.ise-default-setting" exec="ise-default-setting" launch_mode="single" mainapp="true" nodisplay="true" taskmanage="false" multiple="true" type="capp" hw-acceleration="use-system-setting">
+ <category name="http://tizen.org/category/ime-setting"/>
+ <label>Tizen keyboard setting</label>
+ <icon/>
+</ui-application>
<privileges>
<privilege>http://tizen.org/privilege/ime</privilege>
<privilege>http://tizen.org/privilege/recorder</privilege>
<privilege>http://tizen.org/privilege/haptic</privilege>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
</privileges>
</manifest>
}
}
-void read_ise_config_values()
+void read_ise_config_int(const char *key, sclint &config_variable, sclint default_value)
{
- sclint integer_value = 0;
- std::string string_value;
+ sclint integer_value = default_value;
+ preference_get_int(key, &integer_value);
+ config_variable = integer_value;
+}
- /* keypad mode */
- integer_value = KEYPAD_MODE_QTY;
- preference_get_int(ISE_CONFIG_KEYPAD_MODE, &integer_value);
- g_config_values.keypad_mode = static_cast<KEYPAD_MODE>(integer_value);
+void read_ise_config_bool(const char *key, sclboolean &config_variable, sclint default_value)
+{
+ sclint value = default_value;
+ preference_get_int(key, &value);
+ config_variable = value;
+}
- /* prediction */
- integer_value = 0;
- preference_get_int(ISE_CONFIG_PREDICTION_ON, &integer_value);
- g_config_values.prediction_on = integer_value;
+void read_ise_keypad_mode()
+{
+ int value;
+ read_ise_config_int(ISE_CONFIG_KEYPAD_MODE, value, KEYPAD_MODE_QTY);
+ g_config_values.keypad_mode = static_cast<KEYPAD_MODE>(value);
+}
- /* enabled languages */
+void read_ise_prediction_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_PREDICTION_ON, g_config_values.prediction_on, false);
+}
+
+void read_ise_autocapital_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_AUTO_CAPITALISE, g_config_values.auto_capitalise, false);
+}
+
+void read_ise_enabled_languages()
+{
+ std::string string_value;
string_value = "";
+
read_ise_config_string(ISE_CONFIG_ENABLED_LANGUAGES, string_value);
if (string_value.length() > 0) {
std::stringstream ss(string_value);
g_config_values.enabled_languages = vstrings;
}
- /* Selected languages */
+#ifdef _TV
+ g_config_values.enabled_languages.push_back("English");
+ g_config_values.enabled_languages.push_back("Korean");
+#endif
+}
+
+void read_ise_selected_language()
+{
+ std::string string_value;
string_value = "";
+
read_ise_config_string(ISE_CONFIG_SELECTED_LANGUAGE, string_value);
if (string_value.length() > 0) {
g_config_values.selected_language = string_value;
}
+#ifdef _TV
+ g_config_values.selected_language = std::string("English");
+#endif
+}
+
+void read_ise_autopunctuation_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_AUTO_PUNCTUATE, g_config_values.auto_punctuate, AUTOPUNCTUATE_ON);
+}
+
+void read_ise_sound_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_SOUND_ON, g_config_values.sound_on, SOUND_ON);
+}
+
+void read_ise_vibration_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_VIBRATION_ON, g_config_values.vibration_on, VIBRATION_ON);
+}
+
+void read_ise_character_preview_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_PREVIEW_ON, g_config_values.preview_on, PREVIEW_ON);
+}
+
+void read_ise_setting_guide_popup_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_SETTING, g_config_values.first_guideset, false);
+}
+
+void read_ise_language_guide_popup_mode()
+{
+ read_ise_config_bool(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_LANGUAGE_CHANGE, g_config_values.first_guidechange, false);
+}
+
+void read_ise_config_values()
+{
+ /* keypad mode */
+ read_ise_keypad_mode();
+
+ /* prediction */
+ read_ise_prediction_mode();
+
+ /* enabled languages */
+ read_ise_enabled_languages();
+
+ /* Selected languages */
+ read_ise_selected_language();
+
/* Auto capital */
- integer_value = 1;
- preference_get_int(ISE_CONFIG_AUTO_CAPITALISE, &integer_value);
- g_config_values.auto_capitalise = integer_value;
+ read_ise_autocapital_mode();
/* auto punctuation */
- integer_value = AUTOPUNCTUATE_ON;
- preference_get_int(ISE_CONFIG_AUTO_PUNCTUATE, &integer_value);
- g_config_values.auto_punctuate = integer_value;
+ read_ise_autopunctuation_mode();
/* Sound */
- integer_value = SOUND_ON;
- preference_get_int(ISE_CONFIG_SOUND_ON, &integer_value);
- g_config_values.sound_on = integer_value;
+ read_ise_sound_mode();
/* Vibration */
- integer_value = VIBRATION_ON;
- preference_get_int(ISE_CONFIG_VIBRATION_ON, &integer_value);
- g_config_values.vibration_on = integer_value;
+ read_ise_vibration_mode();
/* character preview */
- integer_value = PREVIEW_ON;
- preference_get_int(ISE_CONFIG_PREVIEW_ON, &integer_value);
- g_config_values.preview_on = integer_value;
+ read_ise_character_preview_mode();
/* guide popup for setting */
- integer_value = 0;
- preference_get_int(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_SETTING, &integer_value);
- g_config_values.first_guideset = integer_value;
+ read_ise_setting_guide_popup_mode();
/* guide popup for language change */
- integer_value = 0;
- preference_get_int(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_LANGUAGE_CHANGE, &integer_value);
- g_config_values.first_guidechange = integer_value;
-#ifdef _TV
- g_config_values.enabled_languages.push_back("English");
- g_config_values.enabled_languages.push_back("Korean");
- g_config_values.selected_language = std::string("English");
-#endif
+ read_ise_language_guide_popup_mode();
}
void write_ise_config_values()
void
read_ise_config_values();
+void
+read_ise_keypad_mode();
+
+void
+read_ise_prediction_mode();
+
+void
+read_ise_autocapital_mode();
+
+void
+read_ise_enabled_languages();
+
+void
+read_ise_selected_language();
+
+void
+read_ise_autopunctuation_mode();
+
+void
+read_ise_sound_mode();
+
+void
+read_ise_vibration_mode();
+
+void
+read_ise_character_preview_mode();
+
+void
+read_ise_setting_guide_popup_mode();
+
+void
+read_ise_language_guide_popup_mode();
+
/**
* Writes all option values to SCIM config file
@return Nothing.
bool
option_window_is_available(SCLOptionWindowType type);
-void
-read_options(Evas_Object *naviframe);
-
-void
-write_options();
-
#endif
#include <sclutils.h>
#include <inputmethod.h>
#include <inputmethod_internal.h>
+#include <app_control.h>
+#include <app_preference.h>
#ifdef HAVE_CBHM
#include <cbhm.h>
#endif
#include "w-input-smartreply.h"
#define EDJ_FILE RESDIR"/edje/mobile/customised_ctxpopup.edj"
-#define EXPORTED __attribute__((visibility("default")))
#define CANDIDATE_WINDOW_HEIGHT 84
using namespace scl;
return SCL_EVENT_PASS_ON;
}
+static void launch_option()
+{
+ app_control_h app_control;
+ int ret = app_control_create(&app_control);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOGW("app_control_create returned %d\n", ret);
+ return;
+ }
+
+ ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOGW("app_control_set_operation returned %d\n", ret);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(app_control, "org.tizen.ise-default-setting");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOGW("app_control_set_app_id returned %d\n", ret);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request(app_control, NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ goto end;
+ }
+
+end:
+ if (app_control)
+ app_control_destroy(app_control);
+}
+
SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_desc)
{
SCLEventReturnType ret = SCL_EVENT_PASS_ON;
g_ui->set_input_mode("STT_3X4");
} else if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
- if (!option_window_is_available(OPTION_WINDOW_TYPE_NORMAL))
- ime_create_option_window();
+ launch_option();
+
ret = SCL_EVENT_DONE;
} else if (strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
show_cbhm();
case KEY_TYPE_USER:
if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
//open_option_window(NULL, ROTATION_TO_DEGREE(g_ui->get_rotation()));
- if (!option_window_is_available(OPTION_WINDOW_TYPE_NORMAL))
- ime_create_option_window();
+ launch_option();
+
ret = SCL_EVENT_DONE;
} else if (strcmp(event_desc.key_value, USER_KEYSTRING_CLIPBOARD) == 0) {
show_cbhm();
#endif
}
+static void ise_keypad_mode_changed_cb(const char *key, void *user_data)
+{
+ read_ise_keypad_mode();
+}
+
+static void ise_enabled_languages_changed_cb(const char *key, void *user_data)
+{
+ read_ise_enabled_languages();
+}
+
+static void ise_selected_language_changed_cb(const char *key, void *user_data)
+{
+ read_ise_selected_language();
+}
+
+static void ise_autocapital_mode_changed_cb(const char *key, void *user_data)
+{
+ read_ise_autocapital_mode();
+}
+
+static void ise_autopuncutate_mode_changed_cb(const char *key, void *user_data)
+{
+ read_ise_autopunctuation_mode();
+}
+
+static void ise_sound_mode_changed_cb(const char *key, void *user_data)
+{
+ read_ise_sound_mode();
+
+ g_ui->enable_sound(g_config_values.sound_on);
+}
+
+static void ise_vibration_mode_changed_cb(const char *key, void *user_data)
+{
+ read_ise_vibration_mode();
+
+ g_ui->enable_vibration(g_config_values.vibration_on);
+}
+
+static void ise_character_preview_mode_changed_cb(const char *key, void *user_data)
+{
+ read_ise_character_preview_mode();
+
+ g_ui->enable_magnifier(g_config_values.preview_on);
+}
+
+static void ise_setting_guide_popup_changed_cb(const char *key, void *user_data)
+{
+ read_ise_setting_guide_popup_mode();
+}
+
+static void ise_language_guide_popup_changed_cb(const char *key, void *user_data)
+{
+ read_ise_language_guide_popup_mode();
+}
+
void
ise_create()
{
size_landscape.height += g_candidate->get_height();
}
ime_set_size(size_portrait.width, size_portrait.height, size_landscape.width, size_landscape.height);
+
+ preference_set_changed_cb(ISE_CONFIG_KEYPAD_MODE, ise_keypad_mode_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_ENABLED_LANGUAGES, ise_enabled_languages_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_SELECTED_LANGUAGE, ise_selected_language_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_AUTO_CAPITALISE, ise_autocapital_mode_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_AUTO_PUNCTUATE, ise_autopuncutate_mode_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_SOUND_ON, ise_sound_mode_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_VIBRATION_ON, ise_vibration_mode_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_PREVIEW_ON, ise_character_preview_mode_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_SETTING, ise_setting_guide_popup_changed_cb, NULL);
+ preference_set_changed_cb(ISE_CONFIG_FIRST_GUIDELINE_POPUP_FOR_LANGUAGE_CHANGE, ise_language_guide_popup_changed_cb, NULL);
}
init_recent_used_punctuation();
}
ise_show(g_keyboard_state.ic);
}
-static void ime_app_option_window_created_cb(Evas_Object *window, ime_option_window_type_e type, void *user_data)
-{
- if (window) {
- option_window_created(window, (SCLOptionWindowType)type);
- }
-}
-
-static void ime_app_option_window_destroyed_cb(Evas_Object *window, void *user_data)
-{
- option_window_destroyed(window);
-}
-
static void ime_app_rotation_degree_changed_cb(int degree, void *user_data)
{
ise_set_screen_rotation(degree);
ime_event_set_imdata_set_cb(ime_app_imdata_set_cb, NULL);
ime_event_set_process_key_event_cb(ime_app_process_key_event_cb, NULL);
- ime_event_set_option_window_created_cb(ime_app_option_window_created_cb, NULL);
- ime_event_set_option_window_destroyed_cb(ime_app_option_window_destroyed_cb, NULL);
-
ime_event_set_candidate_show_cb(ime_app_candidate_show_cb, NULL);
ime_event_set_candidate_hide_cb(ime_app_candidate_hide_cb, NULL);
ime_event_set_lookup_table_changed_cb(ime_app_lookup_table_changed_cb, NULL);
*/
#include <string.h>
-#include <sclcommon.h>
#include <vconf.h>
#include <vconf-keys.h>
-#include <glib.h>
#include <Elementary.h>
#include <efl_extension.h>
-#include <inputmethod.h>
+#include <app.h>
#include "utils.h"
#include "option.h"
#include "languages.h"
#include "eflutil.h"
+#include "sdk/ise_lang_table.h"
#undef LOG_TAG
#define LOG_TAG "ISE_DEFAULT"
#define ICON_DIR LAYOUTDIR"/wearable/image"
#endif
-using namespace scl;
-
-
static ISELanguageManager _language_manager;
#define OPTION_MAX_LANGUAGES 255
static OPTION_ELEMENTS option_elements[OPTION_WINDOW_TYPE_MAX];
extern CONFIG_VALUES g_config_values;
-extern CSCLUI *g_ui;
static Evas_Object* create_option_language_view(Evas_Object *naviframe);
static Evas_Object *_create_check_button(Evas_Object *parent, sclboolean state);
+static void read_options(Evas_Object *naviframe);
+
#ifdef _WEARABLE
static Evas_Object* create_smart_typing_view(Evas_Object *naviframe);
static Evas_Object* create_feedback_view(Evas_Object *naviframe);
read_options(option_elements[type].naviframe);
}
- g_ui->enable_sound(g_config_values.sound_on);
- g_ui->enable_vibration(g_config_values.vibration_on);
- g_ui->enable_magnifier(g_config_values.preview_on);
vconf_set_bool(VCONFKEY_AUTOCAPITAL_ALLOW_BOOL, g_config_values.auto_capitalise);
vconf_set_bool(VCONFKEY_AUTOPERIOD_ALLOW_BOOL, g_config_values.auto_punctuate);
}
g_config_values.sound_on = state;
write_ise_config_values();
- g_ui->enable_sound(state);
}
static void check_vibration_change_callback(void *data, Evas_Object *obj, void *event_info)
}
g_config_values.vibration_on = state;
write_ise_config_values();
- g_ui->enable_vibration(state);
}
static void check_character_pre_change_callback(void *data, Evas_Object *obj, void *event_info)
}
g_config_values.preview_on = state;
write_ise_config_values();
- g_ui->enable_magnifier(state);
}
static Evas_Object *_create_check_button(Evas_Object *parent, sclboolean state)
{
destroy_genlist_item_classes(type);
if (CHECK_ARRAY_INDEX(type, OPTION_WINDOW_TYPE_MAX)) {
- if (option_elements[type].option_window)
- ime_destroy_option_window(option_elements[type].option_window);
-
option_elements[type].option_window = NULL;
+
+ ui_app_exit();
}
}
}
#endif
-void read_options(Evas_Object *naviframe)
+static void read_options(Evas_Object *naviframe)
{
SCLOptionWindowType type = find_option_window_type(naviframe);
}
}
-void write_options()
-{
- language_selection_finished_cb(NULL, NULL, NULL);
-}
-
static void set_option_values()
{
}
if (window == NULL) return;
if (!CHECK_ARRAY_INDEX(type, OPTION_WINDOW_TYPE_MAX)) return;
+ sclint loop;
+
+ ISE_LANG_TABLE *table = NULL;
+ ISELangTableMgr *lang_table_mgr = ISELangTableMgr::get_instance();
+ if (lang_table_mgr) table = lang_table_mgr->get_lang_table();
+
+ if (lang_table_mgr && table) {
+ for (loop = 0;loop < lang_table_mgr->get_lang_table_size();loop++) {
+ INPUT_MODE_INFO input_mode_QTY;
+ input_mode_QTY.name = table[loop].inputmode_QTY;
+ input_mode_QTY.display_name = table[loop].inputmode_QTY_name;
+ LANGUAGE_INFO language;
+ language.name = table[loop].language;
+ language.display_name = table[loop].language_name;
+ if (table[loop].locale_string) {
+ language.locale_string = table[loop].locale_string;
+ }
+ language.input_modes.push_back(input_mode_QTY);
+ language.priority = LANGAUGE_PRIORITY_DEFAULT;
+ language.resource_file = MAIN_ENTRY_XML_PATH;
+ language.is_latin_language = table[loop].is_latin_language;
+ language.accepts_caps_mode = table[loop].accepts_caps_mode;
+
+ /* These variable should be read from stored setting values */
+ language.enabled = FALSE;
+ language.selected_input_mode = input_mode_QTY.name;
+
+ _language_manager.add_language(language);
+ }
+ }
+
read_ise_config_values();
/* To make sure there is no temporary language in the enabled language list */
}
return false;
}
+
+static bool
+app_create(void *data)
+{
+ LOGD("");
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+
+ /* Hook to take necessary actions before main event loop starts
+ Initialize UI resources and application's data
+ If this function returns true, the main loop of application starts
+ If this function returns false, the application is terminated */
+ return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+ /* Handle the launch request. */
+ Evas_Object *window = elm_win_util_standard_add("Option window", "Option window");
+ if (!window) return;
+
+ int rots[] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(window, rots, (sizeof(rots) / sizeof(int)));
+ elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
+
+ option_window_created(window, OPTION_WINDOW_TYPE_SETTING_APPLICATION);
+}
+
+static void
+app_pause(void *data)
+{
+ LOGD("");
+ /* Take necessary actions when application becomes invisible. */
+}
+
+static void
+app_resume(void *data)
+{
+ LOGD("");
+}
+
+static void
+app_terminate(void *data)
+{
+ LOGD("");
+}
+
+EXPORTED int
+main(int argc, char *argv[])
+{
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.app_control = app_control;
+
+ ret = ui_app_main(argc, argv, &event_callback, NULL);
+ if (ret != APP_ERROR_NONE) {
+ LOGW("ui_app_main failed, Err=%d\n", ret);
+ }
+
+ return ret;
+}