From: Kiseok Chang Date: Fri, 25 Oct 2019 08:42:05 +0000 (+0900) Subject: Add menuitem a function to check if supported X-Git-Tag: submit/tizen/20191107.082138~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5160e446205092bcc66296d21cad5a0e596212a7;p=profile%2Fmobile%2Fapps%2Fnative%2Fsettings.git Add menuitem a function to check if supported Change-Id: I742779ff3f33964c1bb7f002cb5d10e3e27b4da3 Signed-off-by: Kiseok Chang --- diff --git a/setting-common/inc/setting-cfg.h b/setting-common/inc/setting-cfg.h index 3fa228c7..5a37f654 100644 --- a/setting-common/inc/setting-cfg.h +++ b/setting-common/inc/setting-cfg.h @@ -60,6 +60,9 @@ typedef struct { int (*set_item_update_ui)(Cfg_Item_State stat, void *data); } cfg_func_table; +typedef bool (*cfg_check_func)(); + + /** * List item */ @@ -70,6 +73,7 @@ typedef struct { int pos; /** position : 1st, 2st -- deprecated */ Cfg_Item_Type item_type; /** 0:item 1:header title */ cfg_func_table *tfunc; + cfg_check_func isvalid; } Setting_Cfg_Node_T; Setting_Cfg_Node_T *get_cfg_node_first(); diff --git a/setting-common/src/setting-cfg.c b/setting-common/src/setting-cfg.c index de6ff19a..bd746e0c 100755 --- a/setting-common/src/setting-cfg.c +++ b/setting-common/src/setting-cfg.c @@ -24,6 +24,7 @@ #include "setting-common-general-func.h" #include "setting-common-data-type.h" #include "setting-common-data-slp-setting.h" +#include #include int wifi_toggle_get_state(Cfg_Item_State *stat, void *data); @@ -32,7 +33,6 @@ int bluetooth_toggle_get_state(Cfg_Item_State *stat, void *data); int drivingmode_toggle_get_state(Cfg_Item_State *stat, void *data); int network_restriction_mode_toggle_get_state(Cfg_Item_State *stat, void *data); int nfc_toggle_get_state(Cfg_Item_State *stat, void *data); - /*////////////////////////////////////////////////////////////////////////// */ /* wifi - DONE */ EXPORT_PUBLIC @@ -62,58 +62,81 @@ cfg_func_table nfc_tfunc = { .set_item_state = NULL, .set_item_update_ui = NULL, }; +/*////////////////////////////////////////////////////////////////////////// */ + +bool isSupportNFC() +{ + bool value; + int ret = system_info_get_platform_bool("http://tizen.org/feature/network.nfc", &value); + if (ret != SYSTEM_INFO_ERROR_NONE) + return false; + return value; +} + +bool isSupportMobileNetwork() +{ + bool value; + int ret = system_info_get_platform_bool("http://tizen.org/feature/network.telephony", &value); + if (ret != SYSTEM_INFO_ERROR_NONE) + return false; + return value; +} + +bool isSupportStorage() +{ +#if SUPPORT_STORAGE + return true; +#else + return false; +#endif +} + +/*////////////////////////////////////////////////////////////////////////// */ + /* create config file from scratch */ static Setting_Cfg_Node_T s_cfg_node_array[] = { { KeyStr_Connections, NULL, "move://Tab2.top", - Cfg_Item_Pos_Level0, Cfg_Item_Title_Node, NULL + Cfg_Item_Pos_Level0, Cfg_Item_Title_Node, NULL, + NULL }, { KeyStr_WiFi, IMG_WiFi, "wifi-efl-ug", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, - &wifi_tfunc + &wifi_tfunc, + NULL }, { KeyStr_Bluetooth, IMG_Bluetooth, "ug-bluetooth-efl", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, - &bluetooth_tfunc + &bluetooth_tfunc, + NULL }, -/* - { "IDS_SM_HEADER_DATA_USAGE_ABB", - SETTING_LIST_ICON_PATH_CFG"settings_data_usage.png", - "org.tizen.setting-data", - Cfg_Item_Pos_Level0, - Cfg_Item_Resetable, - 0, - Cfg_Item_AppLauncher_Node, - NULL, - KeyStr_Device, - NULL, - "", - 0}, -*/ { KeyStr_FlightMode, IMG_FlightMode, "org.tizen.setting-flightmode", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, - &flightmode_tfunc + &flightmode_tfunc, + NULL }, { KeyStr_NFC, IMG_NFC, "ug-nfc-efl|type:nfc", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, - &nfc_tfunc + &nfc_tfunc, + isSupportNFC }, { KeyStr_MobileAP, IMG_MobileAP, "ug-setting-mobileap-efl", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_MobileNetworks, @@ -121,13 +144,15 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-network", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, - NULL + NULL, + isSupportMobileNetwork }, { KeyStr_WebAppAddon, IMG_Applications, "NVPDzvckj9.WebAppAddonSetting", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, #ifdef USE_TIZEN_CONNECT @@ -136,18 +161,21 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.d2d-conv-setting", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, #endif /* Group:Device */ { KeyStr_Device, NULL, "move://Tab3.top", Cfg_Item_Pos_Level0, - Cfg_Item_Title_Node, NULL + Cfg_Item_Title_Node, NULL, + NULL }, { KeyStr_Sounds, IMG_Sounds, "org.tizen.setting-profile", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_Display, @@ -155,6 +183,7 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-display|viewtype:main", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_ApplicationsItem, @@ -162,17 +191,20 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-applications", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, /* Group: Personal */ { KeyStr_Personal, NULL, "move://Tab3.top", Cfg_Item_Pos_Level0, - Cfg_Item_Title_Node, NULL + Cfg_Item_Title_Node, NULL, + NULL }, { KeyStr_Wallpaper, IMG_Wallpaper, "org.tizen.wallpaper-ui-service", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_LockScreen, @@ -180,6 +212,7 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.ug-lockscreen-options", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_Accessibility, @@ -187,6 +220,7 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.accessibility-setting", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, /*Privacy and security */ @@ -195,6 +229,7 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-privacy", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_Accounts, @@ -202,17 +237,20 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "setting-myaccount-efl|mode:account_list", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, /* Group: System */ { KeyStr_System, NULL, "move://Tab4.top", Cfg_Item_Pos_Level0, - Cfg_Item_Title_Node, NULL + Cfg_Item_Title_Node, NULL, + NULL }, { KeyStr_LanguageInput, IMG_LanguageInput, "org.tizen.setting-language-and-input", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_Battery, @@ -220,6 +258,7 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-battery", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { "IDS_ST_BODY_DATA", @@ -227,22 +266,23 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-data", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, -#if SUPPORT_STORAGE { KeyStr_Storage, IMG_Storage, "org.tizen.setting-storage", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, - NULL + NULL, + isSupportStorage }, -#endif { KeyStr_DateTime, IMG_DateTime, "org.tizen.setting-time", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL }, { KeyStr_AboutDevice, @@ -250,6 +290,7 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = { "org.tizen.setting-about", Cfg_Item_Pos_Level0, Cfg_Item_AppLauncher_Node, + NULL, NULL } }; diff --git a/setting-main/src/setting-main.c b/setting-main/src/setting-main.c index 347d8e48..616cb722 100644 --- a/setting-main/src/setting-main.c +++ b/setting-main/src/setting-main.c @@ -57,31 +57,33 @@ void _view_list_geter(void *data) retm_if(ad == NULL, "Invalid argument: data is NULL"); do { - /* Group: */ - if (cfg_node->item_type == Cfg_Item_Title_Node) { - item = elm_genlist_item_append(ad->md.genlist, - &(ad->itc_table[GENDIAL_Type_expandable_proc]), - _(cfg_node->key_name), - NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE); - } else { /* Clickable item: */ - icon_path = get_resource_path(cfg_node->icon_path); - SETTING_TRACE_DEBUG("ICON_PATH: %s", icon_path); - - setting_create_Gendial_field_def( - ad->md.genlist, - &(ad->itc_table[GENDIAL_Type_1text_1icon_2]), - setting_main_click_list_cb, - cfg_node->app_ctl_args, - SWALLOW_Type_1ICON_1IMAGE, - icon_path, - NULL, - 0, - cfg_node->key_name, - NULL, - NULL); - - free(icon_path); + if (cfg_node->isvalid == NULL || (*cfg_node->isvalid)()) { + /* Group: */ + if (cfg_node->item_type == Cfg_Item_Title_Node) { + item = elm_genlist_item_append(ad->md.genlist, + &(ad->itc_table[GENDIAL_Type_expandable_proc]), + _(cfg_node->key_name), + NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_NONE); + } else { /* Clickable item: */ + icon_path = get_resource_path(cfg_node->icon_path); + SETTING_TRACE_DEBUG("ICON_PATH: %s", icon_path); + + setting_create_Gendial_field_def( + ad->md.genlist, + &(ad->itc_table[GENDIAL_Type_1text_1icon_2]), + setting_main_click_list_cb, + cfg_node->app_ctl_args, + SWALLOW_Type_1ICON_1IMAGE, + icon_path, + NULL, + 0, + cfg_node->key_name, + NULL, + NULL); + + free(icon_path); + } } cfg_node++; } while (++i < get_cfg_array_size());