#include <setting-cfg.h>
#include <setting-about-main.h>
#include <aul.h>
-#include <iniparser.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <bluetooth-api.h>
+//#include <bluetooth-api.h>
+
+#include <bluetooth.h>
#include <app_manager.h>
+#include <system_info.h>
#define DEVNAME_BLOCK_SPACE 0
// #define SUPPORT_DIAG_USAGE
/** @todo : need to handle unicode encoded input characters */
#define MAX_DEVICE_NAME_LEN 24
-#define EMPTY_LIMITATION_STR "IDS_ST_BODY_THE_NAME_FIELD_CANNOT_BE_EMPTY"
+#define EMPTY_LIMITATION_STR "The Name cannot be empty or composited by spaces"//"IDS_ST_BODY_THE_NAME_FIELD_CANNOT_BE_EMPTY"
#define DIAGNOSTICS_USAGE_STR "Diagnostics and Usage"
#define SOFTWARE_UPDATE_STR "IDS_ST_MBODY_SOFTWARE_UPDATE"
.update = setting_about_main_update,
.cleanup = setting_about_main_cleanup,
};
-
-static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info);
-
/**
* Do process when clicking '<-' button
*
Evas_Object *obj,
void *event_info);
-static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
- Evas_Object *obj,
- void *event_info);
-
static void __setting_about_main_certificates_clicked(void *data);
static void __setting_about_main_device_name_clicked(void *data, Evas_Object *obj);
static void __setting_about_main_diagnostics_usage_clicked(void *data, Evas_Object *obj);
-
-static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info);
/* ***************************************************
*
*basic func
if (!ad->empty_flag)
{
ad->empty_flag = TRUE;
+ //elm_entry_context_menu_disabled_set(obj, TRUE); //disable the copy&paste&search popup
+ //elm_entry_magnifier_disabled_set(obj, TRUE);
Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
if (navi_it)
{
if (ad->empty_flag)
{
ad->empty_flag = FALSE;
+ //elm_entry_context_menu_disabled_set(obj, FALSE); //enable the copy&paste&search popup
+ //elm_entry_magnifier_disabled_set(obj, FALSE);
Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
if (navi_it)
{
{
retm_if(szStr == NULL, "szStr parameter is NULL");
- char szBin[50];
- char szEmul[50];
-
- const char* szBinVer = NULL;
-
- dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
- if (dic) {
- szBinVer = (char*)iniparser_getstr(dic, "Version:Build");
- if (szBinVer) {
- char* str = g_strdup(szBinVer);
- if (str) {
- char* pPos = str;
- while (*pPos++) {
- if ('_' == *pPos)
- *pPos = ' ';
- }
- sscanf(str, "%s %s", szBin, szEmul);
- }
- G_FREE(str);
- }
+ char *value = NULL;
+ int ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &value);
+ SETTING_TRACE("value : %s", value);
+ if (ret != SYSTEM_INFO_ERROR_NONE) {
+ SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+ FREE(value);
+ snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
+ return;
}
- if (!strncmp(szEmul, "emul", 4)) {
- snprintf(szStr, nSize, "%s", "SDK");
+ if (value) {
+ snprintf(szStr, nSize, "%s", value);
} else {
- if (!strncmp(szBin, "I9500", 5)) {
- snprintf(szStr, nSize, "GT-%s", szBin);
- } else if (!strncmp(szBin, "SLP", 3)) {
- snprintf(szStr, nSize, "GT-%s", szBin);
- } else {
- snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
- }
+ snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
}
- if (dic) {
- iniparser_freedict(dic);
- dic = NULL;
- }
+ FREE(value);
}
void setting_about_main_get_sw_version(char* szStr, int nSize)
{
retm_if(szStr == NULL, "szStr parameter is NULL");
- dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
- if (dic == NULL) {
+ // ex) TIZEN
+ char *platform = NULL;
+ int ret = system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &platform);
+ if (ret != SYSTEM_INFO_ERROR_NONE) {
+ SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+ FREE(platform);
snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
- } else {
- char* szBinVer =
- g_strdup((char*)iniparser_getstr(dic, "Version:Build"));
- char* szVerMaj =
- g_strdup((char*)iniparser_getstr(dic, "Version:Major"));
- char* szVerMin =
- g_strdup((char*)iniparser_getstr(dic, "Version:Minor"));
-
- if (szBinVer) {
- char* pPos = szBinVer;
- while(*pPos++) {
- if ('.' == *pPos) *pPos = '\0';
- }
- }
- else {
- szBinVer = g_strdup(_("IDS_ST_HEADER_UNAVAILABLE"));
- }
- if (!szVerMaj) {
- szVerMaj = g_strdup("-");
- }
- if (!szVerMin) {
- szVerMin = g_strdup("-");
- }
-
- snprintf(szStr, nSize, "SLP%s.%s (%s)", szVerMaj, szVerMin, szBinVer);
- G_FREE(szBinVer);
- G_FREE(szVerMaj);
- G_FREE(szVerMin);
+ return;
}
- if (dic) {
- iniparser_freedict(dic);
- dic = NULL;
+ // ex) 2.0.0b
+ char *version = NULL;
+ ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &version);
+ if (ret != SYSTEM_INFO_ERROR_NONE) {
+ SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+
+ FREE(platform);
+ FREE(version);
+
+ snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
+ return;
}
+ snprintf(szStr, nSize, "%s %s", platform, version);
+
+ FREE(platform);
+ FREE(version);
}
void setting_about_main_get_wifi_mac_address_string(char *str, int size)
{
setting_retm_if(str == NULL, "str parameter is NULL");
- int val = -1;
- char file[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
- snprintf(file, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO,
- "%s/%s/%s", SETTING_ABOUT_POWER_SUPPLY_PATH, "battery", "capacity");
-
- char buf[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
- int fd = 0;
- int r = 0;
-
- fd = open(file, O_RDONLY);
- if (fd != -1) {
- r = read(fd, buf, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
- if ((r >= 0) && (r < MAX_DISPLAY_STR_LEN_ON_PHONE_INFO)) {
- buf[r] = '\0';
- val = atoi(buf);
- snprintf(str, size, "%d%s", val, "\%");
- } else {
- SETTING_TRACE_ERROR("read file fail");
- snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
- }
+ int bat_level = -1;
- close(fd);
- } else {
- SETTING_TRACE_ERROR("open file fail");
+ /* Read battery level from vconf, as system-server sets that key using a
+ device-specific plugin. Reading directly from /sys fails on different
+ devices */
+ if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, &bat_level) == 0) {
+ snprintf(str, size, "%d%s", bat_level, "\%");
+ }
+ else {
+ SETTING_TRACE_ERROR("Reading VCONFKEY_SYSMAN_BATTERY_CAPACITY failed.");
snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
}
}
{
setting_retm_if(str == NULL, "str parameter is NULL");
- bluetooth_device_address_t local_address;
- memset(&local_address, 0x0, sizeof(local_address));
int ret = 0;
- /* for fixing BS of dbus signal */
- bluetooth_register_callback(NULL, NULL);
+ ret = bt_initialize();
+ setting_retm_if(ret != 0, "bluetooth initialization failed");
- ret = bluetooth_get_local_address(&local_address);
+ char *local_address = NULL;
+ ret = bt_adapter_get_address(&local_address);
- /* for fixing BS of dbus signal */
- bluetooth_unregister_callback();
+ bt_deinitialize();
if (ret < 0) {
snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
+ SETTING_TRACE_DEBUG("bt address : %s", str);
} else {
- snprintf(str, size, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
- local_address.addr[0], local_address.addr[1], local_address.addr[2],
- local_address.addr[3], local_address.addr[4], local_address.addr[5]);
+ SETTING_TRACE_DEBUG("bt address : %s", local_address);
+ snprintf(str, size, "%s", local_address);
+ }
+
+ if (local_address) {
+ free(local_address);
}
- SETTING_TRACE_DEBUG("bt address : %s", str);
}
int __stat_get_cpuinfo(float *usr_pct, float *sys_pct)
Setting_GenGroupItem_Data *item_dev_name = data;
SettingAboutUG *ad = item_dev_name->userdata;
__device_name_changed_cb(item_dev_name, item_dev_name->eo_check);
+#if 0
//after unfocus,need updating..
elm_object_item_data_set(item_dev_name->item, item_dev_name);
elm_genlist_item_update(item_dev_name->item);
-
+#endif
if(ad->navi_item
&& elm_object_item_part_content_get(ad->navi_item, "title_right_btn")) {
SettingAboutUG *ad = (SettingAboutUG*)data;
Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
SETTING_TRACE_DEBUG("ev->key : %s", ev->key);
-
- SETTING_TRACE("ad->item_dev_name->eo_check:%p", ad->item_dev_name->eo_check);
- SETTING_TRACE("obj:%p, %s", obj, elm_entry_entry_get(obj));
- if(safeStrCmp(ev->key, "Return") == 0)
+ if(safeStrCmp(ev->key, "KP_Enter") == 0 //it is for Japanese keyboard to fix N_SE-10719
+ || safeStrCmp(ev->key, "Return") == 0)
{
// if entry has 1 char at list, hide ime.
- if(safeStrLen(elm_entry_entry_get(obj)) > 0)
- {
- ecore_imf_context_input_panel_hide((Ecore_IMF_Context*)elm_entry_imf_context_get(obj));
- }
- else
+ if(safeStrLen(elm_entry_entry_get(obj)) == 0)
{
if (ad->popup) {
evas_object_del(ad->popup);
ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _(EMPTY_LIMITATION_STR),
__about_popup_rsp_cb, POPUP_INTERVAL, FALSE, FALSE);
}
- } else {
- Evas_Object *entry_container = elm_object_parent_widget_get(obj);
- if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
- elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
- } else {
- //elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
- elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
- }
}
}
-
int setting_about_generate_genlist(void *data)
{
SETTING_TRACE_BEGIN;
/* error check */
retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
- SettingAboutUG *ad = (SettingAboutUG *) data;
+ SettingAboutUG *ad = (SettingAboutUG *) data;
+ bool is_emul_bin = isEmulBin();
Evas_Object *scroller = ad->genlsit;
Elm_Object_Item *item = NULL;
__setting_about_device_name_changed_cb);
if (ad->item_dev_name) {
ad->item_dev_name->userdata = ad;
- ad->item_dev_name->isSinglelineFlag = 1;
+ ad->item_dev_name->isSinglelineFlag = 0;
ad->item_dev_name->start_change_cb = (setting_call_back_func)__entry_key_down_cb;
ad->item_dev_name->stop_change_cb = __entry_unfocus_cb;
ad->item_dev_name->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
}
// [UI] My number
+ int err;
+ char sel_num[TAPI_SIM_XDN_DIALING_NUMBER_LEN + 1] = { 0, };
+ setting_get_string_slp_key(STR_SLP_SETTING_SELECT_NUM, sel_num, &err);
+
if (ad->my_numbers.count == 1) {
item_data =
setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2),
- setting_about_main_mouse_up_Gendial_list_cb,
+ NULL,
ad, SWALLOW_Type_INVALID, NULL,
NULL, 0, SETTING_ABOUT_MY_NUMBER_STR,
- ad->my_numbers.list[0].name, NULL);
+ sel_num, NULL);
if (item_data) {
elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
} else {
}
} else if (ad->my_numbers.count > 1){
setting_enable_expandable_genlist(scroller, ad,
- __setting_about_main_exp_cb, NULL);
+ setting_about_main_exp_cb, NULL);
item_data = setting_create_Gendial_exp_parent_field(scroller,
&(ad->itc_2text_3_parent),
NULL, NULL,
SWALLOW_Type_INVALID,
SETTING_ABOUT_MY_NUMBER_STR,
- ad->my_numbers.list[ad->my_number_sel_idx].name);
+ sel_num);
+ if (item_data) {
+ item_data->int_slp_setting_binded = STR_SLP_SETTING_SELECT_NUM;
+ } else {
+ SETTING_TRACE_ERROR("ad->data_wap is NULL");
+ }
- } else {
+ } else if (ad->my_numbers.count == 0) {
+ // _("IDS_ST_HEADER_UNAVAILABLE")
SETTING_TRACE_ERROR("don't have my number");
+ item_data =
+ setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2),
+ NULL,
+ ad, SWALLOW_Type_INVALID, NULL,
+ NULL, 0, SETTING_ABOUT_MY_NUMBER_STR,
+ _("IDS_ST_HEADER_UNAVAILABLE"), NULL);
+ if (item_data) {
+ elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ } else {
+ SETTING_TRACE_ERROR("item_data is NULL");
+ }
}
// [UI] Phone model
}
// [UI] Bluetooth address
- if ( ! isEmulBin()) { // requested by DI Kim due to BT BS on 11/26
+ if ( ! is_emul_bin) { // requested by DI Kim due to BT BS on 11/26
memset(str, 0x00, sizeof(str));
setting_about_main_get_bluetooth_address_string(str, sizeof(str));
ad->item_data_bt =
#ifdef SUPPORT_DIAG_USAGE
// [UI] Diagnostics and Usage
- if (!isEmulBin()) {
+ if (!is_emul_bin) {
setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
setting_about_main_mouse_up_Gendial_list_cb,
ad, SWALLOW_Type_INVALID, NULL, NULL,
}
#endif
-#ifdef SUPPORT_FOTA
- // [UI] Software update
- if (!isEmulBin()) {
- setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
- setting_about_main_mouse_up_Gendial_list_cb,
- ad, SWALLOW_Type_INVALID, NULL, NULL,
- 0, SOFTWARE_UPDATE_STR,
- NULL, NULL);
- }
-#endif
// [UI] Certificates
// implementation is in progress.
if (is_ug_installed_by_ug_args("setting-manage-applications-efl"))
ad->navi_item = elm_naviframe_top_item_get(ad->navi_bar);
- int err = 0;
- int value;
- setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
- if (VCONFKEY_TELEPHONY_SIM_INSERTED != value)
- {
- setting_about_generate_genlist((void *)ad);
- } else {
- if (ad->handle && !ad->tapi_responsed) {//not responsed yet
- //SETTING_TRACE(">>> IF THERE'S SIM CARD, THIS LINE SHOULD NOT WORK");
- } else {//already responsed
- // do nothing
- }
- }
+ setting_about_generate_genlist((void *)ad);
setting_view_about_main.is_create = 1;
SETTING_TRACE_END;
__setting_about_main_device_name_clicked(data, list_item->eo_check);
} else if (!safeStrCmp(DIAGNOSTICS_USAGE_STR, list_item->keyStr)) {
__setting_about_main_diagnostics_usage_clicked(data, list_item->eo_check);
- } else if (!safeStrCmp(SOFTWARE_UPDATE_STR, list_item->keyStr)) {
-#ifdef SUPPORT_FOTA
- if(aul_app_is_running("com.samsung.oma-dm-ui"))
- {
- SETTING_TRACE_DEBUG("oma-dm-ui is already launched. ");
- aul_open_app("com.samsung.oma-dm-ui");
- }
- else
- {
- SETTING_TRACE_DEBUG("oma-dm-ui will be launched. ");
- aul_launch_app("com.samsung.oma-dm-ui", NULL);
- }
-#endif
}
}
SETTING_TRACE_END;
}
+static Eina_Bool __delay_remove(void *data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingAboutUG *ad = data;
+ if (ad->popup)
+ {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+ return FALSE;
+}
static void _input_panel_event_cb(void *data, Ecore_IMF_Context *ctx, int value)
{
SETTING_TRACE_BEGIN;
__top_back_cb,
ad);
elm_object_item_part_content_set(ad->navi_item, "title_right_btn", r_button);
+ if (ad->empty_flag)
+ {
+ setting_disable_evas_object(r_button);
+ setting_dim_evas_object(r_button, TRUE);
+ }
}
}
else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
if (ad->item_dev_name) {
elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
- }
+ }//if Setting is overlapped by other app,the entry will lost its focus,
+ //the input pannel will be hided and any popup should be removed to fix blinking issue.
+ if (ad->pause_flag)
+ ecore_idler_add(__delay_remove, ad);
}
}
retm_if(obj == NULL, "obj parameter is NULL");
SettingAboutUG *ad = (SettingAboutUG *)data;
- int mobile_ap_status = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
- int err = -1;
- int ret = setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &mobile_ap_status, &err);
- setting_retm_if(ret == SETTING_RETURN_FAIL, "Get vconf failed");
-
if (!elm_object_focus_get(obj)) {
elm_object_focus_set(obj, EINA_TRUE);
}
- if ((mobile_ap_status & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) && !ad->popup_showed_flag) {
- if (ad->popup) {
- evas_object_del(ad->popup);
- ad->popup = NULL;
- }
- ad->popup = setting_create_popup_with_btn(ad, ad->win_get,
- NULL, _(SETTING_ABOUT_MOBILE_AP_TURNED_OFF),
- __setting_about_main_mobile_ap_turn_off_ask_resp_cb, 0,
- 1, _("IDS_COM_SK_OK"));
- } else {
- Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
- setting_retm_if(imf_context == NULL, "imf_context is NULL");
- ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_cb, ad);
- ecore_imf_context_input_panel_show(imf_context);
- }
+ Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
+ setting_retm_if(imf_context == NULL, "imf_context is NULL");
+ ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_cb, ad);
+ ecore_imf_context_input_panel_show(imf_context);
}
}
FREE(cbs);
}
-
-static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
- Evas_Object *obj,
- void *event_info)
-{
- SETTING_TRACE_BEGIN;
- setting_retm_if(data == NULL, "Data parameter is NULL");
- SettingAboutUG *ad = (SettingAboutUG *)data;
- int response_type = btn_type(obj);
-
- if (POPUP_RESPONSE_OK == response_type) {
- ad->popup_showed_flag = TRUE;
-
- if (ad->item_dev_name) {
- Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ad->item_dev_name->eo_check);
- setting_retm_if(imf_context == NULL, "imf_context is NULL");
- ecore_imf_context_input_panel_show(imf_context);
- }
- }
-
- if (ad->popup)
- {
- evas_object_del(ad->popup);
- ad->popup = NULL;
- }
-}
-
-static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info)
-{
- SETTING_TRACE_BEGIN;
- setting_retm_if(data == NULL, "Data parameter is NULL");
- setting_retm_if(event_info == NULL, "event_info parameter is NULL");
-
- SettingAboutUG *ad = (SettingAboutUG *) data;
- Elm_Object_Item *parentItem = event_info; /* parent item */
- Evas_Object *scroller = elm_object_item_widget_get(parentItem);
-
- Evas_Object *rgd = elm_radio_add(scroller);
- elm_radio_value_set(rgd, -1);
-
- int i = 0;
- Setting_GenGroupItem_Data *item_data = NULL;
- for(; i < SETTING_ABOUT_MY_NUMBERS_LEN; i++) {
- if (ad->my_numbers.list[i].name == NULL) {
- break;
- }
-
- item_data = setting_create_Gendial_exp_sub_field(scroller,
- &(ad->itc_1icon_1text_sub),
- NULL, NULL, parentItem,
- SWALLOW_Type_1RADIO, rgd,
- i,
- ad->my_numbers.list[i].name, __setting_about_sub_list_rd_change);
- if (item_data) {
- item_data->userdata = ad;
- elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
- } else {
- SETTING_TRACE_ERROR("item_data is NULL");
- }
- }
- elm_radio_value_set(rgd, ad->my_number_sel_idx);
-}
-
-static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info) {
- SETTING_TRACE_BEGIN;
- retm_if(data == NULL, "Data parameter is NULL");
- Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
- SettingAboutUG *ad = (SettingAboutUG *) list_item->userdata;
- SETTING_TRACE("my_number_sel_idx = %d", ad->my_number_sel_idx);
- elm_radio_value_set(obj, ad->my_number_sel_idx);
-}
-