static void slot_set_enable_helper_ise_info (const String &appid, bool is_enabled);
static void slot_show_helper_ise_list (void);
static void slot_show_helper_ise_selector (void);
+static bool slot_is_helper_ise_enabled (String appid, int &enabled);
static bool slot_get_ise_information (String uuid, String &name, String &language, int &type, int &option, String &module_name);
static bool slot_get_keyboard_ise_list (std::vector<String> &name_list);
static void slot_get_language_list (std::vector<String> &name);
spot_x = _spot_location_x;
spot_y = _spot_location_y;
- rectinfo ise_rect = {0, 0, ise_width, ise_height};
+ rectinfo ise_rect = {0, 0, (uint32)ise_width, (uint32)ise_height};
if (_candidate_angle == 90 || _candidate_angle == 270) {
if (ise_rect.height <= (uint32)0 || ise_rect.height >= (uint32)_screen_width)
ise_rect.height = ISE_DEFAULT_HEIGHT_LANDSCAPE * _width_rate;
_panel_agent->signal_connect_set_enable_helper_ise_info (slot (slot_set_enable_helper_ise_info));
_panel_agent->signal_connect_show_helper_ise_list (slot (slot_show_helper_ise_list));
_panel_agent->signal_connect_show_helper_ise_selector (slot (slot_show_helper_ise_selector));
+ _panel_agent->signal_connect_is_helper_ise_enabled (slot (slot_is_helper_ise_enabled));
_panel_agent->signal_connect_get_ise_information (slot (slot_get_ise_information));
_panel_agent->signal_connect_get_keyboard_ise_list (slot (slot_get_keyboard_ise_list));
_panel_agent->signal_connect_get_language_list (slot (slot_get_language_list));
SECURE_LOGD("Launch %s", app_id);
}
+static bool slot_is_helper_ise_enabled (String appid, int &enabled)
+{
+ bool is_enabled = false;
+
+ if (appid.length() == 0) {
+ LOGW("Invalid appid");
+ return false;
+ }
+
+ if (_ime_info.size() == 0)
+ isf_db_select_all_ime_info(_ime_info);
+
+ if (isf_db_select_is_enabled_by_appid(appid.c_str(), &is_enabled)) {
+ enabled = static_cast<int>(is_enabled);
+ }
+ else
+ return false;
+
+ return true;
+}
+
/**
* @brief Get the ISE's information.
*
return 0;
}
+EAPI int isf_control_is_ime_enabled (const char *appid, bool *enabled)
+{
+ if (!appid || !enabled)
+ return -1;
+
+ int nEnabled = -1;
+
+ IMControlClient imcontrol_client;
+ imcontrol_client.open_connection ();
+ imcontrol_client.prepare ();
+ imcontrol_client.is_helper_ise_enabled (appid, nEnabled);
+ imcontrol_client.close_connection ();
+
+ if (nEnabled < 0)
+ return -1;
+ else
+ *enabled = static_cast<bool>(nEnabled);
+
+ return 0;
+}
+
/*
vi:ts=4:nowrap:ai:expandtab
*/
* @param uuid The parameter is used to store active ISE's UUID.
* Application needs free *uuid if it is not used.
*
- * @return the length of UUID if successfully, otherwise return -1;
+ * @return the length of UUID if successfully, otherwise return -1
*/
EAPI int isf_control_get_active_ise (char **uuid);
* @param type The parameter is used to store ISE's type.
* @param option The parameter is used to store ISE's option.
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 if successfully, otherwise return -1
*/
EAPI int isf_control_get_ise_info (const char *uuid, char **name, char **language, ISE_TYPE_T *type, int *option);
* @param option The parameter is used to store ISE's option.
* @param module_name The parameter is used to store ISE's module file name.
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 if successfully, otherwise return -1
*/
EAPI int isf_control_get_ise_info_and_module_name (const char *uuid, char **name, char **language, ISE_TYPE_T *type, int *option, char **module_name);
/**
* @brief Set active ISE to default ISE.
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 if successfully, otherwise return -1
*/
EAPI int isf_control_set_active_ise_to_default (void);
*
* @param uuid The initial ISE's UUID.
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 if successfully, otherwise return -1
*/
EAPI int isf_control_set_initial_ise_by_uuid (const char *uuid);
/**
* @brief Show ISE's option window.
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 if successfully, otherwise return -1
*/
EAPI int isf_control_show_ise_option_window ();
*
* @param[in] appid Application ID of IME to set as active one
*
- * @return 0 on success, otherwise -1
+ * @return 0 on success, otherwise return -1
*/
EAPI int isf_control_set_active_ime (const char *appid);
* @param[in] appid Application ID of IME to enable or disable
* @param[in] is_enabled @c true to enable the IME, otherwise @c false
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 on success, otherwise return -1
*/
EAPI int isf_control_set_enable_ime (const char *appid, bool is_enabled);
*
* @since_tizen 2.4
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 on success, otherwise return -1
*/
EAPI int isf_control_show_ime_list (void);
*
* @since_tizen 2.4
*
- * @return 0 if successfully, otherwise return -1;
+ * @return 0 on success, otherwise return -1
*/
EAPI int isf_control_show_ime_selector (void);
+/**
+ * @brief Checks if the specific IME is enabled or disabled in the system keyboard setting.
+ *
+ * @since_tizen 2.4
+ *
+ * @param[in] appid The application ID of the IME
+ * @param[out] enabled The On (enabled) and Off (disabled) state of the IME
+ *
+ * @return 0 on success, otherwise return -1
+ */
+EAPI int isf_control_is_ime_enabled (const char *appid, bool *enabled);
#ifdef __cplusplus
}
void show_helper_ise_selector (void) {
m_trans.put_command (ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR);
}
+
+ void is_helper_ise_enabled (const char* appid, int &enabled)
+ {
+ int cmd;
+ uint32 tmp_enabled;
+
+ m_trans.put_command (ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED);
+ m_trans.put_data (String (appid));
+ m_trans.write_to_socket (m_socket_imclient2panel);
+ if (!m_trans.read_from_socket (m_socket_imclient2panel, m_socket_timeout))
+ std::cerr << __func__ << " read_from_socket() may be timeout \n";
+
+ if (m_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_REPLY &&
+ m_trans.get_command (cmd) && cmd == SCIM_TRANS_CMD_OK &&
+ m_trans.get_data (tmp_enabled)) {
+ enabled = static_cast<int>(tmp_enabled);
+ } else {
+ std::cerr << __func__ << " get_command() or get_data() may fail!!!\n";
+ }
+ }
};
IMControlClient::IMControlClient ()
m_impl->show_helper_ise_selector ();
}
+void IMControlClient::is_helper_ise_enabled (const char* appid, int &enabled)
+{
+ m_impl->is_helper_ise_enabled (appid, enabled);
+}
+
};
/*
void set_enable_helper_ise_info (const char *appid, bool is_enabled);
void show_helper_ise_list (void);
void show_helper_ise_selector (void);
+ void is_helper_ise_enabled (const char* appid, int &enabled);
};
}
}
/**
+ * @brief Select "is_enabled" by appid in ime_info table.
+ *
+ * @param[in] appid appid in ime_info table.
+ * @param[out] is_enabled Helper ISE enabled or not.
+ *
+ * @return 1 if it is successful, otherwise return 0.
+ */
+static int _db_select_is_enabled_by_appid(const char *appid, bool *is_enabled)
+{
+ int ret = 0, i = 0;
+ sqlite3_stmt* pStmt = NULL;
+ static const char* pQuery = "SELECT is_enabled FROM ime_info WHERE appid = ?";
+
+ if (!appid || !is_enabled)
+ return i;
+
+ ret = sqlite3_prepare_v2(databaseInfo.pHandle, pQuery, -1, &pStmt, NULL);
+ if (ret != SQLITE_OK) {
+ LOGE("%s", sqlite3_errmsg(databaseInfo.pHandle));
+ return i;
+ }
+
+ ret = sqlite3_bind_text(pStmt, 1, appid, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ LOGE("%s", sqlite3_errmsg(databaseInfo.pHandle));
+ goto out;
+ }
+
+ ret = sqlite3_step(pStmt);
+ if (ret != SQLITE_ROW) {
+ LOGE("%s", sqlite3_errmsg(databaseInfo.pHandle));
+ }
+ else {
+ *is_enabled = (bool)sqlite3_column_int(pStmt, 0);
+ i = 1;
+ SECURE_LOGD("is_enabled=%d by appid=\"%s\"", *is_enabled, appid);
+ }
+
+out:
+ sqlite3_reset(pStmt);
+ sqlite3_clear_bindings(pStmt);
+ sqlite3_finalize(pStmt);
+ return i;
+}
+
+/**
* @brief Gets the count of the same module name in ime_info table.
*
* @param module_name Module name
}
/**
+ * @brief Select "is_enabled" by appid in ime_info table.
+ *
+ * @param[in] appid appid in ime_info table.
+ * @param[out] is_enabled Helper ISE enabled or not.
+ *
+ * @return 1 if it is successful, otherwise return 0.
+ */
+EAPI int isf_db_select_is_enabled_by_appid(const char *appid, bool *is_enabled)
+{
+ int ret = 0;
+
+ if (!appid || !is_enabled) {
+ LOGW("Input parameter is null.");
+ return 0;
+ }
+
+ if (_db_connect() == 0) {
+ ret = _db_select_is_enabled_by_appid(appid, is_enabled);
+ _db_disconnect();
+ }
+ else
+ LOGW("failed");
+
+ return ret;
+}
+
+
+/**
* @brief Gets the count of the same module name in ime_info table.
*
* @param module_name Module name
* @brief Update "is_enabled" data by appid in ime_info table.
*
* @param appid appid in ime_info table.
- * @param enabled Helper ISE enabled or not.
+ * @param is_enabled Helper ISE enabled or not.
*
* @return 1 if it is successful, otherwise return 0.
*/
EAPI int isf_db_select_module_name_by_mode(TOOLBAR_MODE_T mode, std::vector<String> &mname);
EAPI int isf_db_select_module_path_by_mode(TOOLBAR_MODE_T mode, std::vector<String> &mpath);
EAPI int isf_db_select_appids_by_pkgid(const char *pkgid, std::vector<String> &appids);
+EAPI int isf_db_select_is_enabled_by_appid(const char *appid, bool *is_enabled);
EAPI int isf_db_select_count_by_module_name(const char *module_name);
EAPI int isf_db_update_label_by_appid(const char *appid, const char *label);
EAPI int isf_db_update_is_enabled_by_appid(const char *appid, bool is_enabled);
typedef Signal2<bool, const String &, ISE_INFO &>
PanelAgentSignalStringISEINFO;
+typedef Signal2<bool, String, int &>
+ PanelAgentSignalStringInt;
+
typedef Signal1<void, const KeyEvent &>
PanelAgentSignalKeyEvent;
PanelAgentSignalStringBool m_signal_set_enable_helper_ise_info;
PanelAgentSignalVoid m_signal_show_helper_ise_list;
PanelAgentSignalVoid m_signal_show_helper_ise_selector;
+ PanelAgentSignalStringInt m_signal_is_helper_ise_enabled;
PanelAgentSignalBoolString4int2 m_signal_get_ise_information;
PanelAgentSignalBoolStringVector m_signal_get_keyboard_ise_list;
PanelAgentSignalIntIntIntInt m_signal_update_ise_geometry;
m_signal_show_helper_ise_selector ();
}
+ void is_helper_ise_enabled (int client_id)
+ {
+ SCIM_DEBUG_MAIN(4) << __func__ << "\n";
+
+ String strAppid;
+ int nEnabled = 0;
+ bool ret = false;
+
+ if (m_recv_trans.get_data (strAppid)) {
+ ret = m_signal_is_helper_ise_enabled (strAppid, nEnabled);
+ }
+
+ Transaction trans;
+ Socket client_socket (client_id);
+ trans.clear ();
+ trans.put_command (SCIM_TRANS_CMD_REPLY);
+ if (ret) {
+ trans.put_command (SCIM_TRANS_CMD_OK);
+ trans.put_data (static_cast<uint32>(nEnabled));
+ }
+ else {
+ trans.put_command (SCIM_TRANS_CMD_FAIL);
+ }
+ trans.write_to_socket (client_socket);
+ }
+
void get_ise_information (int client_id)
{
SCIM_DEBUG_MAIN(4) << __func__ << "\n";
return m_signal_show_helper_ise_selector.connect (slot);
}
+ Connection signal_connect_is_helper_ise_enabled (PanelAgentSlotStringInt *slot)
+ {
+ return m_signal_is_helper_ise_enabled.connect (slot);
+ }
+
Connection signal_connect_get_ise_information (PanelAgentSlotBoolString4int2 *slot)
{
return m_signal_get_ise_information.connect (slot);
else if (cmd == ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR) {
show_helper_ise_selector (client_id);
}
+ else if (cmd == ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED) {
+ is_helper_ise_enabled (client_id);
+ }
}
socket_transaction_end ();
}
Connection
+PanelAgent::signal_connect_is_helper_ise_enabled (PanelAgentSlotStringInt *slot)
+{
+ return m_impl->signal_connect_is_helper_ise_enabled (slot);
+}
+
+Connection
PanelAgent::signal_connect_get_ise_information (PanelAgentSlotBoolString4int2 *slot)
{
return m_impl->signal_connect_get_ise_information (slot);
typedef Slot2<bool, const String &, ISE_INFO &>
PanelAgentSlotStringISEINFO;
+typedef Slot2<bool, String, int &>
+ PanelAgentSlotStringInt;
+
typedef Slot1<void, const KeyEvent &>
PanelAgentSlotKeyEvent;
Connection signal_connect_show_helper_ise_selector (PanelAgentSlotVoid *slot);
/**
+ * @brief Signal: Checks if the specific IME is enabled or disabled in the system keyboard setting
+ *
+ * slot prototype: bool is_helper_ise_enabled (const String, int &);
+ */
+ Connection signal_connect_is_helper_ise_enabled (PanelAgentSlotStringInt *slot);
+
+ /**
* @brief Signal: Get the ISE information according to UUID.
*
* slot prototype: bool get_ise_information (String, String &, String &, int &, int &);
const int ISM_TRANS_CMD_SET_ENABLE_HELPER_ISE_INFO = 1020;
const int ISM_TRANS_CMD_SHOW_HELPER_ISE_LIST = 1021;
const int ISM_TRANS_CMD_SHOW_HELPER_ISE_SELECTOR = 1022;
+const int ISM_TRANS_CMD_IS_HELPER_ISE_ENABLED = 1023;
/* IMControl to ISE */
const int ISM_TRANS_CMD_SET_ISE_MODE = 1108;