[Feature] use system-info api to get build info .
[apps/core/preloaded/settings.git] / setting-about / src / setting-about-main.c
index 352c3e5..7181576 100755 (executable)
@@ -21,7 +21,6 @@
 #include <setting-cfg.h>
 #include <setting-about-main.h>
 #include <aul.h>
-#include <iniparser.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -29,6 +28,7 @@
 
 
 #include <app_manager.h>
+#include <system_info.h>
 
 #define DEVNAME_BLOCK_SPACE    0
 // #define SUPPORT_DIAG_USAGE
@@ -143,6 +143,8 @@ static void __device_name_changed_cb(void *data, Evas_Object *obj)
                if (!ad->empty_flag)
                {
                        ad->empty_flag = TRUE;
+                       elm_entry_context_menu_disabled_set(obj, TRUE); //disable the copy&paste&search popup
+                       elm_entry_magnifier_disabled_set(obj, TRUE);
                        Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
                        if (navi_it)
                        {
@@ -162,6 +164,8 @@ static void __device_name_changed_cb(void *data, Evas_Object *obj)
                if (ad->empty_flag)
                {
                        ad->empty_flag = FALSE;
+                       elm_entry_context_menu_disabled_set(obj, FALSE); //enable the copy&paste&search popup
+                       elm_entry_magnifier_disabled_set(obj, FALSE);
                        Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
                        if (navi_it)
                        {
@@ -201,87 +205,52 @@ void setting_about_main_get_phone_model_name(char* szStr, int nSize)
 {
        retm_if(szStr == NULL, "szStr parameter is NULL");
 
-       char szBin[50];
-       char szEmul[50];
-
-       const char* szBinVer = NULL;
-
-       dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
-       if (dic) {
-               szBinVer = (char*)iniparser_getstr(dic, "Version:Build");
-               if (szBinVer) {
-                       char* str = g_strdup(szBinVer);
-                       if (str) {
-                               char* pPos = str;
-                               while (*pPos++) {
-                                       if ('_' == *pPos)
-                                               *pPos = ' ';
-                               }
-                               sscanf(str, "%s %s", szBin, szEmul);
-                       }
-                       G_FREE(str);
-               }
+       char *value = NULL;
+       int ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &value);
+       SETTING_TRACE("value : %s", value);
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+               FREE(value);
+               snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
+               return;
        }
 
-       if (!strncmp(szEmul, "emul", 4)) {
-               snprintf(szStr, nSize, "%s", "SDK");
+       if (value) {
+               snprintf(szStr, nSize, "%s", value);
        } else {
-               if (!strncmp(szBin, "I9500", 5)) {
-                       snprintf(szStr, nSize, "GT-%s", szBin);
-               } else if (!strncmp(szBin, "SLP", 3)) {
-                       snprintf(szStr, nSize, "GT-%s", szBin);
-               } else {
-                       snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
-               }
+               snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
        }
 
-       if (dic) {
-               iniparser_freedict(dic);
-               dic = NULL;
-       }
+       FREE(value);
 }
 
 void setting_about_main_get_sw_version(char* szStr, int nSize)
 {
        retm_if(szStr == NULL, "szStr parameter is NULL");
 
-       dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
-       if (dic == NULL) {
+       char *version = NULL;
+       int ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &version);
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+               FREE(version);
                snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
-       } else {
-               char* szBinVer =
-                       g_strdup((char*)iniparser_getstr(dic, "Version:Build"));
-               char* szVerMaj =
-                       g_strdup((char*)iniparser_getstr(dic, "Version:Major"));
-               char* szVerMin =
-                       g_strdup((char*)iniparser_getstr(dic, "Version:Minor"));
-
-               if (szBinVer) {
-                       char* pPos = szBinVer;
-                       while(*pPos++) {
-                               if ('.' == *pPos) *pPos = '\0';
-                       }
-               }
-               else {
-                       szBinVer = g_strdup(_("IDS_ST_HEADER_UNAVAILABLE"));
-               }
-               if (!szVerMaj) {
-                       szVerMaj = g_strdup("-");
-               }
-               if (!szVerMin) {
-                       szVerMin = g_strdup("-");
-               }
-
-               snprintf(szStr, nSize, "SLP%s.%s (%s)", szVerMaj, szVerMin, szBinVer);
-               G_FREE(szBinVer);
-               G_FREE(szVerMaj);
-               G_FREE(szVerMin);
+               return;
        }
 
-       if (dic) {
-               iniparser_freedict(dic);
-               dic = NULL;
+       char *build_info = NULL;
+       ret = system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_STRING, &build_info);
+       if (ret != SYSTEM_INFO_ERROR_NONE) {
+               SETTING_TRACE_ERROR("fail to call system_info_get_value_string");
+               FREE(version);
+               FREE(build_info);
+               snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
+               return;
        }
+
+       snprintf(szStr, nSize, "SLP%s (%s)", version, build_info);
+
+       FREE(version);
+       FREE(build_info);
 }
 
 void setting_about_main_get_wifi_mac_address_string(char *str, int size)
@@ -1156,7 +1125,7 @@ static void __setting_about_main_device_name_clicked(void *data, Evas_Object *ob
        int mobile_ap_status = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
        int err = -1;
        int ret = setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &mobile_ap_status, &err);
-       setting_retm_if(ret == SETTING_RETURN_FAIL, "Get vconf failed");
+       //setting_retm_if(ret == SETTING_RETURN_FAIL, "Get vconf failed");
 
        if (!elm_object_focus_get(obj)) {
                elm_object_focus_set(obj, EINA_TRUE);