#include <tapi_common.h>
#include <aul.h>
+#include <ail.h>
#include <time.h>
#include <setting-main.h>
#include <setting-plugin.h>
+
+typedef struct DrawAppInfo DrawAppInfo;
+typedef struct DrawAppInfo
+{
+ int ncount;
+ //------------------------------------
+ void (*draw_app)(void* arg, char* name, char* pkgname);
+ void* data;
+};
+
static int setting_main_create(void *cb);
static int setting_main_destroy(void *cb);
static int setting_main_update(void *cb);
return ad->data_bt;
}
-static Setting_GenGroupItem_Data * __mobileap_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
-{
- setting_main_appdata *ad = (setting_main_appdata *)data;
-
- 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);
-
- return ad->data_mobileApp;
-}
-
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_main_appdata *ad = (setting_main_appdata *)data;
- Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
+ ad->data_network = setting_create_Gendial_field_groupitem(genlist,
&(ad->itc[GENDIAL_Type_1text_1icon_2]),
NULL,
setting_main_click_list_network_ug_cb,
NULL,
NULL);
- return obj;
+ return ad->data_network;
}
static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
__BACK_POINTER_SET(ad->data_nfc);
setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
- ad, SWALLOW_Type_LAYOUT_SPECIALIZTION,
+ 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;
}
if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
- ad, SWALLOW_Type_LAYOUT_SPECIALIZTION,
+ ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
NULL, NULL, 0, SETTING_WIFI_DIRECT_DESC, NULL, NULL);
- } else if (!safeStrCmp(KeyStr_KeisOverWifi, keyStr)) {
- setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
- ad, SWALLOW_Type_LAYOUT_SPECIALIZTION,
- NULL, NULL, 0, SETTING_KIES_VIA_WIFI_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 */
}
MAINLIST_ENTRY_FLIGHT_MODE = 0,
MAINLIST_ENTRY_WIFI,
MAINLIST_ENTRY_BT,
- MAINLIST_ENTRY_MOBILEAP,
MAINLIST_ENTRY_ALLSHARE,
MAINLIST_ENTRY_NETWORK,
MAINLIST_ENTRY_NFC,
{KeyStr_FlightMode, __flightmode_handler}, // 0 --> NOT UG
{KeyStr_WiFi, __wifi_handler}, // 1 --> UG
{KeyStr_Bluetooth, __bluetooth_handler}, // 1 --> UG
- {KeyStr_MobileAP, __mobileap_handler}, // 1 --> UG
{KeyStr_AllShare, __allshare_handler}, // NOT UG
{KeyStr_Network, __network_handler}, // 1 --> UG
{KeyStr_NFC, __nfc_handler}, // 1 --> UG
}
int idx_second_menu = 0;
-
+
char *keyStr = NULL;
char *icon_path = NULL;
char *ug_args = NULL;
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 (idx_second_menu < MAX_MORE_MENU_NUM
- && Cfg_Item_Pos_Level1 == tmpPos
- && SETTING_VIEW_MAIN == ad->view_load
- && MAIN_PROFILE_PREFERRED == ad->profile_type) {
-
- 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 (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_MobileAP, keyStr)) {
- continue; /* hide Tethering in Emulator*/
- } else if (!safeStrCmp(KeyStr_NFC, keyStr)) {
- continue; /* hide NFC in Emulator*/
} else if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
continue; /* hide WiFiDirect in Emulator*/
- } else if (!safeStrCmp(KeyStr_AllShareCast, keyStr)) {
- continue; /* hide AllShareCast in Emulator*/
- } else if (!safeStrCmp(KeyStr_NearbyDevices, keyStr)) {
- continue; /* hide NearbyDevices in Emulator*/
- } else if (!safeStrCmp(KeyStr_KeisOverWifi, keyStr)) {
- continue; /* hide KeisOverWifi in Emulator*/
- } else if (!safeStrCmp(KeyStr_Synchronise, keyStr)) {
- continue; /* hide Synchronise in Emulator*/
} else if (!safeStrCmp(KeyStr_Network, keyStr)) {
continue; /* hide Network in Emulator*/
- }else {
+ } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr)) {
+ continue; /* hide Bluetooth 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_FlightMode, keyStr)) { /* load special radio */
// ug == NULL
mainlist_table[MAINLIST_ENTRY_FLIGHT_MODE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
mainlist_table[MAINLIST_ENTRY_BT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
- } else if (!safeStrCmp(KeyStr_MobileAP, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
-
- mainlist_table[MAINLIST_ENTRY_MOBILEAP].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);
//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)
+ 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;
icon_path = setting_cfg_get_icon_path_idx(i, j);
ug_args = setting_cfg_get_ug_args_idx(i, j);
- 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) {
- ad->more_system_menus[idx_second_menu++] = keyStr;
- }
-
//SETTING_TRACE("KeyString : %s , tmpPos : %d , inputPos : %d ", keyStr, tmpPos, inputPos );
- 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 (is_emulator) {
- if (!safeStrCmp(KeyStr_EventsNotifications, keyStr)) {
- continue; /* hide EventsNotifications in Emulator*/
- } else if (!safeStrCmp(KeyStr_Security, keyStr)) {
+ 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_VoiceInOut, keyStr)) {
- continue; /* hide VoiceInOut in Emulator*/
- } else if (!safeStrCmp(keystr_Drivingmode, keyStr)) {
- continue; /* hide Drivingmode in Emulator*/
- } else if (!safeStrCmp(KeyStr_License, keyStr)) {
- continue; /* hide License 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
}
//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)
+ 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;
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]),
__load_applications_menu_list(ad, Cfg_Item_Pos_Level_All);
}
+bool is_3rdapp_installed_setting_cfg(char* pkgname)
+{
+ SETTING_TRACE_BEGIN;
+ // /opt/apps/
+ char path[512];
+
+ if (snprintf(path, 512, "/opt/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, "/opt/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;
}
}
+ // draw UI with AUL code
#ifdef PLUGIN
- //3rd cfg
- DIR *dp = opendir (PLUGIN_CFG_DIR);
- if (dp != NULL)
- {
- struct dirent *ep;
- while (ep = readdir (dp))
- {
- if (0 == safeStrCmp(".", ep->d_name)
- || 0 == safeStrCmp("..", ep->d_name))
- {
- continue;
- }
- downloaded_apps_num++;
- }
- (void) closedir (dp);
- }
-#endif
+ 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)
{
ELM_GENLIST_ITEM_NONE,
KeyStr_DownloadedAPPs,
NULL);
+#if DISABLED_CODE
char *keyStr = NULL;
char *icon_path = NULL;
char *ug_args = NULL;
}
}
+#endif
+
- #ifdef PLUGIN
+ //#ifdef PLUGIN
+ #if 0
//3rd cfg
DIR *dp = opendir (PLUGIN_CFG_DIR);
if (dp != 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;
}
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;
evas_object_del(ad->flight_popup);
ad->flight_popup = NULL;
}
+
+#if 0
+ if (ad->plugin_node)
+ {
+ setting_plugin_destroy(ad->plugin_node);
+ }
+#endif
+
setting_view_main.is_create = 0;
SETTING_TRACE_END;
return SETTING_RETURN_SUCCESS;
item_to_update = ad->data_nfc;
bGlUpdate = EINA_TRUE;
break;
- case GL_ITEM_MAP:
- item_to_update = ad->data_mobileApp;
- bGlUpdate = EINA_TRUE;
- break;
case GL_ITEM_FLIGHT:
item_to_update = ad->data_flight;
bGlUpdate = EINA_FALSE;
}
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);
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 = USB_NEED_OFF;
-
- 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_simple_popup(g_main_ad, g_main_ad->win_main, NULL, (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;
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
- setting_plugin_load((const char *)data);
+ 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
}