/*
- * Copyright 2012 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.tizenopensource.org/license
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include "setting.h"
-#include <TapiCommon.h>
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <tapi_common.h>
+#include <aul.h>
+#include <ail.h>
#include <time.h>
-#include "setting-main.h"
+#include <setting-main.h>
+#include <setting-plugin.h>
-#define NO_UG_FOUND_MSG _("IDS_COM_POP_UNSUPPORTED")
-void setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj, void *event_info);
-void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo, void *event_info);
-void setting_ask_data_roaming_resp_cb(void *data, Evas_Object *obj, void *event_info);
+typedef struct DrawAppInfo DrawAppInfo;
+typedef struct DrawAppInfo
+{
+ int ncount;
+ //------------------------------------
+ void (*draw_app)(void* arg, char* name, char* pkgname);
+ void* data;
+};
-unsigned int subs_id_main;
-setting_main_appdata *g_main_ad;
+static int setting_main_create(void *cb);
+static int setting_main_destroy(void *cb);
+static int setting_main_update(void *cb);
+static int setting_main_cleanup(void *cb);
setting_view setting_view_main = {
.create = setting_main_create,
.cleanup = setting_main_cleanup,
};
-void
+static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data);
+static int setting_main_refresh(void *data);
+static void __alternate_flight_mode(Evas_Object *check);
+static void setting_main_click_Gendial_list_flight_mode_cb(void *data,
+ Evas_Object *obj,
+ void *event_info);
+static void __alternate_flight_mode(Evas_Object *check);
+
+void setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj, char *ug_to_load, service_h svc, struct ug_cbs *cbs);
+
+setting_main_appdata *g_main_ad;
+static void
__setting_chk_changed(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;
+ /* SETTING_TRACE("process item [%s]", _(list_item->keyStr)); */
list_item->chk_status = elm_check_state_get(obj);
Eina_List *check_list = g_main_ad->item_check_list;
elm_genlist_item_update(g_main_ad->check_all_item->item);
if (isFoundSelSomeone) {
+ /* SETTING_TRACE("Set it to active"); */
elm_object_item_disabled_set(elm_toolbar_last_item_get
(g_main_ad->controllbar_all_check),
EINA_FALSE);
}
}
-void __setting_list_changed(void *data, Evas_Object *obj,
+static void __setting_list_changed(void *data, Evas_Object *obj,
void *event_info)
{
+
SETTING_TRACE_BEGIN;
+ /* error check */
retm_if(event_info == NULL, "Invalid argument: event info is NULL");
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
elm_genlist_item_update(g_main_ad->check_all_item->item);
if (isFoundSelSomeone) {
+ /* SETTING_TRACE("Set it to active"); */
elm_object_item_disabled_set(elm_toolbar_last_item_get
(g_main_ad->controllbar_all_check),
EINA_FALSE);
}
-void
+static void
__setting_chk_sel_all_changed(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;
bool is_all_checked = elm_check_state_get(obj);
list_item->chk_status = is_all_checked; /* for update new state */
+ /* SETTING_TRACE("is_all_checked:%d", is_all_checked); */
Eina_List *check_list = g_main_ad->item_check_list;
}
}
-void __setting_list_sel_all_changed(void *data, Evas_Object *obj,
+static void __setting_list_sel_all_changed(void *data, Evas_Object *obj,
void *event_info)
{
+ /* error check */
SETTING_TRACE_BEGIN;
+ SETTING_TRACE();
retm_if(event_info == NULL, "Invalid argument: event info is NULL");
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
elm_genlist_item_selected_set(item, 0);
continue;
}
list_item->chk_status = is_all_checked;
+ /* elm_check_state_set(list_item->eo_check, is_all_checked); */
elm_object_item_data_set(list_item->item, list_item);
elm_genlist_item_update(list_item->item);
check_list = eina_list_next(check_list);
}
-void __load_check_list(void *data, Evas_Object **genlist, char *menuNameKey)
+static void __load_check_list(void *data, Evas_Object **genlist,
+ char *menuNameKey)
{
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = (setting_main_appdata *) data;
+
bool state = FALSE;
char *keyStr = NULL;
Cfg_Item_Position pos = Cfg_Item_Pos_Uninstall;
Setting_GenGroupItem_Data *category_item = NULL;
for (i = 0; i < setting_cfg_get_category_length(); i++) {
if (NULL == menuNameKey) {
- SETTING_TRACE("Menu Name Key is NULL");
- } else {
- if (safeStrCmp (setting_cfg_get_category_name(i), menuNameKey) )
- continue;
+ /* SETTING_TRACE("load all the items in config file"); */
+ } else
+ if (safeStrCmp
+ (setting_cfg_get_category_name(i), menuNameKey)) {
+ continue;
}
char *category_name = setting_cfg_get_category_name(i);
}
if (isFoundSelSomeoneItem) {
- elm_object_item_disabled_set(
- elm_toolbar_last_item_get(ad->controllbar_all_check), EINA_FALSE);
+ elm_object_item_disabled_set(elm_toolbar_last_item_get
+ (ad->controllbar_all_check),
+ EINA_FALSE);
} else {
- elm_object_item_disabled_set(
- elm_toolbar_last_item_get(ad->controllbar_all_check), EINA_TRUE);
+ elm_object_item_disabled_set(elm_toolbar_last_item_get
+ (ad->controllbar_all_check),
+ EINA_TRUE);
}
SETTING_TRACE_END;
}
+
+static Setting_GenGroupItem_Data * __flightmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist)
+{
+ // NOT UG --> it's just UI drawing
+
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+ int value, err;
+ setting_get_bool_slp_key (BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
+
+ /* create flight_mode */
+ ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1text_2icon]),
+ NULL,
+ setting_main_click_Gendial_list_flight_mode_cb,
+ ad,
+ SWALLOW_Type_1ICON_1RADIO,
+ icon_path,
+ NULL,
+ value,
+ keyStr,
+ NULL,
+ setting_main_click_list_flight_mode_cb);
+ __BACK_POINTER_SET(ad->data_flight);
+
+ return ad->data_flight;
+}
+
+static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
+{
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+
+ char* pa_wifi = get_pa_Wi_Fi_on_off_str();
+ ad->data_wifi = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1icon_2text]),
+ NULL,
+ setting_main_click_list_ex_ug_cb,
+ ug_args,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL,
+ 0,
+ keyStr,
+ pa_wifi,
+ NULL);
+ __BACK_POINTER_SET(ad->data_wifi);
+ G_FREE(pa_wifi);
+
+ return ad->data_wifi;
+}
+
+static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
+{
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+
+ ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1icon_2text]),
+ NULL,
+ setting_main_click_list_ex_ug_cb,
+ ug_args,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL,
+ 0,
+ keyStr,
+ get_BT_on_off_str
+ (),
+ NULL);
+ __BACK_POINTER_SET(ad->data_bt);
+
+ return ad->data_bt;
+}
+
+static Setting_GenGroupItem_Data * __allshare_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
+{
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+
+ Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_default_ug_cb,
+ ad,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL, 0,
+ keyStr,
+ NULL,
+ NULL);
+ return obj;
+}
+
+static Setting_GenGroupItem_Data * __network_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
+{
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+
+ ad->data_network = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_network_ug_cb,
+ ad,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL, 0,
+ keyStr,
+ NULL,
+ NULL);
+
+ return ad->data_network;
+}
+
+static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
+{
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+
+ ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1icon_2text]),
+ NULL,
+ setting_main_click_list_ex_ug_cb,
+ ug_args,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL,
+ 0,
+ keyStr,
+ get_NFC_on_off_str(),
+ NULL);
+ __BACK_POINTER_SET(ad->data_nfc);
+
+ setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
+ ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
+ NULL, NULL, 0, SETTING_NFC_DESC, NULL, NULL);
+ elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
+ ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ return ad->data_nfc;
+}
+
+static Setting_GenGroupItem_Data * __default_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
+{
+ setting_main_appdata *ad = (setting_main_appdata *)data;
+ Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_ex_ug_cb,
+ ug_args,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL, 0,
+ keyStr,
+ NULL,
+ NULL);
+
+ if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
+ setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
+ ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
+ NULL, NULL, 0, SETTING_WIFI_DIRECT_DESC, NULL, NULL);
+ elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
+ ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ } else {
+ /* do nothing */
+ }
+
+ return obj;
+}
+
+typedef struct mainlist_entry mainlist_entry;
+
+struct mainlist_entry {
+ char* title;
+ Setting_GenGroupItem_Data* (*ui_handler)(void* data, char* title, char* iconpath, char* ugname, Evas_Object *genlist);
+};
+
+
+enum {
+ MAINLIST_ENTRY_FLIGHT_MODE = 0,
+ MAINLIST_ENTRY_WIFI,
+ MAINLIST_ENTRY_BT,
+ MAINLIST_ENTRY_ALLSHARE,
+ MAINLIST_ENTRY_NETWORK,
+ MAINLIST_ENTRY_NFC,
+ MAINLIST_ENTRY_DEFAULT,
+ MAINLIST_ENTRY_MAX,
+};
+
+static mainlist_entry mainlist_table[] = {
+ {KeyStr_FlightMode, __flightmode_handler}, // 0 --> NOT UG
+ {KeyStr_WiFi, __wifi_handler}, // 1 --> UG
+ {KeyStr_Bluetooth, __bluetooth_handler}, // 1 --> UG
+ {KeyStr_AllShare, __allshare_handler}, // NOT UG
+ {KeyStr_Network, __network_handler}, // 1 --> UG
+ {KeyStr_NFC, __nfc_handler}, // 1 --> UG
+ {"Default", __default_handler}, // 1 --> UG
+
+ //--------------------------------------------------------------
+ {NULL, NULL},
+ };
+
+
+// Flight Mode - not UG
+// All share - not UG
+// WiFi - added toggle
+// Bluetooth
+// Mobile AP
+// Network
+// NFC
+// Other UGs
void __load_connectivity_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
{
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = data;
+ //group title, only display in setting main view
+ if (SETTING_VIEW_MAIN == ad->view_load) {
+ setting_create_Gendial_field_group_titleItem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_group_item]),
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ KeyStr_Connectivity, NULL);
+ }
+
+ int idx_second_menu = 0;
char *keyStr = NULL;
char *icon_path = NULL;
Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
int i, j;
+ bool is_emulator = isEmulBin();
+
for (i = 0; i < setting_cfg_get_category_length(); i++) {
if (safeStrCmp
(setting_cfg_get_category_name(i), KeyStr_Connectivity))
for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
keyStr = setting_cfg_get_keyname_idx(i, j);
- tmpPos =
- (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
+ tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
ug_args = setting_cfg_get_ug_args_idx(i, j);
icon_path = setting_cfg_get_icon_path_idx(i, j);
+ /* SETTING_TRACE_DEBUG("Got an item[keyStr:%s, ug_args:%s, pos:%d]", */
+ /* keyStr, ug_args, tmpPos); */
+
+ if (is_emulator) {
+ if (!safeStrCmp(KeyStr_FlightMode, keyStr)) {
+ continue; /* hide Flight Mode in Emulator*/
+ } else if (!safeStrCmp(KeyStr_WiFi, keyStr)) {
+ continue; /* hide WIFI in Emulator*/
+ } else if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
+ continue; /* hide WiFiDirect in Emulator*/
+ } else if (!safeStrCmp(KeyStr_Network, keyStr)) {
+ continue; /* hide Network in Emulator*/
+ } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr)) {
+ continue; /* hide Bluetooth in Emulator*/
+ } else if (!safeStrCmp(KeyStr_MobileAP, keyStr)) {
+ continue; /* hide Tethering in Emulator*/
+ } else {
+ /* do nothing */
+ }
+ }
+
+ if (idx_second_menu < MAX_MORE_MENU_NUM
+ && Cfg_Item_Pos_Level1 == tmpPos
+ && SETTING_VIEW_MAIN == ad->view_load
+ && MAIN_PROFILE_PREFERRED == ad->profile_type) {
+
+ if (is_ug_installed_by_ug_args(ug_args)) {
+ ad->more_connective_menus[idx_second_menu++] = keyStr;
+ }
+ }
+
if (Cfg_Item_Pos_Level_All == inputPos) {
} else if (inputPos != tmpPos) { /* not in the inputPos level */
continue;
}
- if (!safeStrCmp(KeyStr_WiFi, keyStr)) { /* load special icon */
+ if (!safeStrCmp(KeyStr_FlightMode, keyStr)) { /* load special radio */
+ // ug == NULL
+ mainlist_table[MAINLIST_ENTRY_FLIGHT_MODE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
- char* pa_wifi = get_pa_Wi_Fi_on_off_str();
- ad->data_wifi =
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1icon_2text]),
- NULL,
- setting_main_click_list_ex_ug_cb,
- ug_args,
- SWALLOW_Type_INVALID,
- icon_path,
- NULL,
- 0,
- keyStr,
- pa_wifi,
- NULL);
- __BACK_POINTER_SET(ad->data_wifi);
- G_FREE(pa_wifi);
+ } else if (!safeStrCmp(KeyStr_AllShare, keyStr)) { /* NOT UG */
- } else if (!safeStrCmp(KeyStr_MobileAP, keyStr)) { /* load special icon */
- ad->data_mobileApp =
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1icon_2text]),
- NULL,
- setting_main_click_list_ex_ug_cb,
- ug_args,
- SWALLOW_Type_INVALID,
- icon_path,
- NULL,
- 0,
- keyStr,
- get_Mobile_AP_on_off_str
- (),
- NULL);
- __BACK_POINTER_SET(ad->data_mobileApp);
+ mainlist_table[MAINLIST_ENTRY_ALLSHARE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
- } else if (!safeStrCmp(KeyStr_AllShare, keyStr)) { /* load special UG */
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1text_1icon_2]),
- NULL,
- setting_main_click_list_default_ug_cb,
- ad,
- SWALLOW_Type_INVALID,
- icon_path,
- NULL, 0,
- keyStr,
- NULL,
- NULL);
+ } else if (!safeStrCmp(KeyStr_WiFi, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
- } else if (!safeStrCmp(KeyStr_DataRoaming, keyStr)) { /* load special radio */
- /* create chk_data_roaming */
- int value, err;
- setting_get_bool_slp_key
- (BOOL_SLP_SETTING_DATA_ROAMING, &value,
- &err);
- ad->data_roaming =
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1text_2icon]),
- NULL,
- setting_main_sel_list_mouse_up_cb,
- ad,
- SWALLOW_Type_1ICON_1RADIO,
- icon_path,
- NULL,
- value,
- keyStr,
- NULL,
- setting_main_list_mouse_up_cb);
- __BACK_POINTER_SET(ad->data_roaming);
+ mainlist_table[MAINLIST_ENTRY_WIFI].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
- }
- else if (!safeStrCmp(KeyStr_USBconnection, keyStr)) { /* load special lable */
- char* pa_usb_mode = get_pa_usb_connect_mode_str();
- ad->data_usbcon =
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1icon_2text]),
- NULL,
- setting_main_click_list_usb_cb,
- ug_args,
- SWALLOW_Type_INVALID,
- icon_path,
- NULL,
- 0,
- keyStr,
- pa_usb_mode,
- NULL);
- __BACK_POINTER_SET(ad->data_usbcon);
- G_FREE(pa_usb_mode);
+ } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
+ mainlist_table[MAINLIST_ENTRY_BT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
+
+ } else if (!safeStrCmp(KeyStr_Network, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special UG */
+
+ mainlist_table[MAINLIST_ENTRY_NETWORK].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
+
+ } else if (!safeStrCmp(KeyStr_NFC, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
+ int nfc_value = FALSE; //default
+ vconf_get_bool(VCONFKEY_NFC_FEATURE, &nfc_value);
+ if (VCONFKEY_NFC_FEATURE_ON == nfc_value)
+ {
+ mainlist_table[MAINLIST_ENTRY_NFC].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
+ }
+ } else { /* load other UGs */
+ if (is_ug_installed_by_ug_args(ug_args))
+ {
+ mainlist_table[MAINLIST_ENTRY_DEFAULT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
+ }
}
- else { /* load other UGs */
- if(!safeStrCmp(KeyStr_NFC, keyStr))
+ }
+ }
+
+ //end group , only display in setting main view
+#if SUPPORT_MORE_ITEM_FUNCTION
+ if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type && idx_second_menu > 0)
+ {
+ char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
+ int idx = 0;
+ while (idx < MAX_MORE_MENU_NUM && ad->more_connective_menus[idx])
+ {
+ if (idx != 0)
{
- int nfc_value = FALSE; //default
- vconf_get_bool(VCONFKEY_NFC_FEATURE, &nfc_value);
- if (VCONFKEY_NFC_FEATURE_ON != nfc_value) continue;
+ safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
}
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ safeStrNCat(sub_text, _(ad->more_connective_menus[idx]), MAX_COMMON_BUFFER_LEN);
+ idx++;
+ }
+
+ ad->data_moreConnect =
+ setting_create_Gendial_field_groupitem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_2text_3]),
NULL,
- setting_main_click_list_ex_ug_cb,
- ug_args,
+ setting_main_click_list_more_cb,
+ ad,
SWALLOW_Type_INVALID,
- icon_path,
- NULL, 0,
- keyStr,
NULL,
+ NULL,
+ 0,
+ KeyStr_MoreConnect,
+ sub_text,
NULL);
- }
+ __BACK_POINTER_SET(ad->data_moreConnect);
}
- }
-
+#endif
SETTING_TRACE_END;
}
SETTING_TRACE_BEGIN;
SETTING_TRACE_DEBUG("pos :%d", inputPos);
setting_main_appdata *ad = data;
+ //group title, only display in setting main view
+ if (SETTING_VIEW_MAIN == ad->view_load) {
+ setting_create_Gendial_field_group_titleItem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_group_item]),
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ KeyStr_System, NULL);
+ }
+ int idx_second_menu = 0;
+
char *keyStr = NULL;
char *icon_path = NULL;
char *ug_args = NULL;
Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
+ int ncount = 0;
int i, j;
+
+ bool is_emulator = isEmulBin();
+
+ //SETTING_TRACE("setting_cfg_get_category_length() :: %d ", setting_cfg_get_category_length());
for (i = 0; i < setting_cfg_get_category_length(); i++) {
if (safeStrCmp(setting_cfg_get_category_name(i), KeyStr_System))
continue;
+ //SETTING_TRACE(" setting_cfg_get_menu_length(%d) :: %d ",i, setting_cfg_get_menu_length(i) );
for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
keyStr = setting_cfg_get_keyname_idx(i, j);
- tmpPos =
- (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
+ /* sg_path = setting_cfg_get_ugpath_idx(i, j); */
+ tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
icon_path = setting_cfg_get_icon_path_idx(i, j);
ug_args = setting_cfg_get_ug_args_idx(i, j);
+ //SETTING_TRACE("KeyString : %s , tmpPos : %d , inputPos : %d ", keyStr, tmpPos, inputPos );
+
+ if (is_emulator) {
+ if (!safeStrCmp(KeyStr_Security, keyStr)) {
+ continue; /* hide Security in Emulator*/
+ } else if (!safeStrCmp(KeyStr_Motions, keyStr)) {
+ continue; /* hide Motion in Emulator*/
+ } else if (!safeStrCmp(KeyStr_Accessibility, keyStr)) {
+ continue; /* hide Accessibility in Emulator*/
+ } else if (!safeStrCmp(KeyStr_Memory, keyStr)) {
+ continue; /* hide Memory in Emulator*/
+ } else if (!safeStrCmp(KeyStr_Powersaving, keyStr)) {
+ continue; /* hide Powersaving in Emulator*/
+ } else {
+ /* do nothing */
+ }
+ }
+
+ if (idx_second_menu < MAX_MORE_MENU_NUM
+ && Cfg_Item_Pos_Level1 == tmpPos
+ && SETTING_VIEW_MAIN == ad->view_load
+ && MAIN_PROFILE_PREFERRED == ad->profile_type) {
+
+ if (is_ug_installed_by_ug_args(ug_args)) {
+ ad->more_system_menus[idx_second_menu++] = keyStr;
+ }
+ }
+
if (Cfg_Item_Pos_Level_All == inputPos) {
+ // do nothing
+ //SETTING_TRACE("Cfg_Item_Pos_Level_All == inputPos ---> no draw --- WHY?? ");
} else if (inputPos != tmpPos) { /* not in the inputPos level */
+ //SETTING_TRACE("inputPos == tmp Pos ---> no draw --- WHY?? ");
continue;
}
+
if (!safeStrCmp(KeyStr_Landscape, keyStr)) { /* load special UG */
int value = 0;
vconf_get_bool
(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
+ // true : auto rotation OFF
+ // false : auto rotation ON
+ value = !value;
+
ad->data_rotationMode =
setting_create_Gendial_field_groupitem(genlist,
&(ad->itc[GENDIAL_Type_1text_2icon]),
setting_main_list_mouse_up_cb);
__BACK_POINTER_SET(ad->data_rotationMode);
}
- else if (!safeStrCmp(KeyStr_Theme, keyStr)) {
+ else if (!safeStrCmp(KeyStr_Brightness, keyStr)) {
- char* pa_theme = get_pa_theme_name_str();
- ad->data_theme =
+ char* pa_bright = get_brightness_mode_str();
+ ad->data_bright=
setting_create_Gendial_field_groupitem(genlist,
&(ad->itc[GENDIAL_Type_1icon_2text]),
NULL,
NULL,
0,
keyStr,
- pa_theme,
+ pa_bright,
NULL);
- __BACK_POINTER_SET(ad->data_theme);
- G_FREE(pa_theme);
+ __BACK_POINTER_SET(ad->data_bright);
+ ncount++;
+ }
+ else { /* load other UGs */
- } else { /* load other UGs */
- setting_create_Gendial_field_groupitem(genlist,
- &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ if (is_ug_installed_by_ug_args(ug_args))
+ {
+ setting_create_Gendial_field_groupitem(genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_ex_ug_cb,
+ ug_args,
+ SWALLOW_Type_INVALID,
+ icon_path,
+ NULL, 0,
+ keyStr,
+ NULL,
+ NULL);
+ ncount++;
+ }
+ }
+ }
+ }
+ //end group, only display in setting main view
+#if SUPPORT_MORE_ITEM_FUNCTION
+ if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type && idx_second_menu > 0)
+ {
+ char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
+ int idx = 0;
+ while (idx < MAX_MORE_MENU_NUM && ad->more_system_menus[idx])
+ {
+ if (idx != 0)
+ {
+ safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
+ }
+ safeStrNCat(sub_text, _(ad->more_system_menus[idx]), MAX_COMMON_BUFFER_LEN);
+ idx++;
+ }
+
+ ad->data_moreSystem =
+ setting_create_Gendial_field_groupitem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_2text_3]),
NULL,
- setting_main_click_list_ex_ug_cb,
- ug_args,
+ setting_main_click_list_more_cb,
+ ad,
SWALLOW_Type_INVALID,
- icon_path,
- NULL, 0,
- keyStr,
NULL,
+ NULL,
+ 0,
+ KeyStr_MoreSystem,
+ sub_text,
NULL);
- }
+ __BACK_POINTER_SET(ad->data_moreSystem);
}
- }
-
+#endif
}
-void __load_system_level0_list(void *data)
+static void __load_system_level0_list(void *data)
{
setting_main_appdata *ad = data;
__load_system_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
}
-void __load_system_level_all_list(void *data)
+static void __load_system_level_all_list(void *data)
{
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = data;
__load_system_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
}
-void __load_applications_menu_list(void *data, Cfg_Item_Position inputPos)
+static void __load_applications_menu_list(void *data,
+ Cfg_Item_Position inputPos)
{
SETTING_TRACE_BEGIN;
SETTING_TRACE_DEBUG("pos :%d", inputPos);
setting_main_appdata *ad = data;
+ bool is_emulator = isEmulBin();
+
+ //group title
+ setting_create_Gendial_field_group_titleItem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_group_item]),
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ KeyStr_Applications, NULL);
char *keyStr = NULL;
char *icon_path = NULL;
char *ug_args = NULL;
continue;
}
+ if (is_emulator) {
+ /* hide all except Email */
+ if (safeStrCmp(KeyStr_Email, keyStr)) {
+ continue;
+ } else {
+ /* do nothing */
+ }
+ }
+
setting_create_Gendial_field_groupitem(ad->main_genlist,
&(ad->itc[GENDIAL_Type_1text_1icon_2]),
NULL,
SETTING_TRACE_END;
}
-void __load_applications_level0_list(void *data)
+static void __load_applications_level0_list(void *data)
{
setting_main_appdata *ad = data;
__load_applications_menu_list(ad, Cfg_Item_Pos_Level0);
}
-void __load_applications_level_all_list(void *data)
+static void __load_applications_level_all_list(void *data)
{
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = data;
__load_applications_menu_list(ad, Cfg_Item_Pos_Level_All);
}
-void __load_downloaded_apps_menu_list(void *data, Cfg_Item_Position inputPos)
+bool is_3rdapp_installed_setting_cfg(char* pkgname)
+{
+ SETTING_TRACE_BEGIN;
+ // /usr/apps/
+ char path[512];
+
+ if (snprintf(path, 512, "/usr/apps/%s/setting/setting.xml", pkgname) < 0)
+ return false;
+
+ struct stat st;
+ bool result_opt = false;
+
+ if(stat(path, &st) == 0) {
+ result_opt = true;
+ } else {
+ SETTING_TRACE_ERROR(" %s is *NOT* present\n", path);
+ result_opt = false;
+ }
+
+ return result_opt;
+}
+
+
+/**
+ * @param data
+ */
+static void draw_3rdapp(void* data, char* name, char* pkgname)
+{
+ SETTING_TRACE_BEGIN;
+ SETTING_TRACE(" name : %s", name);
+ SETTING_TRACE(" pkgname : %s", pkgname);
+
+ setting_main_appdata *ad = data;
+
+ //3rd cfg
+ char fullpath[512];
+
+ if (snprintf(fullpath, 512, "/usr/apps/%s/setting/setting.xml", pkgname) < 0)
+ return false;
+
+ SETTING_TRACE(" fullpath : %s", fullpath);
+
+ if (ad)
+ {
+ if (ad->plugin_path)
+ {
+ free(ad->plugin_path);
+ ad->plugin_path = NULL;
+ }
+ ad->plugin_path = strdup(fullpath);
+
+ setting_create_Gendial_field_groupitem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_plugin_cb,
+ ad,
+ SWALLOW_Type_INVALID,
+ IMG_DefaultIcon, NULL,
+ 0, name, NULL,
+ NULL);
+ }
+ SETTING_TRACE_END;
+}
+
+/**
+ *
+ * ail code here
+ */
+static ail_cb_ret_e __download_apps_cb(ail_appinfo_h ai, void* data)
+{
+ DrawAppInfo* pinfo = (DrawAppInfo*)data;
+ char *id;
+
+ if (AIL_ERROR_OK == ail_appinfo_get_str(ai, AIL_PROP_PACKAGE_STR, &id))
+ {
+ //SETTING_TRACE(" 3rd party - app name : ----> %s ", id);
+ }
+
+ ail_appinfo_h handle;
+
+ char *name = NULL;
+ char *icon = NULL;
+ int installed_time;
+ bool nodisplay = false;
+ bool removable = true;
+
+ if (AIL_ERROR_OK == ail_package_get_appinfo(id, &handle))
+ {
+ if (AIL_ERROR_OK != ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &name))
+ SETTING_TRACE("cannot get name");
+
+ if (AIL_ERROR_OK != ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &icon))
+ SETTING_TRACE("cannot get icon");
+
+ if (AIL_ERROR_OK != ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &nodisplay))
+ SETTING_TRACE("cannot get nodisplay");
+
+ if (AIL_ERROR_OK != ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_REMOVABLE_BOOL, &removable))
+ SETTING_TRACE("cannot get removable");
+
+ if (AIL_ERROR_OK != ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT, &installed_time))
+ SETTING_TRACE("cannot get installed_time");
+
+ //SETTING_TRACE("installed_time = %d ", installed_time);
+ if (installed_time != 0 && is_3rdapp_installed_setting_cfg(id) == true )
+ {
+ SETTING_TRACE(" 3rd party - app name : ----> id : %s --- name : %s ", id, name);
+ SETTING_TRACE(" 3rd party - icon : ----> %s ", icon);
+ SETTING_TRACE(" 3rd party - nodisplay : ----> %d ", nodisplay);
+ pinfo->ncount++;
+
+ // draw code here
+ if (pinfo->draw_app != NULL)
+ {
+ SETTING_TRACE(">>> pkg name --> %s ", id);
+ pinfo->draw_app(pinfo->data, strdup(name)/* appname*/, strdup(id)/* pkg_name*/);
+ }
+ }
+ }
+ SETTING_TRACE_END;
+ return AIL_CB_RET_CONTINUE;
+}
+
+
+/**
+ * get 3rd party applist from AIL & searching dir/file by the defined rule
+ * @param data ad
+ * if data is NULL --> just get how many items are there
+ * if data is NOT NULL --> draw UI code
+ */
+static int get_downloadapp_list(void* data)
+{
+ SETTING_TRACE_BEGIN;
+
+ setting_main_appdata *ad = data;
+
+ int ncount = 0;
+ ail_filter_h f;
+ ail_appinfo_h handle;
+
+ DrawAppInfo* pinfo = (DrawAppInfo*)malloc(sizeof(DrawAppInfo));
+ pinfo->ncount = 0;
+ pinfo->draw_app = draw_3rdapp;
+ pinfo->data = ad;
+
+ if (ail_filter_new(&f) == AIL_ERROR_OK)
+ {
+ if (ail_filter_add_bool(f, AIL_PROP_NODISPLAY_BOOL, false) != AIL_ERROR_OK)
+ {
+ SETTING_TRACE("ail filter error");
+ return;
+ }
+
+ ail_filter_list_appinfo_foreach(f, __download_apps_cb, pinfo);
+ //---------------------------------------------------------------
+ ail_filter_destroy(f);
+ }
+ ncount = pinfo->ncount;
+
+ if (pinfo) {
+ free(pinfo);
+ pinfo = NULL;
+ }
+
+ SETTING_TRACE_END;
+ return ncount;
+}
+
+static int __get_downloaded_apps_num(Cfg_Item_Position inputPos)
+{
+ SETTING_TRACE_BEGIN;
+ SETTING_TRACE_DEBUG("pos :%d", inputPos);
+ int downloaded_apps_num = 0;
+ Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
+ int i, j;
+ for (i = 0; i < setting_cfg_get_category_length(); i++) {
+ if (safeStrCmp
+ (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
+ continue;
+
+ for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
+ tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
+ if (Cfg_Item_Pos_Level_All == inputPos) {
+ } else if (inputPos != tmpPos) { /* not in the inputPos level */
+ continue;
+ }
+
+ downloaded_apps_num++;
+ }
+ }
+
+ // draw UI with AUL code
+#ifdef PLUGIN
+ downloaded_apps_num = get_downloadapp_list(NULL);
+ SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
+#endif
+
+ return downloaded_apps_num;
+}
+
+
+static void __load_downloaded_apps_menu_list(void *data,
+ Cfg_Item_Position inputPos)
{
SETTING_TRACE_BEGIN;
SETTING_TRACE_DEBUG("pos :%d", inputPos);
setting_main_appdata *ad = data;
+ // if the number of download apps is zero, display a bottom seperator
+ if (0 == __get_downloaded_apps_num(inputPos)) {
+ Elm_Object_Item *item = NULL;
+ item = elm_genlist_item_append(ad->main_genlist, &itc_bottom_seperator, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ return;
+ }
+
+ //group title
+ setting_create_Gendial_field_group_titleItem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_group_item]),
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ KeyStr_DownloadedAPPs,
+ NULL);
+#if DISABLED_CODE
char *keyStr = NULL;
char *icon_path = NULL;
char *ug_args = NULL;
}
}
+#endif
+
+
+ //#ifdef PLUGIN
+ #if 0
+ //3rd cfg
+ DIR *dp = opendir (PLUGIN_CFG_DIR);
+ if (dp != NULL)
+ {
+ struct dirent *ep;
+
+ char fullpath[256];
+
+ while (ep = readdir (dp))
+ {
+ memset(fullpath, 0x00, 256);
+ strncpy(fullpath, PLUGIN_CFG_DIR, 256);
+ strncat(fullpath, "/", 256);
+ strncat(fullpath, ep->d_name, 256);
+
+ //SETTING_TRACE("ep->d_name:%s", ep->d_name);
+ if (0 == safeStrCmp(".", ep->d_name)
+ || 0 == safeStrCmp("..", ep->d_name))
+ {
+ continue;
+ }
+ SETTING_TRACE("fullpath: %s", fullpath);
+ char *p = strrchr(ep->d_name, '.');
+ *p = '\0';
+ setting_create_Gendial_field_groupitem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_plugin_cb,
+ strdup(fullpath),
+ SWALLOW_Type_INVALID,
+ IMG_DefaultIcon, NULL,
+ 0, ep->d_name, NULL,
+ NULL);
+
+ }
+ (void) closedir (dp);
+ }
+ #else
+ // TODO: DRAW 3RD PARTY APPS LIST here with EFL code
+ int downloaded_apps_num = get_downloadapp_list(ad);
+
+ // loop condition : 0 ---> ncount
+ //
+
+ #endif
SETTING_TRACE_END;
}
-void __load_downloaded_apps_level0_list(void *data)
+static void __load_downloaded_apps_level0_list(void *data)
{
setting_main_appdata *ad = data;
__load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level0);
}
-void __load_downloaded_apps_level_all_list(void *data)
+static void __load_downloaded_apps_level_all_list(void *data)
{
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = data;
__load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level_All);
}
-void __check_all_view_clear(void *data)
+static void __check_all_view_clear(void *data)
{
SETTING_TRACE_BEGIN;
ret_if(!data);
}
ad->gl_sel_all = NULL;
- ad->all_check_genlist = NULL;
+ ad->edit_preferred_genlist = NULL;
ad->controllbar_all_check = NULL;
ad->check_all_item =NULL;
}
-void __setting_sk_cb(void *data, Evas_Object *obj, void *event_info)
+static void __prefered_buttons_cb(void *data, Evas_Object *obj, void *event_info)
{
SETTING_TRACE_BEGIN;
ret_if(!data);
setting_main_appdata *ad = (setting_main_appdata *) data;
const char *key = NULL;
+
+ #if SUPPORT_BOTTOM_BTNS
ret_if(!event_info);
Elm_Object_Item *it = event_info;
key = elm_object_item_text_get(it);
- setting_retm_if(data == NULL || key == NULL, "data == NULL || key == NULL");
+ #else
+ key = elm_object_text_get(obj);
+ #endif
+ setting_retm_if(data == NULL
+ || key == NULL, "data == NULL || key == NULL");
SETTING_TRACE_DEBUG("press button: %s", key);
+ // "Done"
if (!safeStrCmp(key, dgettext("sys_string", "IDS_COM_SK_DONE"))) {
- SETTING_TRACE("ad->profile_typ: %d", ad->profile_type);
+
if (ad->profile_type == MAIN_PROFILE_ALL) {
SETTING_TRACE_DEBUG("Cancel to hide current view.");
setting_try_save_check_list(ad); /* need to save too */
__check_all_view_clear(ad);
- elm_naviframe_item_pop(ad->navibar_main);
+ elm_naviframe_item_pop(ad->navibar_main); // pop(preferred) --> main
return;
}
+ // MAIN_PROFILE_PREFERRED and Etc
+ // redraw setting-main
setting_try_save_check_list(ad);
- elm_naviframe_item_pop(ad->navibar_main);
+ elm_naviframe_item_pop(ad->navibar_main); // pop (preferred) -> main
+
//After the view is popuped, all the object handlers should be reset NULL.
__check_all_view_clear(ad);
- ad->load_fns[Func_Type_Connectivity] =
- __load_connectivity_level0_list;
+ ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
ad->load_fns[Func_Type_System] = __load_system_level0_list;
ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
- ad->load_fns[Func_Type_DownApp] =
- __load_downloaded_apps_level0_list;
+ ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
int ret = setting_main_refresh(ad);
ret_if(ret != SETTING_RETURN_SUCCESS);
return;
}
+ // "Cancel"
if (!safeStrCmp(key, setting_gettext("IDS_COM_SK_CANCEL"))
|| !safeStrCmp(key, dgettext("sys_string", "IDS_COM_BODY_BACK"))) {
SETTING_TRACE_DEBUG("Cancel to hide current view.");
}
}
-void __setting_contorlbar_clicked(void *data, Evas_Object *obj,
+static void __setting_contorlbar_clicked(void *data, Evas_Object *obj,
void *event_info)
{
SETTING_TRACE_BEGIN;
ret_if(data == NULL || obj == NULL);
setting_main_appdata *ad = (setting_main_appdata *) data;
int index = -1;
+ /* elm_segment_control_selected_segment_get(obj, &index); */
Elm_Object_Item *sel_item = elm_segment_control_item_selected_get(obj);
ret_if(sel_item == NULL);
index = elm_segment_control_item_index_get(sel_item);
ret_if(ret != SETTING_RETURN_SUCCESS);
}
-void _btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ ret_if(!data);
+ setting_main_appdata *ad = (setting_main_appdata *) data;
+ elm_win_lower(ad->win_main);
+}
+
+static Eina_Bool __refresh_on_idle(void *data)
+{
+ SETTING_TRACE_BEGIN;
+ retv_if(!data, FALSE);
+ setting_main_appdata *ad = data;
+ if (MAIN_PROFILE_ALL == ad->profile_type)
+ {
+ ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
+ ad->load_fns[Func_Type_System] = __load_system_level_all_list;
+ ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
+ ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
+ setting_main_refresh(ad);
+ }
+ else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
+ {
+ ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
+ ad->load_fns[Func_Type_System] = __load_system_level0_list;
+ ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
+ ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
+ setting_main_refresh(ad);
+ }
+ ad->refresh_idler = NULL;
+ return FALSE;
+}
+
+static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info)
{
SETTING_TRACE_BEGIN;
- Evas_Object *win = (Evas_Object *) data;
- elm_win_lower(win);
+ ret_if(!data || !obj);
+ setting_main_appdata *ad = (setting_main_appdata *) data;
+ //if already has the task,cancel the old task with ecore_idler_del,then add new idler task.
+ if (ad->refresh_idler) {
+ ecore_idler_del(ad->refresh_idler);
+ ad->refresh_idler = NULL;
+ }
+
+ Elm_Object_Item *item = elm_toolbar_first_item_get(obj);
+ ret_if(!item);
+ if (MAIN_PROFILE_ALL == ad->profile_type)
+ {
+ SETTING_TRACE("Change to Preferred view");
+ elm_object_item_text_set(item, _(ALL_STR));
+ ad->profile_type = MAIN_PROFILE_PREFERRED;
+ }
+ else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
+ {
+ SETTING_TRACE("Change to ALL view");
+ elm_object_item_text_set(item, _(PREFERRED_STR));
+ ad->profile_type = MAIN_PROFILE_ALL;
+ }
+ else
+ {
+ return;
+ }
+ ad->refresh_idler = ecore_idler_add((Ecore_Task_Cb) __refresh_on_idle, ad);
}
+/**
+ * creat a layout
+ */
Evas_Object *__create_main_view_widgets(Evas_Object *win_main, void *cb,
- Evas_Object *scrl_obj,
+ Evas_Object *content,
char *title_text,
bool isFoundPreferredItem,
Evas_Object **navibar,
// create 'back' button on navigaiton bar
Evas_Object* btn_back = elm_button_add(navi_bar);
- evas_object_smart_callback_add(btn_back, "clicked", _btnback_clicked_cb, win_main);
+ evas_object_smart_callback_add(btn_back, "clicked", __btnback_clicked_cb, g_main_ad);
Evas_Object *controlbar = elm_toolbar_add(navi_bar);
setting_retvm_if(controlbar == NULL, FALSE, "controlbar == NULL");
elm_toolbar_shrink_mode_set(controlbar, ELM_TOOLBAR_SHRINK_EXPAND);
- elm_object_style_set(controlbar, NAVI_CONTROLBAR_STYLE);
+ //elm_object_style_set(controlbar, NAVI_CONTROLBAR_STYLE);
/* add segment control */
- Evas_Object *segment = elm_segment_control_add(ly);
- SETTING_TRACE("segment:%p", segment);
- Elm_Object_Item *item1, *item2;
- *segment_preferred = item1 =
- elm_segment_control_item_add(segment, NULL, _(PREFERRED_STR));
- *segment_all = item2 =
- elm_segment_control_item_add(segment, NULL, _(ALL_STR));
+ Evas_Object *segment = elm_segment_control_add(controlbar);
+ setting_retvm_if(segment == NULL, FALSE, "segment == NULL");
+
+ Elm_Object_Item *seg_preferred = NULL, *seg_all = NULL;
+ *segment_preferred = seg_preferred = elm_segment_control_item_add(segment, NULL, _(PREFERRED_STR));
+ *segment_all = seg_all = elm_segment_control_item_add(segment, NULL, _(ALL_STR));
evas_object_show(segment);
evas_object_smart_callback_add(segment, "changed",
__setting_contorlbar_clicked, cb);
- Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, scrl_obj, "segment/instant");
+ #if !SUPPORT_BOTTOM_BTNS
+ Elm_Object_Item *item = NULL;
+ Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, content, NULL);
+ elm_object_style_set(btn_back, NAVI_BACK_BUTTON_STYLE);
+ /* add 'Edit preffered' button to controlbar */
+ Evas_Object *btn_pref = setting_create_button(controlbar, _(EDIT_PREFERRED_STR),
+ NAVI_DEF_BUTTON_STYLE,
+ setting_main_click_edit_preferred_cb,cb);
+
+ *edit_item = elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
+ elm_object_item_part_content_set(*edit_item, "object", btn_pref);
+ item = elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
+ elm_object_item_part_content_set(item, "object", segment);
+ elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
+
+ elm_object_item_part_content_set(navi_it, "optionheader", controlbar);
+ #else
+ Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, content, "segment/instant");
elm_object_style_set(btn_back, NAVI_BACK_BUTTON_STYLE);
elm_object_item_disabled_set(elm_toolbar_item_append(controlbar, NULL, "", NULL, NULL), EINA_TRUE);
- *edit_item = elm_toolbar_item_append(controlbar, NULL, _(EDIT_PREFERRED_STR), setting_main_click_add_all_cb, cb);
+ *edit_item = elm_toolbar_item_append(controlbar, NULL, _(EDIT_PREFERRED_STR), setting_main_click_edit_preferred_cb, cb);
elm_object_item_part_content_set(navi_it, "controlbar", controlbar);
- elm_object_item_part_content_set(navi_it, "segment2", segment);
+ elm_object_item_part_content_set(navi_it, "segment", segment);
+ #endif
+
if (isFoundPreferredItem) {
- elm_segment_control_item_selected_set(item1, EINA_TRUE);
+ elm_segment_control_item_selected_set(seg_preferred, EINA_TRUE);
} else {
- elm_segment_control_item_selected_set(item2, EINA_TRUE);
+ elm_segment_control_item_selected_set(seg_all, EINA_TRUE);
}
return ly;
}
-bool __setting_create_main_view(void *data)
+static bool __setting_create_main_view(void *data)
{
SETTING_TRACE_BEGIN;
/* error check */
setting_retvm_if(data == NULL, FALSE, "data == NULL");
setting_main_appdata *ad = (setting_main_appdata *) data;
+#if SUPPORT_MORE_ITEM_FUNCTION
+ ad->ly_main = setting_create_win_layout(ad->win_main, ad->win_main);
+ ad->navibar_main = setting_create_navi_bar(ad->ly_main);
+ /* add controlbar */
+ Evas_Object *controlbar = elm_toolbar_add(ad->navibar_main);
+ setting_retvm_if(controlbar == NULL, FALSE, "controlbar == NULL");
+ elm_toolbar_shrink_mode_set(controlbar, ELM_TOOLBAR_SHRINK_EXPAND);
+
+ ad->main_genlist = elm_genlist_add(ad->navibar_main);
+ elm_object_style_set(ad->main_genlist, "dialogue");
+ retvm_if(ad->main_genlist == NULL, FALSE,
+ "Cannot set scroller object as contento of layout");
+ elm_genlist_clear(ad->main_genlist); /* first to clear list */
+
+ setting_create_navi_bar_buttons(_("IDS_COM_BODY_SETTINGS"),
+ _("IDS_COM_BODY_BACK"), "", _("IDS_ST_OPT_ALL"),
+ __btnback_clicked_cb, NULL,
+ __allFrequent_btn_cb, ad, ad->main_genlist,
+ ad->navibar_main, controlbar);
+ elm_object_item_disabled_set(elm_toolbar_last_item_get(controlbar), EINA_TRUE);
+
+ ad->controlbar = controlbar;
+
+ ad->profile_type = MAIN_PROFILE_PREFERRED;
+ ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
+ ad->load_fns[Func_Type_System] = __load_system_level0_list;
+ ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
+ ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
+ setting_main_refresh(ad);
+ return TRUE;
+#endif
ad->main_genlist = elm_genlist_add(ad->win_main);
+ elm_object_style_set(ad->main_genlist, "dialogue");
elm_genlist_clear(ad->main_genlist); /* first to clear list */
int i, j, pos;
int isFoundPreferredItem = FALSE;
return TRUE;
}
-bool __setting_create_prefered_view(void *data)
+static bool __setting_create_prefered_view(void *data)
{
SETTING_TRACE_BEGIN;
/* error check */
setting_main_appdata *ad = (setting_main_appdata *) data;
/* the genlist will be destroyed with its parent view, when using elm_naviframe_item_pop() to destroy the view. */
- ad->all_check_genlist = elm_genlist_add(ad->win_main);
- elm_genlist_clear(ad->all_check_genlist); /* first to clear list */
+ ad->edit_preferred_genlist = elm_genlist_add(ad->win_main);
+ elm_object_style_set(ad->edit_preferred_genlist, "dialogue");
+ elm_genlist_clear(ad->edit_preferred_genlist); /* first to clear list */
/* [UI] edit preffered view */
Evas_Object *sub_layout = elm_layout_add(ad->win_main);
- elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME,
- "search_layout");
+ elm_object_style_set(sub_layout, "dialogue");
+ elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
evas_object_show(sub_layout);
elm_genlist_clear(ad->gl_sel_all); /* first to clear list */
elm_genlist_bounce_set(ad->gl_sel_all, 0, 0);
- elm_object_part_content_set(sub_layout, "search_list", ad->all_check_genlist); /* add Genlist */
elm_object_part_content_set(sub_layout, "search_bar", ad->gl_sel_all); /* add 'Select all' */
+ elm_object_part_content_set(sub_layout, "search_list", ad->edit_preferred_genlist); /* add Genlist */
/* push, not create */
setting_push_layout_navi_bar(_(EDIT_PREFERRED_STR),
_("IDS_COM_SK_CANCEL"),
_("IDS_COM_SK_DONE"), NULL,
- __setting_sk_cb, __setting_sk_cb, NULL, ad,
+ __prefered_buttons_cb, __prefered_buttons_cb, NULL, ad,
sub_layout, ad->navibar_main,
&(ad->controllbar_all_check));
SETTING_TRACE_END;
return TRUE;
}
-int setting_main_refresh(void *data)
+static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
{
SETTING_TRACE_BEGIN;
- setting_main_appdata *ad = (setting_main_appdata *) data;
- /* elm_box_clear(ad->box); ***first to clear list */
- SETTING_TRACE("ad->main_genlist:%p", ad->main_genlist);
+ ret_if(!user_data);
+ setting_main_appdata *ad = user_data;
+ ad->b_fm_requesting = FALSE;
+ SETTING_TRACE("result:%d", result);
- elm_genlist_clear(ad->main_genlist); /* first to clear list */
+ int err = 0;
+ switch (result) {
+ case TAPI_POWER_FLIGHT_MODE_RESP_ON:
- /* add connectivity group */
- setting_create_Gendial_field_group_titleItem(ad->main_genlist,
- &(ad->itc[GENDIAL_Type_group_item]),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- KeyStr_Connectivity, NULL);
- (ad->load_fns[Func_Type_Connectivity]) (ad);
+ setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
+ SETTING_ON_OFF_BTN_ON, &err);
- /* add System */
- setting_create_Gendial_field_group_titleItem(ad->main_genlist,
- &(ad->itc[GENDIAL_Type_group_item]),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- KeyStr_System, NULL);
- (ad->load_fns[Func_Type_System]) (ad);
+ //If Setting has validate operation (fm_waiting_op == FM_LEAVE) to process, process it.
+ //Otherwise, do nothing
+ if (FM_LEAVE == ad->fm_waiting_op)
+ {
+ //Send the latest operation
+ ad->fm_waiting_op = FM_INVALID;
+ err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
+ setting_retm_if(err != TAPI_API_SUCCESS,
+ "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
- /* add Application */
- setting_create_Gendial_field_group_titleItem(ad->main_genlist,
- &(ad->itc[GENDIAL_Type_group_item]),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- KeyStr_Applications, NULL);
- (ad->load_fns[Func_Type_Apps]) (ad);
+ //sucessfully sent,
+ ad->b_fm_requesting = TRUE;
- /* add Downloaded Apps group */
- setting_create_Gendial_field_group_titleItem(ad->main_genlist,
- &(ad->itc[GENDIAL_Type_group_item]),
- NULL,
- ELM_GENLIST_ITEM_NONE,
- KeyStr_DownloadedAPPs,
- NULL);
- (ad->load_fns[Func_Type_DownApp]) (ad);
+ }
+ break;
- memset(ad->load_fns, 0, Func_Type_MAX *sizeof(menu_list_load_fn));
+ case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
+
+ setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
+ SETTING_ON_OFF_BTN_OFF, &err);
+
+ //If Setting has validate operation (here, fm_waiting_op == FM_ENTER) to process,process it.
+ //Otherwise, do nothing
+ if (FM_ENTER == ad->fm_waiting_op)
+ {
+ //Send the latest operation
+ ad->fm_waiting_op = FM_INVALID;
+ err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
+ setting_retm_if(err != TAPI_API_SUCCESS,
+ "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
+
+ //sucessfully sent,
+ ad->b_fm_requesting = TRUE;
+ }
+
+ break;
+
+ case TAPI_POWER_FLIGHT_MODE_RESP_FAIL:
+ //Setting has a validate operation to process, Send the operation request
+ if (FM_ENTER == ad->fm_waiting_op)
+ {
+ ad->fm_waiting_op = FM_INVALID;
+ err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
+
+ setting_retm_if(err != TAPI_API_SUCCESS,
+ "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
+ ad->b_fm_requesting = TRUE;
+ }
+ else if (FM_LEAVE == ad->fm_waiting_op)
+ {
+ ad->fm_waiting_op = FM_INVALID;
+ err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
+
+ setting_retm_if(err != TAPI_API_SUCCESS,
+ "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
+ ad->b_fm_requesting = TRUE;
+ }
+ else //Current requset is the last one, Setting needs to notify user
+ {
+ setting_create_popup_without_btn(ad, ad->win_main,
+ _("IDS_COM_POP_ERROR"),
+ _("IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA"),
+ NULL, POPUP_INTERVAL,
+ FALSE, FALSE);
+
+ //It is need to rollback the status,
+ if (ad->data_flight) {
+ ad->data_flight->chk_status = !ad->data_flight->chk_status;
+ elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
+ }
+ return;
+ }
+
+ //sucessfully sent,
+ ad->b_fm_requesting = TRUE;
+
+ break;
+
+ case TAPI_POWER_FLIGHT_MODE_RESP_MAX:
+ setting_create_popup_without_btn(ad, ad->win_main,
+ _("IDS_COM_POP_ERROR"),
+ _("IDS_COM_POP_UNEXPECTED_ERROR"),
+ NULL, POPUP_INTERVAL, FALSE, FALSE);
+
+ //It is need to rollback the status,
+ if (ad->data_flight) {
+ ad->data_flight->chk_status = !ad->data_flight->chk_status;
+ elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
+ }
+ break;
+ default:
+ /* do nothing */
+ break;
+ }
+ return;
+}
+
+static int setting_main_refresh(void *data)
+{
+ SETTING_TRACE_BEGIN;
+ setting_main_appdata *ad = (setting_main_appdata *) data;
+ elm_genlist_clear(ad->main_genlist); /* first to clear list */
+
+ if (is_ug_installed_by_ug_args("rcs-config"))
+ {
+ Elm_Object_Item *item = elm_genlist_item_append(ad->main_genlist, &itc_seperator, NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ setting_create_Gendial_field_groupitem(ad->main_genlist,
+ &(ad->itc[GENDIAL_Type_1text_1icon_2]),
+ NULL,
+ setting_main_click_list_ex_ug_cb,
+ "rcs-config",
+ SWALLOW_Type_INVALID,
+ IMG_Joyn, NULL,
+ 0, KeyStr_Joyn, NULL,
+ NULL);
+ }
+ int i;
+ for(i = Func_Type_Connectivity; i < Func_Type_MAX; i++)
+ (ad->load_fns[i]) (ad);
+
+ memset(ad->load_fns, 0, Func_Type_MAX *sizeof(menu_list_load_fn));
SETTING_TRACE_END;
return SETTING_RETURN_SUCCESS;
}
-int setting_main_create(void *cb)
+static int setting_main_create(void *cb)
{
retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
setting_main_appdata *ad = (setting_main_appdata *) cb;
g_main_ad = ad;
-
+ //pass NULL to let TAPI access default module
+ ad->handle = tel_init(NULL);
+ if (!ad->handle) {
+ SETTING_TRACE_ERROR("*** [ERR] tel_init failed ***");
+ } else {
+ SETTING_TRACE("tel_init ok[handle:%p]", ad->handle);
+ }
setting_create_Gendial_itc("dialogue/1text.1icon.2",
&(ad->itc[GENDIAL_Type_1text_1icon_2]));
setting_create_Gendial_itc("dialogue/1text.2icon",
setting_create_Gendial_itc("select_all",
&(ad->itc[GENDIAL_Type_sel_all]));
+ setting_create_Gendial_itc("dialogue/2text.3", &(ad->itc[GENDIAL_Type_2text_3]));
+
ad->view_type = SETTING_VIEW_MAIN;
- __setting_create_main_view(ad);
+ bool ret = __setting_create_main_view(ad);
+ SETTING_TRACE(" >>>> ret = %d ", ret);
setting_view_main.is_create = 1;
return SETTING_RETURN_SUCCESS;
}
-int setting_main_destroy(void *cb)
+static int setting_main_destroy(void *cb)
{
SETTING_TRACE_BEGIN;
/* error check */
//already not exsit
return SETTING_RETURN_SUCCESS;
}
-
- /* first to delete event handler on UI objects */
- int tapi_ret = tel_deregister_event(subs_id_main);
- if (tapi_ret != TAPI_API_SUCCESS) {
- SETTING_TRACE_DEBUG
- ("%s*** [ERR] tel_deregister_event. [%d]***%s",
- SETTING_FONT_RED, tapi_ret, SETTING_FONT_BLACK);
- } else {
- SETTING_TRACE("*** tel_deregister_event OK ");
+ if (ad->refresh_idler) {
+ ecore_idler_del(ad->refresh_idler);
+ ad->refresh_idler = NULL;
}
- tapi_ret = tel_deinit();
- if (tapi_ret != TAPI_API_SUCCESS) {
- SETTING_TRACE_DEBUG("%s*** [ERR] tel_deinit. [%d] ***%s",
- SETTING_FONT_RED, tapi_ret,
- SETTING_FONT_BLACK);
- } else {
- SETTING_TRACE("*** tel_deinit OK ");
+ if (ad->handle) {
+ int tapi_ret = tel_deinit(ad->handle);
+ if (tapi_ret != TAPI_API_SUCCESS) {
+ SETTING_TRACE_DEBUG("*** [ERR] tel_deinit. [%d] ***", tapi_ret);
+ } else {
+ SETTING_TRACE("*** tel_deinit OK ");
+ }
+ ad->handle = NULL;
}
/* then destroy the UI object. */
if (ad->ly_main) {
evas_object_del(ad->ly_main);
+ ad->ly_main = NULL;
+ }
+
+ if (ad->flight_popup) {
+ evas_object_del(ad->flight_popup);
+ ad->flight_popup = NULL;
+ }
+
+#if 0
+ if (ad->plugin_node)
+ {
+ setting_plugin_destroy(ad->plugin_node);
}
- ad->ly_main = NULL;
+#endif
setting_view_main.is_create = 0;
SETTING_TRACE_END;
return SETTING_RETURN_SUCCESS;
}
-int setting_main_update(void *cb)
+static int setting_main_update(void *cb)
{
SETTING_TRACE_BEGIN;
+
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ setting_main_appdata *ad = (setting_main_appdata *) cb;
+
+ if (ad->ly_main != NULL) {
+ //evas_object_show(ad->ly_main);
+ }
+
return SETTING_RETURN_SUCCESS;
}
-int setting_main_cleanup(void *cb)
+static int setting_main_cleanup(void *cb)
{
SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ setting_main_appdata *ad = (setting_main_appdata *) cb;
+
+ if (ad->ly_main != NULL) {
+ //evas_object_hide(ad->ly_main);
+ }
+
return SETTING_RETURN_SUCCESS;
}
item_to_update = ad->data_bt;
bGlUpdate = EINA_TRUE;
break;
- case GL_ITEM_MAP:
- item_to_update = ad->data_mobileApp;
- bGlUpdate = EINA_TRUE;
- break;
- case GL_ITEM_USB:
- item_to_update = ad->data_usbcon;
- bGlUpdate = EINA_TRUE;
- break;
- case GL_ITEM_THEME:
- item_to_update = ad->data_theme;
+ case GL_ITEM_NFC:
+ item_to_update = ad->data_nfc;
bGlUpdate = EINA_TRUE;
break;
-
- case GL_ITEM_ROTATION:
- item_to_update = ad->data_rotationMode;
- bGlUpdate = EINA_FALSE;
- break;
- case GL_ITEM_ROAMING:
- item_to_update = ad->data_roaming;
+ case GL_ITEM_FLIGHT:
+ item_to_update = ad->data_flight;
bGlUpdate = EINA_FALSE;
break;
+
+
+
+
default: // other case
continue;
}
- if(bGlUpdate) {
- SETTING_TRACE("gl update:%d", nDx);
- elm_object_item_data_set(item_to_update->item, item_to_update);
- elm_genlist_item_update(item_to_update->item);
- } else {
- SETTING_TRACE("chk update:%d", nDx);
- elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+ if (item_to_update) {
+ SETTING_TRACE("gl update [%s], bGlUpdate:%d", _(item_to_update->keyStr), bGlUpdate);
+ if(bGlUpdate) {
+ SETTING_TRACE("gl update:%d", nDx);
+ elm_object_item_data_set(item_to_update->item, item_to_update);
+ elm_genlist_item_update(item_to_update->item);
+ } else {
+ SETTING_TRACE("chk update:%d", nDx);
+ elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+ }
}
ad->updateItems[nDx] = EINA_FALSE;
return;
}
-void setting_main_destroy_ug_cb(struct ui_gadget *ug, void *priv)
+void setting_main_destroy_ug_cb(ui_gadget_h ug, void *priv)
{
setting_main_appdata *ad = (setting_main_appdata *) priv;
if (!ad)
SETTING_TRACE_END;
}
-void setting_main_result_ug_cb(struct ui_gadget *ug, bundle *result,
+void setting_main_result_ug_cb(ui_gadget_h ug, service_h service,
void *priv)
{
- if (!ug || !priv || !result)
+ if (!priv)
return;
SETTING_TRACE_BEGIN;
SETTING_TRACE_END;
}
-void setting_main_layout_ug_cb(struct ui_gadget *ug, enum ug_mode mode,
+void setting_main_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
void *priv)
{
setting_main_appdata *ad = (setting_main_appdata *) priv;
Evas_Object *base;
- if (!ug || !priv)
+ if (!priv)
return;
SETTING_TRACE_BEGIN;
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = (setting_main_appdata *) data;
- ad->need_register = FALSE;
ad->isInUGMode = FALSE;
SETTING_TRACE_END;
void /* obj is the layout clicked */
setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj,
- char *ug_to_load, bundle *b,
+ char *ug_to_load, service_h svc,
struct ug_cbs *cbs)
{
SETTING_TRACE_BEGIN;
setting_main_appdata *ad = (setting_main_appdata *) data;
if (!ug_to_load) {
- setting_create_popup_without_title(ad, ad->win_main, NO_UG_FOUND_MSG);
+ setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
return;
}
-
+#if DISABLED_CODE
char ug_file[PATH_MAX];
if (snprintf
(ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH,
return;
SETTING_TRACE("ug_file:%s", ug_file);
if (!ecore_file_exists(ug_file)) {
- setting_create_popup_without_title(ad, ad->win_main, NO_UG_FOUND_MSG);
+ setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
return;
}
-
+#endif
SETTING_TRACE("to create libug-%s.so", ug_to_load);
- ad->ug = ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, b, cbs);
+ ad->ug = ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
if (ad->ug) {
ad->isInUGMode = TRUE;
} else {
evas_object_show(ad->ly_main);
SETTING_TRACE_ERROR("errno:%d", errno);
- setting_create_popup_without_title(ad, ad->win_main, NO_UG_FOUND_MSG);
+ setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
}
SETTING_TRACE_END;
}
void *event_info)
{
setting_main_appdata *ad = data;
- setting_create_popup_without_title(ad, ad->win_main,
+ setting_create_simple_popup(ad, ad->win_main, NULL,
NO_UG_FOUND_MSG);
}
-void
-setting_main_click_list_usb_cb(void *data, Evas_Object *obj, void *event_info)
-{
- SETTING_TRACE_BEGIN;
- retm_if(event_info == NULL, "Invalid argument: event info is NULL");
-
- int err;
- int value = -1;
- char *str_text = "Please turn USB tethering off first in Mobile hotspot";
-
- Elm_Object_Item *item = (Elm_Object_Item *) event_info;
-
- setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &value, &err);
- if (err != 0)
- {
- SETTING_TRACE_ERROR("FAIL: VCONFKEY_MOBILE_HOTSPOT_MODE may not exist\n");
- setting_main_click_list_ex_ug_cb(data, obj, item);
- return;
- }
-
- /* If mobile hotspot is on, going USB utilties is blocked by a popup*/
- if (value & VCONFKEY_MOBILE_HOTSPOT_MODE_USB)
- {
- elm_genlist_item_selected_set(item, EINA_FALSE);
- setting_create_popup_without_title(g_main_ad, g_main_ad->win_main, str_text);
- }
- else
- {
- setting_main_click_list_ex_ug_cb(data, obj, item);
- }
-
- SETTING_TRACE_END;
-}
-
void setting_main_click_list_more_cb(void *data, Evas_Object *obj, void *event_info)
{
SETTING_TRACE_BEGIN;
}
if (NULL == data) { /* pass NULL to ug_args when create setting.cfg. */
- setting_create_popup_without_title(g_main_ad,
- g_main_ad->win_main,
- NO_UG_FOUND_MSG);
+ setting_create_simple_popup(g_main_ad,
+ g_main_ad->win_main,
+ NULL, NO_UG_FOUND_MSG);
SETTING_TRACE_END;
return;
}
cbs->destroy_cb = setting_main_destroy_ug_cb;
cbs->priv = (void *)ad;
- if (!safeStrCmp(_(KeyStr_USBconnection), item_name)
- || !safeStrCmp(_(KeyStr_TVout), item_name)
- || !safeStrCmp(_(KeyStr_Security), item_name)) { /* */
- SETTING_TRACE("click menu '%s'", item_name);
-
- ad->need_register = TRUE;
- }
-
char *path = get_ug_path_from_ug_args(data);
- bundle *b = get_bundle_from_ug_args(data);
- setting_main_click_list_item_ug_cb(ad, obj, path, b, cbs);
- if (b)
- bundle_free(b);
+ service_h svc = get_bundle_from_ug_args(data);
+ setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
if (path)
FREE(path);
if (cbs)
FREE(cbs);
path = NULL;
cbs = NULL;
+ service_destroy(svc);
+}
+void
+setting_main_click_list_plugin_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ setting_main_appdata *ad = data;
+#ifdef PLUGIN
+ if (ad->plugin_path)
+ {
+ PluginNode* plugin_node = setting_plugin_create();
+
+ plugin_node->plugin_path = strdup(ad->plugin_path);
+
+ setting_plugin_load(plugin_node, (const char *)ad->plugin_path);
+ ad->plugin_node = (void*)plugin_node;
+
+ #if 0
+ if(ad->plugin_path)
+ {
+ free(ad->plugin_path);
+ ad->plugin_path = NULL;
+ }
+ #endif
+ }
+#endif
+}
+
+/**
+ * @see [caller] setting_main_list_mouse_up_cb
+ * @see [caller] setting_main_sel_list_mouse_up_cb
+ */
+static void __rotate_lock_handler(int chk_status, setting_main_appdata *ad )
+{
+ SETTING_TRACE_BEGIN;
+ if( chk_status == 1)
+ {
+ // toggle : 0 --> 1
+ int angle = elm_win_rotation_get(ad->win_main);
+ elm_win_rotation_with_resize_set(ad->win_main, angle);
+ } else {
+ elm_win_rotation_with_resize_set(ad->win_main, 0);
+ }
+ vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, !chk_status);
}
+/**
+ * toggle cb
+ */
void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
void *event_info)
{
list_item->chk_status);
setting_main_appdata *ad = g_main_ad;
- if (!safeStrCmp(KeyStr_DataRoaming, list_item->keyStr)) {
- SETTING_TRACE("eo == ad->chk_data_roaming");
- int value;
- int err;
- char *notify_str = NULL;
-
- setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &value,
- &err);
- if (value == 1) {
- notify_str = _("IDS_ST_BODY_WHEN_DATA_ROAMING_IS_DISABLED_APPLICATIONS_THAT_USE_THE_DATA_CONNECTION_MAY_NOT_WORK");
- } else {
- notify_str = _("IDS_ST_BODY_USING_MOBILE_DATA_WHEN_ROAMING_WILL_INCUR_EXTRA_CHARGES");
- }
-
- if (!ad->data_roaming_popup) {
- ad->data_roaming_popup =
- setting_create_popup_with_btn(ad, ad->win_main,
- notify_str,
- NULL,
- setting_ask_data_roaming_resp_cb,
- 0, 1, _("IDS_COM_SK_OK"));
-
-
- }
- } else if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
+ if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
int err;
if (elm_check_state_get(eo)) {
setting_set_bool_slp_key
}
} else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
- vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, elm_check_state_get(eo));
+ __rotate_lock_handler(list_item->chk_status, ad);
}
return;
}
+/**
+ * genlist touch cb
+ */
void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
void *event_info)
{
Setting_GenGroupItem_Data *list_item =
(Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
- int old_status = elm_check_state_get(list_item->eo_check);
+ list_item->chk_status = elm_check_state_get(list_item->eo_check);
+
/* new status */
- list_item->chk_status = !old_status;
- elm_check_state_set(list_item->eo_check, list_item->chk_status);
+ list_item->chk_status = !list_item->chk_status;
+ elm_check_state_set(list_item->eo_check, list_item->chk_status);
setting_main_appdata *ad = (setting_main_appdata *) data;
- if (!safeStrCmp(KeyStr_DataRoaming, list_item->keyStr)) {
- SETTING_TRACE("eo == ad->chk_data_roaming");
- int value;
- int err;
- char *notify_str = NULL;
-
- setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &value,
- &err);
- if (value == 1) {
- notify_str = _("IDS_ST_BODY_WHEN_DATA_ROAMING_IS_DISABLED_APPLICATIONS_THAT_USE_THE_DATA_CONNECTION_MAY_NOT_WORK");
- } else {
- notify_str = _("IDS_ST_BODY_USING_MOBILE_DATA_WHEN_ROAMING_WILL_INCUR_EXTRA_CHARGES");
- }
-
- if (!ad->data_roaming_popup) {
- ad->data_roaming_popup =
- setting_create_popup_with_btn(ad, ad->win_main,
- notify_str,
- NULL,
- setting_ask_data_roaming_resp_cb,
- 0, 1, _("IDS_COM_SK_OK"));
-
- }
- } else if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
+ if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
+ /* setting_reset_slp_key_by_status(eo, BOOL_SLP_SETTING_USE_PACKET_DATA); */
int err;
setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA,
list_item->chk_status, &err);
} else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
- vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, (list_item->chk_status));
+ __rotate_lock_handler(list_item->chk_status, ad);
}
+
return;
}
-void setting_ask_data_roaming_resp_cb(void *data, Evas_Object *obj,
- void *event_info)
+void __alternate_flight_mode(Evas_Object *check)
{
- int response_type = (int)event_info;
- setting_main_appdata *ad = data;
- if (POPUP_RESPONSE_OK == response_type) {
- int value;
- int err;
- setting_get_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING, &value, &err);
+ SETTING_TRACE_BEGIN;
+ int ret;
+ Eina_Bool status = elm_check_state_get(check);
+ SETTING_TRACE("flight mode status : %d", status);
+ setting_main_appdata *ad = g_main_ad;
- if (value == 0) {
- elm_check_state_set(ad->data_roaming->eo_check, 1);
- setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING,
- SETTING_ON_OFF_BTN_ON, &err);
- } else {
- elm_check_state_set(ad->data_roaming->eo_check, 0);
- setting_set_bool_slp_key(BOOL_SLP_SETTING_DATA_ROAMING,
- SETTING_ON_OFF_BTN_OFF, &err);
- }
+ //Check whether some requestion is processing by TAPI
+ if (ad->b_fm_requesting)
+ {
+ //Do nothing, just mark the lastest operation..
+ SETTING_TRACE("Some requestion is processing by TAPI, wait to process");
+ ad->fm_waiting_op = status ? FM_ENTER : FM_LEAVE;
+ return;
+ }
+ //otherwise, invalid waiting operation and send requsetion to TAPI:
+ ad->fm_waiting_op = FM_INVALID;
+ if (status) {
+ ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
+ setting_retm_if(ret != TAPI_API_SUCCESS,
+ "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
+ } else {
+ ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
+ setting_retm_if(ret != TAPI_API_SUCCESS,
+ "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
}
- evas_object_del(ad->data_roaming_popup);
- ad->data_roaming_popup = NULL;
+ //sucessfully sent,
+ ad->b_fm_requesting = TRUE;
+ SETTING_TRACE_END;
}
-
void
setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj,
void *event_info)
int err = 0;
int value;
setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
-
+ SETTING_TRACE("value:%d", value);
switch (value) {
case VCONFKEY_TELEPHONY_SIM_INSERTED:
{
- int tapi_ret = tel_deregister_event(subs_id_main);
- if (tapi_ret != TAPI_API_SUCCESS)
- SETTING_TRACE_DEBUG
- ("%s*** [ERR] tel_deregister_event. [%d]***%s",
- SETTING_FONT_RED, tapi_ret,
- SETTING_FONT_BLACK);
-
- ad->need_register = TRUE;
struct ug_cbs *cbs =
(struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
setting_retm_if(!cbs, "calloc failed");
break;
}
case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
- setting_create_popup_without_title(NULL, ad->win_main,
- _("IDS_ST_HEADER_INSERT_SIM_CARD_ABB"));
+ setting_create_simple_popup(NULL, ad->win_main,
+ NULL, _("IDS_ST_HEADER_INSERT_SIM_CARD_ABB"));
SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s",
SETTING_FONT_RED, value, SETTING_FONT_BLACK);
return;
break;
case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
- setting_create_popup_without_title(NULL, ad->win_main,
- _("IDS_COM_BODY_INVALID_SIM_CARD"));
+ setting_create_simple_popup(NULL, ad->win_main,
+ NULL,_("IDS_COM_BODY_INVALID_SIM_CARD"));
SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s",
SETTING_FONT_RED, value, SETTING_FONT_BLACK);
return;
}
+static void
+setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ /* error check */
+ setting_retm_if(data == NULL, "Data parameter is NULL");
+
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(item, 0);
+ Setting_GenGroupItem_Data *list_item =
+ (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
+ int old_status = elm_check_state_get(list_item->eo_check);
+ /* new status */
+ list_item->chk_status = !old_status;
+ elm_check_state_set(list_item->eo_check, list_item->chk_status);
+
+ __alternate_flight_mode(list_item->eo_check);
+ SETTING_TRACE_END;
+}
+
+void
+setting_main_click_list_flight_mode_cb(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;
+ list_item->chk_status = elm_check_state_get(obj); /* for update new state */
+ SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
+ list_item->chk_status);
+
+ __alternate_flight_mode(obj);
+ SETTING_TRACE_END;
+}
+
+/**
+ * store current selection in setting.cfg
+ */
void setting_try_save_check_list(void *data)
{
SETTING_TRACE_BEGIN;
int update_count = 0;
while (check_list) {
- list_item = (Setting_GenGroupItem_Data *)
- eina_list_data_get(check_list);
- if (NULL == list_item) {
- continue;
- }
+ list_item = (Setting_GenGroupItem_Data *) eina_list_data_get(check_list);
+ if (NULL == list_item) continue;
+
update_count++;
if (list_item->chk_status) {
/* to update config file */
- setting_cfg_set_pos(list_item->keyStr,
- Cfg_Item_Pos_Level0);
+ setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level0);
} else {
/* to update config file */
- setting_cfg_set_pos(list_item->keyStr,
- Cfg_Item_Pos_Level1);
+ setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level1);
}
check_list = eina_list_next(check_list);
}
}
void
-setting_main_click_add_all_cb(void *data, Evas_Object *obj, void *event_info)
+setting_main_click_edit_preferred_cb(void *data, Evas_Object *obj, void *event_info)
{
SETTING_TRACE_BEGIN;
-
+
setting_main_appdata *ad = (setting_main_appdata *) data;
ad->view_type = SETTING_VIEW_ALL_CHECK;
__setting_create_prefered_view(ad);
- __load_check_list(ad, &(ad->all_check_genlist), NULL);
-
+ __load_check_list(ad, &(ad->edit_preferred_genlist), NULL);
+
SETTING_TRACE_END;
}