Set initial code 77/248177/1
authorKiseok Chang <kiso.chang@samsung.com>
Mon, 23 Nov 2020 08:36:49 +0000 (17:36 +0900)
committerKiseok Chang <kiso.chang@samsung.com>
Mon, 23 Nov 2020 08:37:53 +0000 (17:37 +0900)
- from pilot version

Change-Id: I216758584009b48a85eeec4f66187137533bdb11
Signed-off-by: Kiseok Chang <kiso.chang@samsung.com>
32 files changed:
CMakeLists.txt
org.tizen.setting.xml.in
resource/icons/list_icon/setting_search_activegrey.png [new file with mode: 0644]
resource/icons/list_icon/setting_search_bgactive.png [new file with mode: 0644]
setting-about/CMakeLists.txt
setting-about/include/setting-about-name.h [new file with mode: 0644]
setting-about/include/setting-about-navigation-paths.h [new file with mode: 0644]
setting-about/include/setting-about.h
setting-about/src/setting-about-main.c
setting-about/src/setting-about-name.c [new file with mode: 0644]
setting-about/src/setting-about-navigation-paths.c [new file with mode: 0644]
setting-about/src/setting-about-status.c
setting-about/src/setting-about.c
setting-common/CMakeLists.txt
setting-common/include/setting-common-general-func.h
setting-common/include/setting-common-navigation-helpers.h [new file with mode: 0644]
setting-common/include/setting-common-navigation.h [new file with mode: 0644]
setting-common/include/setting-common-resource.h
setting-common/include/setting-common-view-manager.h [new file with mode: 0644]
setting-common/src/setting-common-general-func.c
setting-common/src/setting-common-navigation-helpers.c [new file with mode: 0644]
setting-common/src/setting-common-navigation.c [new file with mode: 0644]
setting-common/src/setting-common-view-manager.c [new file with mode: 0644]
setting-search/CMakeLists.txt [new file with mode: 0644]
setting-search/include/setting-search-app.h [new file with mode: 0644]
setting-search/include/setting-search-util.h [new file with mode: 0644]
setting-search/src/setting-search-app.c [new file with mode: 0644]
setting-search/src/setting-search-common.c [new file with mode: 0644]
setting-search/src/setting-search-main.c [new file with mode: 0644]
setting-search/src/setting-search-util.c [new file with mode: 0644]
src/setting-main.c
src/setting.c

index dab14c53cb74960fe728a8fe569d40774d08cac5..075267b4f591acd3f9ba8ed64b38a163c8ef1c3f 100755 (executable)
@@ -42,6 +42,7 @@ SET(SETTING_APPMGR setting-appmgr)
 SET(SETTING_PRIVACY setting-privacy)
 SET(SETTING_RESET setting-reset)
 SET(SETTING_SOFTKEY setting-softkey)
+SET(SETTING_SEARCH setting-search)
 
 SET(LIB_SETTING_COMMON setting-common)
 
@@ -97,6 +98,7 @@ ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_LANGUAGE_AND_INPUT})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_LICENSE})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PROFILE})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_NOTIFICATIONS})
+ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_SEARCH})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_RINGTONE})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_STORAGE})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_TIME})
index 5f53ba6c5d465c27ea666495676499f484cbac1f..9e3a635cf2350f161ef385759b9bcdd602e9f62f 100644 (file)
        </ui-application>
        <ui-application appid="org.tizen.setting-about" exec="@TZ_SYS_RO_APP@/org.tizen.setting/bin/setting-about" nodisplay="true" multiple="false" type="capp" taskmanage="false" hw-acceleration="on" launch_mode="caller">
                <metadata key="http://developer.samsung.com/tizen/metadata/legacylifecycle"/>
+        <metadata key="http://org.tizen/metadata/setting/about/en_US/title" value="About"/>
+        <metadata key="http://org.tizen/metadata/setting/about/en_US/keywords" value="about,info,information"/>
+        <metadata key="http://org.tizen/metadata/setting/about/icon" value=""/>
+        <metadata key="http://org.tizen/metadata/setting/about/manage_certificates/en_US/title" value="Manage certificates"/>
+        <metadata key="http://org.tizen/metadata/setting/about/manage_certificates/en_US/keywords" value="certificate,certification,manage"/>
+        <metadata key="http://org.tizen/metadata/setting/about/manage_certificates/icon" value=""/>
+        <metadata key="http://org.tizen/metadata/setting/about/regulatory_information/en_US/title" value="Regulatory information"/>
+        <metadata key="http://org.tizen/metadata/setting/about/regulatory_information/en_US/keywords" value="regulatory information,regulatory,information"/>
+        <metadata key="http://org.tizen/metadata/setting/about/regulatory_information/icon" value=""/>
+        <metadata key="http://org.tizen/metadata/setting/about/legal_information/en_US/title" value="Legal information"/>
+        <metadata key="http://org.tizen/metadata/setting/about/legal_information/en_US/keywords" value="legal information,legal,information"/>
+        <metadata key="http://org.tizen/metadata/setting/about/legal_information/icon" value=""/>
+        <metadata key="http://org.tizen/metadata/setting/about/software_update/en_US/title" value="Software update"/>
+        <metadata key="http://org.tizen/metadata/setting/about/software_update/en_US/keywords" value="sofware,applications,update,upgrade"/>
+        <metadata key="http://org.tizen/metadata/setting/about/software_update/icon" value=""/>
+        <metadata key="http://org.tizen/metadata/setting/about/name/en_US/title" value="Name"/>
+        <metadata key="http://org.tizen/metadata/setting/about/name/en_US/keywords" value="name,device,model"/>
+        <metadata key="http://org.tizen/metadata/setting/about/name/icon" value=""/>
+        <metadata key="http://org.tizen/metadata/setting/about/status/en_US/title" value="Status"/>
+        <metadata key="http://org.tizen/metadata/setting/about/status/en_US/keywords" value="status.number,storage,wifi,mac,address,battery,cpu,usage"/>
+        <metadata key="http://org.tizen/metadata/setting/about/status/icon" value=""/>
                <label>About device</label>
                <label xml:lang="en-us">About device</label>
                <label xml:lang="ja-jp">端末情報</label>
diff --git a/resource/icons/list_icon/setting_search_activegrey.png b/resource/icons/list_icon/setting_search_activegrey.png
new file mode 100644 (file)
index 0000000..38fe0cf
Binary files /dev/null and b/resource/icons/list_icon/setting_search_activegrey.png differ
diff --git a/resource/icons/list_icon/setting_search_bgactive.png b/resource/icons/list_icon/setting_search_bgactive.png
new file mode 100644 (file)
index 0000000..e0910ae
Binary files /dev/null and b/resource/icons/list_icon/setting_search_bgactive.png differ
index 5c7ada2b1bdaa401931d83f41cff7175ab3fd8c6..55e25e299bc5124d21c12142d33a3cb57d7496f3 100755 (executable)
@@ -45,6 +45,8 @@ ADD_EXECUTABLE(${PROJECT_SETTING_ABOUT}
        src/setting-about.c
        src/setting-about-main.c
        src/setting-about-status.c
+       src/setting-about-navigation-paths.c
+       src/setting-about-name.c
 )
 
 TARGET_LINK_LIBRARIES(${PROJECT_SETTING_ABOUT} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common)
diff --git a/setting-about/include/setting-about-name.h b/setting-about/include/setting-about-name.h
new file mode 100644 (file)
index 0000000..6c413ae
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ *
+ */
+#ifndef __SETTING_ABOUT_NAME_H__
+#define __SETTING_ABOUT_NAME_H__
+
+#include <setting-common-view.h>
+
+extern setting_view view_setting_about_name;
+
+#endif //__SETTING_ABOUT_NAME_H__
\ No newline at end of file
diff --git a/setting-about/include/setting-about-navigation-paths.h b/setting-about/include/setting-about-navigation-paths.h
new file mode 100644 (file)
index 0000000..47bf81e
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef __SETTING_ABOUT_NAVIGATION_PATHS_H__
+#define __SETTING_ABOUT_NAVIGATION_PATHS_H__
+
+#include <setting-common-navigation.h>
+
+#define MAIN_PATH SETTING_BASE_PATH"/about"
+#define MANAGE_CERTIFICATES_PATH MAIN_PATH"/manage_certificates"
+#define REGULATORY_INFORMATION_PATH MAIN_PATH"/regulatory_information"
+#define LEGAL_INFORMATION_PATH MAIN_PATH"/legal_information"
+#define SOFTWARE_UPDATE_PATH MAIN_PATH"/software_update"
+#define NAME_PATH MAIN_PATH"/name"
+#define STATUS_PATH MAIN_PATH"/status"
+
+int setting_about_register_paths(void *data);
+
+#endif /* __SETTING_ABOUT_NAVIGATION_PATHS_H__ */
\ No newline at end of file
index ce6e6159c513428aea1399c5dd1f451329c75196..00a4ac9c4013d17a219e085b6a9115c17d7df6bb 100644 (file)
@@ -45,6 +45,7 @@
 #define MAX_DISPLAY_STR_LEN_ON_PHONE_INFO      256
 #define SETTING_ABOUT_MOBILE_AP_TURNED_OFF "IDS_ST_POP_DISABLE_TETHERING_Q"
 #define SETTING_ABOUT_WIFI_MAC_STR_LEN 17
+#define DEVICE_NAME_DEFAULT    "Radioed"
 
 /**
  * Setting About context
index bdc4dd8367a7ca347dc012bbe8e9ba643bbe3ea9..033303fe3887d1753c07c1817d2c4efbc8c35dd1 100755 (executable)
 #include <runtime_info.h>
 
 #include "setting-about-main.h"
-#include "setting-about-status.h"
 #include "controls/enter-text-popup.h"
 #include "controls/info-popup.h"
 
-#define MAX_DEVICE_NAME_LEN            32
+//#include "setting-about-status.h"
+#include "setting-about.h"
+#include "setting-about-navigation-paths.h"
 
-#define DEVICE_NAME            "IDS_ST_HEADER_DEVICE_NAME"
-#define EMPTY_LIMITATION_STR   "IDS_ST_BODY_THE_NAME_FIELD_CANNOT_BE_EMPTY"
-#define DEVICE_NAME_DEFAULT    "Radioed"
+#define MAX_DEVICE_NAME_LEN            32
 #define ITEM_NAME_STATUS       "Status"
 
 static int _view_create(void *cb);
 static int _view_destroy(void *cb);
-static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it);
 
 setting_view setting_view_about_main = {
                .create = _view_create,
@@ -89,70 +87,6 @@ static void __popup_mobile_ap_turn_off_ask_resp_cb(void *data, Evas_Object *obj,
 
 }
 
-/**
- * @brief regulatory popup response cp.
- *
- * @param data application context
- * @param obj evas object
- * @param event_info event type
- */
-
-static void __popup_regulatory_info_rsp_cb(void *data,
-               Evas_Object *obj, void *event_info)
-{
-       retm_if(data == NULL, "Data parameter is NULL");
-       evas_object_del(data);
-}
-
-/**
- * @brief show regulatory info popup.
- *
- * @param data application context
- */
-static void __popup_regulatory_info(void *data)
-{
-       SETTING_TRACE_BEGIN;
-
-       Evas_Object *popup;
-       SettingAbout *ad;
-       Evas_Object *layout;
-       Evas_Object *icon;
-       Evas_Object *btn1;
-       char buf[4096];
-
-       ad = (SettingAbout *)data;
-       popup = elm_popup_add(ad->md.layout);
-       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK,
-                       eext_popup_back_cb, NULL);
-
-       elm_object_part_text_set(popup, "title,text",
-                       _("IDS_ST_BODY_REGULATORY_INFORMATION_ABB"));
-       layout = elm_layout_add(popup);
-       elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
-                       "popup_center_image");
-       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
-                       EVAS_HINT_EXPAND);
-
-       icon = elm_image_add(layout);
-       snprintf(buf, sizeof(buf), "%s/00_popup_regulatory_info.png",
-                       SETTING_ICON_PATH);
-       elm_image_file_set(icon, buf, NULL);
-       elm_image_resizable_set(icon, EINA_TRUE, EINA_TRUE);
-       elm_object_part_content_set(layout, "elm.swallow.content", icon);
-
-       evas_object_show(layout);
-       elm_object_content_set(popup, layout);
-
-       btn1 = elm_button_add(popup);
-       elm_object_style_set(btn1, "popup");
-       elm_object_text_set(btn1, _("IDS_ST_BUTTON_OK"));
-       elm_object_part_content_set(popup, "button1", btn1);
-       evas_object_smart_callback_add(btn1, "clicked",
-                       __popup_regulatory_info_rsp_cb, popup);
-       evas_object_show(popup);
-
-       SETTING_TRACE_END;
-}
 
 /**
  * @brief get Model Name.
@@ -307,6 +241,7 @@ static void __vconf_change_cb(keynode_t *key, void *data)
        }
 }
 
+#if 0
 /**
  * @brief Lunch certificates (setting-manage-certificates-efl)
  *
@@ -325,6 +260,9 @@ static void __certificates_clicked(void *data)
        app_control_send_launch_request(svc, NULL, NULL);
        app_control_destroy(svc);
 }
+#endif
+
+#if 0
 
 static void _device_name_accepted_popup_callback(void *user_data, Evas_Object *obj, void *event_info)
 {
@@ -358,6 +296,8 @@ static void _device_name_rejected_popup_callback(void *user_data, Evas_Object *o
        evas_object_del(obj);
 }
 
+
+
 /**
  * Setting > About > Device name > (new view) here
  */
@@ -391,6 +331,7 @@ static void __creat_name_view(void *data)
 
        SETTING_TRACE_END;
 }
+#endif
 
 /**
  * @brief Do process when clicking on some genlist item
@@ -417,16 +358,19 @@ static void __mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
        SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
        if (!safeStrCmp("IDS_ST_HEADER_MANAGE_CERTIFICATES_ABB",
                        list_item->keyStr)) {
-               __certificates_clicked(data);
+               //__certificates_clicked(data);
+               navigation_navigate_to(MANAGE_CERTIFICATES_PATH);
        } else if (!safeStrCmp("IDS_ST_BODY_REGULATORY_INFORMATION_ABB",
                        list_item->keyStr)) {
-               __popup_regulatory_info(data);
+               //__popup_regulatory_info(data);
+               navigation_navigate_to(LEGAL_INFORMATION_PATH);
        } else if (!safeStrCmp("IDS_ST_MBODY_LEGAL_INFORMATION_ABB",
                        list_item->keyStr)) {
-               app_launcher("org.tizen.setting-license",
-                               NULL, NULL);
+               //app_launcher("org.tizen.setting-license", NULL, NULL);
+               navigation_navigate_to(LEGAL_INFORMATION_PATH);
        } else if (!safeStrCmp("IDS_ST_MBODY_SOFTWARE_UPDATE",
                        list_item->keyStr)) {
+               navigation_navigate_to(SOFTWARE_UPDATE_PATH);
 #ifdef SUPPORT_FOTA
                SettingAbout *ad = (SettingAbout *)list_item->userdata;
 
@@ -442,10 +386,12 @@ static void __mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
 #endif
        } else if (!safeStrCmp("IDS_ST_BODY_NAME",
                        list_item->keyStr)) {
-               __creat_name_view(data);
+               //__creat_name_view(data);
+               navigation_navigate_to(NAME_PATH);
        } else if (!safeStrCmp(ITEM_NAME_STATUS,
                        list_item->keyStr)) {
-               setting_view_create(&view_setting_about_status, (void *)data);
+               //setting_view_create(&view_setting_about_status, (void *)data);
+               navigation_navigate_to(STATUS_PATH);
        }
 }
 
@@ -762,10 +708,12 @@ static int _view_create(void *cb)
        retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
        SettingAbout *ad = (SettingAbout *)cb;
 
+#if 0
        ret = view_init(&ad->md, _("IDS_ST_BODY_ABOUT_DEVICE"));
        if (ret != SETTING_RETURN_SUCCESS)
                return ret;
        setting_add_back_button(&ad->md, _view_pop_cb, ad);
+#endif
 
        evas_object_smart_callback_add(ad->md.genlist, "drag",
                        __gl_drag, ad);
@@ -826,6 +774,7 @@ static int _view_destroy(void *cb)
        return SETTING_RETURN_SUCCESS;
 }
 
+#if 0
 static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it)
 {
        SETTING_TRACE_BEGIN;
@@ -845,3 +794,4 @@ static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it)
        ui_app_exit();
        return EINA_TRUE;
 }
+#endif
\ No newline at end of file
diff --git a/setting-about/src/setting-about-name.c b/setting-about/src/setting-about-name.c
new file mode 100644 (file)
index 0000000..2393ba5
--- /dev/null
@@ -0,0 +1,885 @@
+/*
+ * 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 "setting-about-name.h"
+
+#include <app_manager.h>
+#include <efl_extension.h>
+#include <runtime_info.h>
+#include <vconf-internal-keys.h>
+
+#include <setting-common-draw-widget.h>
+#include <setting-common-view.h>
+#include <setting-common-view-manager.h>
+#include "setting-about.h"
+
+#define MAX_DEVICE_NAME_LEN            32
+#define DEVICE_NAME            "IDS_ST_HEADER_DEVICE_NAME"
+#define EMPTY_LIMITATION_STR   "IDS_ST_BODY_THE_NAME_FIELD_CANNOT_BE_EMPTY"
+
+static int _view_create(void *data);
+static int _view_destroy(void *data);
+
+setting_view view_setting_about_name = {
+               .create = _view_create,
+               .destroy = _view_destroy,
+               .update = NULL,
+               .cleanup = NULL
+};
+
+static Eina_Bool __child_view_back_cb(void *data, Elm_Object_Item *it)
+{
+       SETTING_TRACE_BEGIN;
+       SettingAbout *ad = data;
+       retv_if(!ad, EINA_TRUE);
+
+       if (ad->empty_flag)
+               return EINA_FALSE;
+
+       if (ad->event_handler) {
+               ecore_event_handler_del(ad->event_handler);
+               ad->event_handler = NULL;
+       }
+       if (ad->name_update_idler) {
+               ecore_idler_del(ad->name_update_idler);
+               ad->name_update_idler = NULL;
+       }
+       return EINA_TRUE;
+}
+
+/**
+ * @brief button done response callback.
+ *
+ * @param data application data
+ * @param obj the button evas object
+ * @param event_info event type
+ */
+static void __naviframe_btn_done_cb(void *data, Evas_Object *obj,
+               void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       setting_retm_if(data == NULL, "data is NULL");
+       SettingAbout *ad = (SettingAbout *)data;
+       const char *entry_str = NULL;
+       char *entry_str_utf8 = NULL;
+       char *name_value = NULL;
+
+       if (ad->item_dev_name && ad->item_dev_name->eo_check) {
+               entry_str = elm_entry_entry_get(ad->item_dev_name->eo_check);
+               if (entry_str)
+                       entry_str_utf8 = elm_entry_markup_to_utf8(entry_str);
+
+               name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+
+               if (!ad->empty_flag
+                               && safeStrCmp(name_value, entry_str_utf8) != 0) {
+                       if (0 != vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
+                                       entry_str_utf8)) {
+                               SETTING_TRACE_ERROR("Set vconf[%s] failed",
+                                               VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+                       }
+               }
+               if (EINA_TRUE == elm_object_focus_get(
+                                       ad->item_dev_name->eo_check)) {
+                       elm_object_focus_set(ad->item_dev_name->eo_check,
+                                       EINA_FALSE);
+               }
+               free(name_value);
+               free(entry_str_utf8);
+       }
+       elm_naviframe_item_pop(ad->md.naviframe);
+       SETTING_TRACE_END;
+}
+
+/**
+ * @brief button cancel response callback.
+ *
+ * @param data application data
+ * @param obj the button evas object
+ * @param event_info event type
+ */
+static void __naviframe_btn_cancel_cb(void *data, Evas_Object *obj,
+               void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       setting_retm_if(data == NULL, "data is NULL");
+       char *name = NULL;
+       char *pa_sub_desc = NULL;
+       SettingAbout *ad = (SettingAbout *)data;
+       if (ad->item_dev_name && ad->item_dev_name->eo_check) {
+               name = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+               if (name)
+                       pa_sub_desc = elm_entry_utf8_to_markup(name);
+
+               if (pa_sub_desc) {
+                       elm_entry_entry_set(ad->item_dev_name->eo_check,
+                                       pa_sub_desc);
+                       G_FREE(ad->item_dev_name->sub_desc);/*release first */
+                       ad->item_dev_name->sub_desc = (char *)g_strdup(
+                                       pa_sub_desc);
+               }
+               free(name);
+               free(pa_sub_desc);
+
+               if (isSpaceStr(ad->item_dev_name->sub_desc))
+                       ad->empty_flag = TRUE;
+               else
+                       ad->empty_flag = FALSE;
+
+               SETTING_TRACE("ad->item_dev_name->sub_desc:%s",
+                               ad->item_dev_name->sub_desc);
+               if (EINA_TRUE
+                               == elm_object_focus_get(
+                                               ad->item_dev_name->eo_check)) {
+                       elm_object_focus_set(ad->item_dev_name->eo_check,
+                                       EINA_FALSE);
+               }
+       }
+       elm_naviframe_item_pop(ad->md.naviframe);
+       view_manager_pop_view(ad, ad);
+       SETTING_TRACE_END;
+}
+
+static void __popup_cb(void *data, Evas_Object *obj,
+               void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       setting_retm_if(obj == NULL, "obj parameter is NULL");
+       setting_retm_if(data == NULL, "Data parameter is NULL");
+       SettingAbout *ad = (SettingAbout *)data;
+
+       switch (btn_type(obj)) {
+       case POPUP_RESPONSE_OK:
+               if (ad->popup_space) {
+                       ad->popup_showed_flag = FALSE;
+                       evas_object_del(ad->popup_space);
+                       ad->popup_space = NULL;
+               }
+               break;
+       default:
+               break;
+       }
+}
+
+/**
+ * @brief popup response callback fuc.
+ *
+ * @param data application context
+ * @param obj Evas Object
+ * @param event_info even type
+ *
+ * @return no return
+ */
+static void __popup_rsp_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       SettingAbout *ad = (SettingAbout *)data;
+       ret_if(!ad || !obj);
+
+       switch (btn_type(obj)) {
+       case POPUP_RESPONSE_OK: {
+               if (ad->popup) {
+                       ad->popup_showed_flag = FALSE;
+
+                       evas_object_del(ad->popup);
+                       ad->popup = NULL;
+               }
+               if (ad->item_dev_name && ad->item_dev_name->eo_check) {
+                       char *name_value = NULL;
+                       name_value = vconf_get_str(
+                                       VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+                       if (NULL == name_value) {
+                               /*use the defaule name if get vconf failed*/
+                               name_value = (char *)g_strdup(
+                                               DEVICE_NAME_DEFAULT);
+                       }
+                       elm_object_focus_set(ad->item_dev_name->eo_check,
+                                       EINA_TRUE);
+                       /*for genlist update */
+                       elm_entry_entry_set(ad->item_dev_name->eo_check,
+                                       name_value);
+                       elm_entry_cursor_end_set(ad->item_dev_name->eo_check);
+                       G_FREE(ad->item_dev_name->sub_desc);/*release first */
+                       ad->item_dev_name->sub_desc = (char *)g_strdup(
+                                       name_value);
+                       FREE(name_value);
+                       SETTING_TRACE("ad->item_dev_name->sub_desc:%s",
+                                       ad->item_dev_name->sub_desc);
+                       Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)
+                                       elm_entry_imf_context_get(
+                                                       ad->item_dev_name->eo_check);
+                       if (imf_context)
+                               ecore_imf_context_input_panel_show(imf_context);
+
+               }
+               break;
+       }
+       default: {
+               break;
+       }
+       }
+
+}
+
+/**
+ * @brief callback run for idler task to destroy an popup.
+ *
+ * @param data application context
+ *
+ * @return FALSE for call it once, TRUE for call once the CPU is in idler
+ */
+static Eina_Bool __popup_remove_delay(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       SettingAbout *ad = data;
+       if (ad->popup_space) {
+               evas_object_del(ad->popup_space);
+               ad->popup_space = NULL;
+               ad->popup_showed_flag = FALSE;
+       }
+       return FALSE;
+}
+
+/**
+ * @brief callback for popup destory.
+ *
+ * @param data application context
+ * @param e Evas handler
+ * @param obj Evas object
+ * @param event_info event type
+ */
+static void __popup_del_cb(void *data, Evas *e, Evas_Object *obj,
+               void *event_info)
+
+{
+       SETTING_TRACE_BEGIN;
+       retm_if(data == NULL, "Data parameter is NULL");
+       SettingAbout *ad = (SettingAbout *)data;
+       ad->popup = NULL;
+       ad->popup_showed_flag = FALSE;
+}
+
+/**
+ * @brief callback run for idler task to show an popup.
+ *
+ * @param data application context
+ */
+static Eina_Bool __popup_show_delay(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       retvm_if(data == NULL, FALSE, "Data parameter is NULL");
+       SettingAbout *ad = (SettingAbout *)data;
+
+       /* popup the message and display the original name if the input is
+        * empty*/
+       SETTING_TRACE("POP UP again");
+
+       if (NULL == ad->popup) {
+               ad->popup_showed_flag = true;
+               ad->popup = setting_create_popup(ad, ad->md.window,
+                               "IDS_ST_HEADER_ENTER_VALID_DEVICE_NAME_ABB",
+                               "IDS_ST_POP_YOU_MUST_ENTER_A_DEVICE_NAME",
+                               __popup_rsp_cb, 0, FALSE, FALSE,
+                               1, "IDS_ST_BUTTON_OK_ABB");
+               evas_object_event_callback_add(ad->popup, EVAS_CALLBACK_DEL,
+                               __popup_del_cb, ad);
+       }
+
+       return FALSE;
+}
+
+static Evas_Object *__add_entry_without_layout(
+               Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
+{
+       SETTING_TRACE_BEGIN;
+
+       /* resolve abnormal height issue */
+       elm_genlist_mode_set(parent, ELM_LIST_COMPRESS);
+       Evas_Object *entry = NULL;
+       item_data->eo_check = entry = elm_entry_add(parent);
+       if (item_data->isPasswordFlag)
+               elm_entry_password_set(entry, EINA_TRUE);
+       else if (item_data->isSinglelineFlag)
+               elm_entry_single_line_set(entry, EINA_TRUE);
+       else
+               elm_entry_single_line_set(entry, EINA_FALSE);
+
+       elm_entry_scrollable_set(entry, EINA_TRUE);
+
+       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND,
+                       EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       if (item_data->focus_disallowed)
+               elm_object_focus_allow_set(entry, EINA_FALSE);
+
+       elm_entry_input_panel_layout_set(entry, item_data->input_type);
+       elm_entry_prediction_allow_set(entry, FALSE);
+       elm_entry_input_panel_return_key_type_set(entry,
+                       item_data->return_key_type);
+       if (item_data->disable_auto_cap) {
+               elm_entry_autocapital_type_set(entry,
+                               ELM_AUTOCAPITAL_TYPE_NONE);
+       }
+
+       if (item_data->isSinglelineFlag) {
+               elm_entry_single_line_set(entry, EINA_TRUE);
+               elm_object_signal_emit(entry, "elm,state,scroll,enabled", "");
+       }
+
+       if (item_data->limit_filter_data) {
+               elm_entry_markup_filter_append(entry,
+                               elm_entry_filter_limit_size,
+                               item_data->limit_filter_data);
+
+               if (item_data->maxlength_reached_cb) {
+                       evas_object_smart_callback_add(entry,
+                                       "maxlength,reached",
+                                       item_data->maxlength_reached_cb,
+                                       item_data);
+               }
+       }
+
+       if (item_data->stop_change_cb) {/*invoked when stop focusing on */
+               evas_object_smart_callback_add(entry, "unfocused",
+                               item_data->stop_change_cb, item_data);
+       }
+
+       if (item_data->digits_filter_data) {
+               elm_entry_markup_filter_append(entry,
+                               elm_entry_filter_accept_set,
+                               item_data->digits_filter_data);
+       }
+
+       if (item_data->sub_desc && safeStrLen(item_data->sub_desc) > 0) {
+               elm_entry_entry_set(entry, item_data->sub_desc);
+       } else {
+               if (item_data->guide_text) {
+                       /* Add guide text to elm_entry. */
+                       elm_object_part_text_set(entry, "elm.guide",
+                                       _(item_data->guide_text));
+               } else {
+                       elm_object_part_text_set(entry, "elm.guide",
+                                       _("IDS_ST_BODY_TAP_TO_INSERT"));
+               }
+       }
+
+       /* for Setting App, All the entrys's context popup shouldn't be able */
+       /* to insert images, text is the only one can be inserted. */
+       elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
+
+       if (item_data->chk_change_cb) {
+               evas_object_smart_callback_add(entry, "changed",
+                               item_data->chk_change_cb, item_data);
+               evas_object_smart_callback_add(entry, "preedit,changed",
+                               item_data->chk_change_cb, item_data);
+       }
+
+       /* callback for handling enter key */
+       if (item_data->activated_cb) {
+               evas_object_smart_callback_add(entry, "activated",
+                               item_data->activated_cb, item_data);
+       }
+
+       if (item_data->focus_cb) {
+               evas_object_smart_callback_add(entry, "focused",
+                               item_data->focus_cb, item_data);
+       }
+
+       if (item_data->start_change_cb)
+               evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN,
+                               (Evas_Object_Event_Cb)(item_data->start_change_cb),
+                               item_data->userdata);
+
+       Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)
+                       elm_entry_imf_context_get(entry);
+       if (imf_context && item_data->x_callback_cb)
+               ecore_imf_context_input_panel_event_callback_add(imf_context,
+                               ECORE_IMF_INPUT_PANEL_STATE_EVENT,
+                               item_data->x_callback_cb, item_data->userdata);
+
+       if (item_data->input_panel_disable_flag)
+               elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
+
+       if (entry && item_data->entry_auto_focus) {
+               evas_object_show(entry);
+               elm_object_focus_set(entry, EINA_TRUE);
+       }
+
+       return entry;
+}
+
+/**
+ * @brief device name entry activated callback (on Done pressed on keyboard).
+ *
+ * @param data application data SettingAbout structure
+ * @param obj the entry evas object
+ * @param event_info event type
+ */
+static void __entry_activated_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       retm_if(!data || !obj, "Data parameter is NULL");
+
+       Setting_GenGroupItem_Data *item_dev_name = data;
+       SettingAbout *ad = item_dev_name->userdata;
+       __naviframe_btn_done_cb(ad, obj, event_info);
+}
+
+/**
+ * @brief device name entry max length reached callback.
+ *
+ * @param data application data
+ * @param obj the entry evas object
+ * @param event_info event type
+ */
+static void __entry_max_len_reached(void *data, Evas_Object *obj,
+               void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       retm_if(data == NULL, "Data parameter is NULL");
+       /*notify only when entry is being focused on. */
+       retm_if(!elm_object_focus_get(obj), "Entry is not focused");
+
+       Setting_GenGroupItem_Data *list_item =
+                       (Setting_GenGroupItem_Data *)data;
+       list_item->maxLengthReachFlag = true;
+
+       SettingAbout *ad = list_item->userdata;
+       if (list_item->maxLengthReachFlag
+                       && list_item->enterKeyPressFlag == FALSE) {
+
+               if (!ad->popup_showed_flag && NULL == ad->popup_space) {
+                       /*workaroud to fix popup blink issue. */
+                       ad->popup_showed_flag = TRUE;
+                       char strMax[BUF_SIZE] = { 0, };
+                       snprintf(strMax, BUF_SIZE,
+                                       _("IDS_ST_POP_THE_MAXIMUM_NUMBERS_OF_CHARACTERS_FOR_YOUR_DEVICE_NAME_HPD_HAS_BEEN_EXCEEDED"),
+                                       MAX_DEVICE_NAME_LEN);
+
+                       ad->popup_space = setting_create_popup(ad,
+                                       ad->md.window,
+                                       "IDS_ST_HEADER_ENTER_VALID_DEVICE_NAME_ABB",
+                                       strMax, __popup_cb,
+                                       0, FALSE, FALSE, 1,
+                                       "IDS_ST_BUTTON_OK_ABB");
+               }
+       }
+}
+
+/**
+ * @brief device name entry focus callback.
+ *
+ * @param data application data
+ * @param obj the entry evas object
+ * @param event_info event type
+ *
+ * Focused callback will show X marked button and hide guidetext.
+ */
+static void __entry_focused(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       retm_if(!data || !obj, "Data parameter is NULL");
+       Setting_GenGroupItem_Data *item_dev_name = data;
+
+       /* accessibiliy */
+       elm_entry_cursor_end_set(obj);
+       const char *txt = elm_entry_entry_get(obj);
+       if (!txt || 0 == strlen(txt))
+               txt = elm_object_part_text_get(obj, "elm.guide");
+
+       /* Say entry focused */
+       Eina_Stringshare *str = eina_stringshare_printf(
+                       "%s, Edit Field, Keyboard opened", txt);
+       elm_access_say((char *)str);
+       eina_stringshare_del(str);
+
+       SettingAbout *ad = item_dev_name->userdata;
+       retm_if(!ad, "ad parameter is NULL");
+       Ecore_IMF_Context *imf_context =
+                       (Ecore_IMF_Context *)elm_entry_imf_context_get(
+                                       item_dev_name->eo_check);
+       if (imf_context)
+               ecore_imf_context_input_panel_show(imf_context);
+}
+
+/**
+ * @brief device name entry unfocus callback.
+ *
+ * @param data application data
+ * @param obj the entry evas object
+ * @param event_info event type
+ */
+static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       retm_if(!data || !obj, "Data parameter is NULL");
+
+       const char *entry_str = elm_entry_entry_get(obj);
+       char *entry_str_utf8 = NULL;
+       entry_str_utf8 = elm_entry_markup_to_utf8(entry_str);
+       SETTING_TRACE("To store \"%s\" into vconf[%s]", entry_str_utf8,
+                       VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+
+       Setting_GenGroupItem_Data *item_dev_name = data;
+       SettingAbout *ad = item_dev_name->userdata;
+
+       if (isSpaceStr(entry_str)) {
+               if (!ad->empty_flag)
+                       ad->empty_flag = TRUE;
+       } else {
+               if (ad->empty_flag)
+                       ad->empty_flag = FALSE;
+       }
+
+       if (item_dev_name->enterKeyPressFlag == TRUE) {
+               char *name_value = vconf_get_str(
+                               VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+               if (!ad->empty_flag
+                               && safeStrCmp(name_value, entry_str_utf8) != 0) {
+                       if (0 != vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR,
+                                       entry_str_utf8)) {
+                               SETTING_TRACE_ERROR("Set vconf[%s] failed",
+                                               VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+                       }
+               }
+               if (EINA_TRUE
+                               == elm_object_focus_get(
+                                               ad->item_dev_name->eo_check)) {
+                       elm_object_focus_set(ad->item_dev_name->eo_check,
+                                       EINA_FALSE);
+               }
+               FREE(name_value);
+       }
+       setting_hide_input_panel_cb(item_dev_name->eo_check);
+
+       FREE(entry_str_utf8);
+       elm_entry_select_none(obj);
+       SETTING_TRACE_END;
+}
+
+/**
+ * @brief device name entry input panel state event call back
+ *     - input panel state event:ECORE_IMF_INPUT_PANEL_STATE_EVENT
+ *
+ * @param data application data
+ * @param obj the entry evas object
+ * @param event_info event type
+ */
+static void __entry_input_panel_event_cb(void *data, Ecore_IMF_Context *ctx,
+               int value)
+{
+       SETTING_TRACE_BEGIN;
+       retm_if(data == NULL, "Data parameter is NULL");
+       retm_if(ctx == NULL, "obj parameter is NULL");
+       SettingAbout *ad = (SettingAbout *)data;
+
+       if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
+               SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_SHOW");
+       } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
+               SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_HIDE");
+
+               if (ad->item_dev_name) {
+                       if (ad->empty_flag) {
+                               ad->idler_add_popup = ecore_idler_add(
+                                               __popup_show_delay,
+                                               ad);
+                       }
+               }
+               /*if Setting is overlapped by other app,the entry will lost
+                * its focus, the input pannel will be hided and any popup
+                * should be removed to fix blinking issue.*/
+               if (ad->pause_flag) {
+                       ad->idler_remove_popup = ecore_idler_add(
+                                       __popup_remove_delay, ad);
+               }
+               elm_object_focus_set(ad->md.naviframe, EINA_FALSE);
+
+       }
+}
+
+
+static Evas_Object *__device_name_genlist_content_get(void *data,
+               Evas_Object *genlist, const char *part)
+{
+       Evas_Object *entry = NULL;
+       retv_if(!data || !genlist, NULL);
+       if (!safeStrCmp(part, "elm.icon.entry"))
+               entry = __add_entry_without_layout(data, genlist);
+
+       return entry;
+}
+
+/**
+ * @brief device name entry input handing
+ *     - get the current entry text
+ *     - check if the current input text is reached to max length
+ *       and show messge to user
+ *
+ * @param data application data
+ * @param obj the entry evas object
+ */
+static void __entry_changed_cb(void *data, Evas_Object *obj)
+{
+       retm_if(!data || !obj, "Data parameter is NULL");
+       /*return if entry is not focused too */
+
+       Setting_GenGroupItem_Data *list_item =
+                       (Setting_GenGroupItem_Data *)data;
+       SettingAbout *ad = list_item->userdata;
+       retm_if(ad == NULL, "Data parameter is NULL");
+
+       const char *entry_str = elm_entry_entry_get(obj);
+       int entry_len = safeStrLen(entry_str);
+       SETTING_TRACE("entry_str:[%s], lenght:%d", entry_str, entry_len);
+
+       SETTING_TRACE("maxLengthReachFlag:[%d], enterKeyPressFlag:%d",
+                       list_item->maxLengthReachFlag,
+                       list_item->enterKeyPressFlag);
+
+       /*fix PLM P131106-02776
+        after keyboard popup cut the entry text, the entry text don't reach
+        max length, so need to delete popup */
+       if (ad->popup_showed_flag && ad->popup_space
+                       && !list_item->maxLengthReachFlag) {
+               evas_object_del(ad->popup_space);
+               ad->popup_space = NULL;
+               ad->popup_showed_flag = FALSE;
+
+       }
+
+       list_item->maxLengthReachFlag = FALSE;
+       list_item->enterKeyPressFlag = FALSE;
+       list_item->spaceKeyPressFlag = FALSE;
+
+       /*for genlist update */
+       G_FREE(list_item->sub_desc);/*release first */
+       list_item->sub_desc = (char *)g_strdup(entry_str);
+
+       if (isSpaceStr(entry_str)) {
+               if (!ad->empty_flag)
+                       ad->empty_flag = TRUE;
+       } else {
+               if (ad->empty_flag)
+                       ad->empty_flag = FALSE;
+       }
+}
+
+
+/**
+ * @brief device name entry changed callback.
+ *
+ * @param data application data
+ * @param obj the entry evas object
+ * @param event_info event type
+ */
+static void __entry_device_name_changed_cb(void *data, Evas_Object *obj,
+               void *event_info)
+{
+       /*SETTING_TRACE_BEGIN; */
+       setting_retm_if(obj == NULL, "obj is NULL");
+       setting_retm_if(data == NULL, "data is NULL");
+       Setting_GenGroupItem_Data *list_item =
+                       (Setting_GenGroupItem_Data *)data;
+       SettingAbout *ad = list_item->userdata;
+       retm_if(ad == NULL, "Data parameter is NULL");
+
+       /* 1. entry is empty */
+       /* 2. entry is not empty */
+       if (list_item->item) {
+               if (elm_entry_is_empty(obj)) {
+                       elm_object_item_signal_emit(list_item->item,
+                                       "elm,state,eraser,hide", "");
+               } else {
+                       Eina_Bool device_focus_status = elm_object_focus_get(
+                                       ad->item_dev_name->eo_check);
+                       if (device_focus_status)
+                               elm_object_item_signal_emit(list_item->item,
+                                               "elm,state,eraser,show", "");
+               }
+               elm_object_item_signal_emit(list_item->item,
+                               "elm,state,guidetext,hide", "");
+       }
+
+       __entry_changed_cb(data, obj);
+       /*SETTING_TRACE_END; */
+}
+
+static Eina_Bool __name_view_key_down(void *data, int type, void *event)
+{
+       SETTING_TRACE_BEGIN;
+       Evas_Event_Key_Down *ev = event;
+
+       retv_if(!ev || !data, ECORE_CALLBACK_RENEW);
+
+       SettingAbout *ad = data;
+       if (!strcmp(ev->keyname, "XF86Back"))
+               __naviframe_btn_cancel_cb(ad, NULL, NULL);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __name_focus_update_cb(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       /* error check */
+       setting_retvm_if(data == NULL, ECORE_CALLBACK_RENEW,
+                       "Data parameter is NULL");
+       SettingAbout *ad = data;
+       if (ad->item_dev_name && ad->item_dev_name->eo_check) {
+               evas_object_show(ad->item_dev_name->eo_check);
+               elm_object_focus_set(ad->item_dev_name->eo_check, EINA_TRUE);
+
+               ad->name_update_idler = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       } else {
+               return ECORE_CALLBACK_RENEW;
+       }
+}
+
+static int _view_create(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       Evas_Object *list = NULL;
+       Evas_Object *btn = NULL;
+       Elm_Object_Item *navi_it = NULL;
+       Setting_GenGroupItem_Data *item_data = NULL;
+       SettingAbout *ad = data;
+       /* error check */
+       setting_retvm_if(data == NULL, -1, "Data parameter is NULL");
+
+       list = elm_genlist_add(ad->md.naviframe);
+       setting_retvm_if(list == NULL, -1,
+                       "Cannot set scroller object  as content of layout");
+       elm_genlist_clear(list);        /* first to clear list */
+
+       elm_genlist_mode_set(list, ELM_LIST_COMPRESS);
+       evas_object_smart_callback_add(list, "realized", __gl_realized_cb,
+                       NULL);
+
+       /* Device name */
+       char *name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+       char *pa_sub_desc = elm_entry_utf8_to_markup(name_value);
+       FREE(name_value);
+
+       ad->empty_flag = FALSE;
+       if (NULL == pa_sub_desc || '\0' == pa_sub_desc[0])
+               ad->empty_flag = TRUE;
+
+       elm_theme_extension_add(NULL, EDJDIR"/gl-item-entry-main.edj");
+       setting_create_Gendial_itc(SETTING_GENLIST_ENTRY_STYLE,
+                       &(ad->itc_editfield));
+       ad->itc_editfield.func.content_get = __device_name_genlist_content_get;
+
+       /* add genlist item here for the device name */
+       item_data = setting_create_Gendial_field_editfield(
+                       list,
+                       &(ad->itc_editfield),
+                       NULL,
+                       ad,
+                       SWALLOW_Type_LAYOUT_EDITFIELD,
+                       "IDS_ST_BODY_NAME",
+                       pa_sub_desc,
+                       __entry_device_name_changed_cb,
+                       __entry_focused,
+                       __entry_unfocus_cb,
+                       __entry_activated_cb,
+                       __entry_max_len_reached,
+                       ELM_INPUT_PANEL_LAYOUT_NORMAL,
+                       false,
+                       false,
+                       MAX_DEVICE_NAME_LEN,
+                       0,
+                       NULL,
+                       NULL);
+
+       if (!item_data)
+               FREE(pa_sub_desc);
+
+       setting_retvm_if(!item_data, -1, "calloc failed");
+       item_data->swallow_type = SWALLOW_Type_LAYOUT_EDITFIELD;
+       item_data->isSinglelineFlag = TRUE;
+       item_data->x_callback_cb = __entry_input_panel_event_cb;
+       item_data->guide_text = (char *)g_strdup(EMPTY_LIMITATION_STR);
+       item_data->focus_disallowed = get_tethering_status();
+       item_data->return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE;
+
+       item_data->limit_filter_data = calloc(1,
+                       sizeof(Elm_Entry_Filter_Limit_Size));
+       if (item_data->limit_filter_data) {
+               /*max byte len is 32 -> MAX_DEVICE_NAME_LEN */
+               item_data->limit_filter_data->max_byte_count =
+                               MAX_DEVICE_NAME_LEN;
+               item_data->window = ad->md.window;
+       } else {
+               SETTING_TRACE_ERROR("fail to calloc");
+       }
+
+       item_data->digits_filter_data = calloc(1,
+                       sizeof(Elm_Entry_Filter_Accept_Set));
+       if (item_data->digits_filter_data)
+               item_data->digits_filter_data->accepted = NULL;
+       else
+               SETTING_TRACE_ERROR("fail to calloc");
+
+       item_data->input_panel_disable_flag = EINA_FALSE;
+
+       ad->item_dev_name = item_data;
+       if (ad->item_dev_name) {
+               __BACK_POINTER_SET(ad->item_dev_name);
+               elm_genlist_item_select_mode_set(ad->item_dev_name->item,
+                               ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+       } else {
+               SETTING_TRACE_ERROR("ad->item_dev_name is NULL");
+       }
+
+       FREE(pa_sub_desc);
+
+       navi_it = setting_push_to_naviframe_with_back_button(DEVICE_NAME,
+                       NULL, NULL, ad, list, ad->md.naviframe);
+       elm_naviframe_item_pop_cb_set(navi_it,
+                       __child_view_back_cb, ad);
+
+       /* Title Cancel Button */
+       btn = elm_button_add(ad->md.naviframe);
+       elm_object_style_set(btn, "naviframe/title_cancel");
+       evas_object_smart_callback_add(btn, "clicked",
+                       __naviframe_btn_cancel_cb, ad);
+       elm_object_item_part_content_set(navi_it, "title_left_btn", btn);
+
+       /* Title Done Button */
+       btn = elm_button_add(ad->md.naviframe);
+       elm_object_style_set(btn, "naviframe/title_done");
+       evas_object_smart_callback_add(btn, "clicked",
+                       __naviframe_btn_done_cb, ad);
+       elm_object_item_part_content_set(navi_it, "title_right_btn", btn);
+
+       ad->event_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+                       __name_view_key_down, ad);
+       ad->name_update_idler = ecore_idler_add(
+                       __name_focus_update_cb, ad);
+
+       return 0;
+}
+
+static int _view_destroy(void *data)
+{
+       return 0;
+}
diff --git a/setting-about/src/setting-about-navigation-paths.c b/setting-about/src/setting-about-navigation-paths.c
new file mode 100644 (file)
index 0000000..f5d35c6
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * 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 "setting-about-navigation-paths.h"
+
+#include <setting-common-general-func.h>
+#include <setting-common-view-manager.h>
+#include <setting-debug.h>
+#include <efl_extension.h>
+
+#include "setting-about.h"
+#include "setting-about-status.h"
+#include "setting-about-name.h"
+
+static void __popup_regulatory_info(void *data);
+static void __certificates_clicked(void *data);
+
+static void _about_cb(const char *path, void *user_data)
+{
+       view_manager_push_view(&setting_view_about_main, user_data, user_data);
+}
+
+static void _manage_certificates_cb(const char *path, void *user_data)
+{
+       __certificates_clicked(user_data);
+}
+
+static void _regulatory_information_cb(const char *path, void *user_data)
+{
+       __popup_regulatory_info(user_data);
+}
+
+static void _legal_information_cb(const char *path, void *user_data)
+{
+       app_launcher("org.tizen.setting-license", NULL, NULL);
+}
+
+static void _software_update_cb(const char *path, void *user_data)
+{
+#ifdef SUPPORT_FOTA
+       SettingAbout *ad = (SettingAbout *)userdata;
+
+       Evas_Object *back_btn = elm_object_item_part_content_get(
+                       ad->md.naviframe_it, "prev_btn");
+
+       if (back_btn) {
+               SETTING_TRACE_DEBUG("Change focus to back_btn");
+               elm_object_focus_set(back_btn, EINA_TRUE);
+       }
+
+       app_launcher("org.tizen.oma-dm", NULL, NULL);
+#endif
+}
+
+static void _name_cb(const char *path, void *user_data)
+{
+       view_manager_push_view(&view_setting_about_name, user_data, user_data);
+}
+
+static void _status_cb(const char *path, void *user_data)
+{
+       view_manager_push_view(&view_setting_about_status, user_data, user_data);
+       //setting_view_create(&view_setting_about_status, (void *)data);
+}
+
+int setting_about_register_paths(void *data)
+{
+       navigation_init();
+    navigation_register(MAIN_PATH, _about_cb, data);
+    navigation_register(MANAGE_CERTIFICATES_PATH, _manage_certificates_cb, data);
+    navigation_register(REGULATORY_INFORMATION_PATH, _regulatory_information_cb, data);
+    navigation_register(LEGAL_INFORMATION_PATH, _legal_information_cb, data);
+    navigation_register(SOFTWARE_UPDATE_PATH, _software_update_cb, data);
+    navigation_register(NAME_PATH, _name_cb, data);
+    navigation_register(STATUS_PATH, _status_cb, data);
+    return 0;
+}
+
+/**
+ * @brief regulatory popup response cp.
+ *
+ * @param data application context
+ * @param obj evas object
+ * @param event_info event type
+ */
+
+static void __popup_regulatory_info_rsp_cb(void *data,
+               Evas_Object *obj, void *event_info)
+{
+       retm_if(data == NULL, "Data parameter is NULL");
+       evas_object_del(data);
+}
+
+/**
+ * @brief show regulatory info popup.
+ *
+ * @param data application context
+ */
+static void __popup_regulatory_info(void *data)
+{
+       SETTING_TRACE_BEGIN;
+
+       Evas_Object *popup;
+       SettingAbout *ad;
+       Evas_Object *layout;
+       Evas_Object *icon;
+       Evas_Object *btn1;
+       char buf[4096];
+
+       ad = (SettingAbout *)data;
+       popup = elm_popup_add(ad->md.layout);
+       eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK,
+                       eext_popup_back_cb, NULL);
+
+       elm_object_part_text_set(popup, "title,text",
+                       _("IDS_ST_BODY_REGULATORY_INFORMATION_ABB"));
+       layout = elm_layout_add(popup);
+       elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
+                       "popup_center_image");
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
+                       EVAS_HINT_EXPAND);
+
+       icon = elm_image_add(layout);
+       snprintf(buf, sizeof(buf), "%s/00_popup_regulatory_info.png",
+                       SETTING_ICON_PATH);
+       elm_image_file_set(icon, buf, NULL);
+       elm_image_resizable_set(icon, EINA_TRUE, EINA_TRUE);
+       elm_object_part_content_set(layout, "elm.swallow.content", icon);
+
+       evas_object_show(layout);
+       elm_object_content_set(popup, layout);
+
+       btn1 = elm_button_add(popup);
+       elm_object_style_set(btn1, "popup");
+       elm_object_text_set(btn1, _("IDS_ST_BUTTON_OK"));
+       elm_object_part_content_set(popup, "button1", btn1);
+       evas_object_smart_callback_add(btn1, "clicked",
+                       __popup_regulatory_info_rsp_cb, popup);
+       evas_object_show(popup);
+
+       SETTING_TRACE_END;
+}
+
+
+/**
+ * @brief Lunch cetificates (setting-manage-certificates-efl)
+ *
+ * @param data application data
+ */
+static void __certificates_clicked(void *data)
+{
+       app_control_h svc = NULL;
+       SettingAbout *ad = (SettingAbout *)data;
+       ret_if(!ad);
+
+       ret_if(app_control_create(&svc));
+
+       app_control_set_app_id(svc, "setting-manage-certificates-efl");
+       app_control_set_launch_mode(svc, APP_CONTROL_LAUNCH_MODE_GROUP);
+       app_control_send_launch_request(svc, NULL, NULL);
+       app_control_destroy(svc);
+}
index 1b628833f5870d2b129b344cde189f83bc544b99..469c14a9dedd40468dd7f049dc35401fa618a8d1 100644 (file)
@@ -24,6 +24,8 @@
 #include <bluetooth.h>
 #include <wifi-manager.h>
 
+#include <setting-common-view-manager.h>
+
 #include "setting-about.h"
 #include "setting-about-main.h"
 
@@ -119,7 +121,12 @@ static Eina_Bool _naviframe_item_pop_cb(void *data, Elm_Object_Item *it)
        SETTING_TRACE_BEGIN;
        SettingAbout *ad = (SettingAbout *)data;
        retv_if(!ad, EINA_FALSE);
+
+#if 0
        setting_view_destroy(&view_setting_about_status, ad);
+#else
+       view_manager_pop_view(ad, ad);
+#endif
        return EINA_TRUE;
 }
 
index d4dbb680f952e2ae90d9c183269f07745b632b5d..a0796039f667d80c089f2d23e9ab0068a255b805 100755 (executable)
 #include "setting-about-main.h"
 #include "setting-cfg.h"
 
+#include <setting-common-draw-widget.h>
+#include <setting-common-navigation-helpers.h>
+#include "setting-about-navigation-paths.h"
+
 #define SETTING_ABOUT_PACKAGE_NAME "org.tizen.setting-about"
 
 static void _lang_changed(app_event_info_h event_info, void *data)
@@ -39,6 +43,26 @@ static void _lang_changed(app_event_info_h event_info, void *data)
        }
 }
 
+static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it)
+{
+       SETTING_TRACE_BEGIN;
+       SettingAbout *ad = (SettingAbout *)data;
+
+       if (!ad || ad->empty_flag)
+               return EINA_FALSE;
+
+       /* imf must be hided before view is destroyed. */
+       /* Following code is just to improve the hiding speed. If not add these
+        * code, the input pannel will also be hided with the view destroyed,
+        * but it works too slow. */
+       if (ad->item_dev_name) {
+               elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
+               setting_hide_input_panel_cb(ad->item_dev_name->eo_check);
+       }
+       ui_app_exit();
+       return EINA_TRUE;
+}
+
 static bool on_app_create(void *data)
 {
        SETTING_TRACE_BEGIN;
@@ -52,10 +76,12 @@ static bool on_app_create(void *data)
        }
 
        /* register view node table */
+#if 0
        setting_view_node_table_intialize();
        setting_view_node_table_register(&setting_view_about_main, NULL);
+#endif
 
-       /*      creating a view. */
+       /* creating a view. */
        setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE,
                        &(ad->itc_1text));
        setting_create_Gendial_itc(SETTING_GENLIST_2LINE_STYLE,
@@ -67,11 +93,20 @@ static bool on_app_create(void *data)
        setting_create_Gendial_itc(SETTING_GENLIST_ENTRY_STYLE,
                        &(ad->itc_editfield));
 
+#if 0
        setting_view_node_set_cur_view(&setting_view_about_main);
        setting_view_create(&setting_view_about_main, (void *)ad);
 
        ad->popup_showed_flag = FALSE;
        evas_object_show(ad->md.window);
+#else
+       int ret = view_init(&ad->md, _("IDS_ST_BODY_ABOUT_DEVICE"));
+       if (ret != SETTING_RETURN_SUCCESS)
+               return ret;
+       setting_add_back_button(&ad->md, _view_pop_cb, ad);
+       setting_about_register_paths(ad);
+#endif
+
        return true;
 }
 
@@ -80,6 +115,8 @@ static void on_app_control(app_control_h service, void *priv)
        SETTING_TRACE_BEGIN;
        SettingAbout *ad = priv;
        evas_object_show(ad->md.window);
+
+       setting_helper_process_launch_or_exit(service, MAIN_PATH);
 }
 
 static void on_app_pause(void *data)
index f26e440e898b6ae716cd6d1de625e1ca808704f6..e57eb6cfb2254aaafb48bf60a6bb44567c0a77ab 100755 (executable)
@@ -50,6 +50,9 @@ ADD_LIBRARY(${LIB_SETTING_COMMON} SHARED
        ./src/setting-common-draw-widget.c
        ./src/setting-common-general-func.c
        ./src/setting-common-init.c
+       ./src/setting-common-navigation-helpers.c
+       ./src/setting-common-navigation.c
+       ./src/setting-common-view-manager.c
        ./src/setting-common-view.c
        ./src/controls/confirm-popup.c
        ./src/controls/enter-text-popup.c
index 3adfd2db2a7761c3a7ba03acfbb61c9f53cf43fd..4483843cf22b2c837ab190938700f377a78deafe 100755 (executable)
@@ -53,6 +53,7 @@ extern char *remove_first_substring(const char *parent, const char *pat);
 extern int safeStrLen(const char *str);
 extern char *safeStrStr(const char *str, const char *strSearch);
 extern char *safeStrRStr(const char *str, const char *strSearch);
+extern char *safeStrDup(const char *str);
 
 extern int is_slp_binary();
 extern bool isEmulBin();
@@ -68,6 +69,7 @@ extern int app_launcher(const char *pkg_name, app_control_reply_cb callback,
 extern int app_launcher_svc(const char *pkg_name, app_control_h service,
                app_control_reply_cb callback, void *user_data);
 extern int app_group_launcher(const char *pkg_name);
+extern int app_launcher_navigation_path(const char *pkg_name, const char *navigation_path);
 
 extern bool get_tethering_status();
 extern const char *get_font_size_str(int value);
diff --git a/setting-common/include/setting-common-navigation-helpers.h b/setting-common/include/setting-common-navigation-helpers.h
new file mode 100644 (file)
index 0000000..006d2f4
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef __SETTING_COMMON_NAVIGATION_HELPERS_H__
+#define __SETTING_COMMON_NAVIGATION_HELPERS_H__
+
+#include <app_control.h>
+
+int setting_helper_process_launch_or_exit(app_control_h app, const char *default_path);
+
+#endif /* __SETTING_COMMON_NAVIGATION_HELPERS_H__ */
diff --git a/setting-common/include/setting-common-navigation.h b/setting-common/include/setting-common-navigation.h
new file mode 100644 (file)
index 0000000..e34a31a
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef __SETTING_COMMON_NAVIGATION_H__
+#define __SETTING_COMMON_NAVIGATION_H__
+
+typedef void (*navigation_cb)(const char *path, void *user_data);
+
+#define PATH_KEY "path"
+#define SETTING_BASE_PATH "http://org.tizen/metadata/setting"
+#define REGEX_SETTING_BASE_PATH "http:\\/\\/org.tizen\\/metadata\\/setting"
+
+int navigation_init();
+int navigation_fini();
+int navigation_navigate_to(const char *path);
+int navigation_register(const char *path, navigation_cb navigate_callback, void *user_data);
+
+#endif /* __SETTING_COMMON_NAVIGATION_H__ */
index eeda3fc3b6ac0b6f033349526f6b7ed06efd80a0..962e8385c518d268748e976bf9f254049fe76aa9 100755 (executable)
 
 #include "setting-common-string.h"
 
+
+#define IMG_SEARCH     SETTING_LIST_ICON_PATH_CFG"setting_search_activegrey.png"
+#define IMG_SEARCH_BG  SETTING_LIST_ICON_PATH_CFG"setting_search_bgactive.png"
+
 /* connectivity IMG*/
 #define IMG_WiFi       SETTING_LIST_ICON_PATH_CFG"settings_wifi.png"
 #define IMG_Bluetooth  SETTING_LIST_ICON_PATH_CFG"settings_bluetooth.png"
diff --git a/setting-common/include/setting-common-view-manager.h b/setting-common/include/setting-common-view-manager.h
new file mode 100644 (file)
index 0000000..8338d74
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef __SETTING_COMMON_VIEW_MANAGER_H__
+#define __SETTING_COMMON_VIEW_MANAGER_H__
+
+#include "setting-common-view.h"
+
+void view_manager_push_view(setting_view *view, void *cleanup_data, void *create_data);
+setting_view *view_manager_pop_view(void *destroy_data, void *update_data);
+setting_view *view_manager_peek_view();
+void view_manager_update_front_view(void *data);
+unsigned int view_manager_views_count();
+
+#endif /* __SETTING_COMMON_VIEW_MANAGER_H__ */
index 7a26d7452cdbc20f3e55c56663f2324e2ae17b79..b57c56c234760c1879aaf7135f602084eef79e8a 100755 (executable)
@@ -21,6 +21,7 @@
 
 #include "setting-common-general-func.h"
 #include "setting-common-data-slp-setting.h"
+#include "setting-common-navigation.h"
 
 #include <system_info.h>
 #include <system_settings.h>
@@ -555,6 +556,14 @@ EXPORT_PUBLIC char *safeStrRStr(const char *str, const char *strSearch)
        return last;
 }
 
+EXPORT_PUBLIC char *safeStrDup(const char *str)
+{
+       if (!str)
+               return NULL;
+
+       return strdup(str);
+}
+
 /* SLP : 1 */
 /* not SLP : 0 */
 EXPORT_PUBLIC
@@ -843,7 +852,7 @@ EXPORT_PUBLIC int app_group_launcher(const char *pkg_name)
                ret = 0;
        } else {
                /* on error */
-               SETTING_TRACE("on error");
+               SETTING_TRACE("launch request error: %s", get_error_message(launch_ret));
                ret = -1;
        }
        app_control_destroy(service);
@@ -854,6 +863,57 @@ EXPORT_PUBLIC int app_group_launcher(const char *pkg_name)
        return ret;
 }
 
+EXPORT_PUBLIC int app_launcher_navigation_path(const char *pkg_name, const char *navigation_path)
+{
+       app_control_h app;
+       int ret;
+
+       ret = app_control_create(&app);
+       if(ret) {
+               SETTING_TRACE_DEBUG("Error %d - %s", ret, get_error_message(ret));
+               return ret;
+       }
+
+       ret = app_control_set_operation(app, APP_CONTROL_OPERATION_PICK);
+       if(ret) {
+               SETTING_TRACE_DEBUG("Error %d - %s", ret, get_error_message(ret));
+               app_control_destroy(app);
+               return ret;
+       }
+
+       ret = app_control_set_launch_mode(app, APP_CONTROL_LAUNCH_MODE_GROUP);
+       if(ret) {
+               SETTING_TRACE_DEBUG("Error %d - %s", ret, get_error_message(ret));
+               app_control_destroy(app);
+               return ret;
+       }
+
+       ret = app_control_set_app_id(app, pkg_name);
+       if(ret) {
+               SETTING_TRACE_DEBUG("Error %d - %s", ret, get_error_message(ret));
+               app_control_destroy(app);
+               return ret;
+       }
+
+       ret = app_control_add_extra_data(app, PATH_KEY, navigation_path);
+       if(ret) {
+               SETTING_TRACE_DEBUG("Error %d - %s", ret, get_error_message(ret));
+               app_control_destroy(app);
+               return ret;
+       }
+
+       ret = app_control_send_launch_request(app, NULL, NULL);
+       if(ret) {
+               SETTING_TRACE_DEBUG("Error %d - %s", ret, get_error_message(ret));
+               app_control_destroy(app);
+               return ret;
+       }
+
+       SETTING_TRACE_DEBUG("App %s launched with path %s", pkg_name, navigation_path);
+       app_control_destroy(app);
+       return ret;
+}
+
 EXPORT_PUBLIC bool get_tethering_status()
 {
        /* check status of tethering */
diff --git a/setting-common/src/setting-common-navigation-helpers.c b/setting-common/src/setting-common-navigation-helpers.c
new file mode 100644 (file)
index 0000000..58a1f69
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  * 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 "setting-common-navigation-helpers.h"
+
+ #include <stdlib.h>
+ #include <app.h>
+ #include <app_manager.h>
+ #include "setting-common-navigation.h"
+ #include "setting-common-view-manager.h"
+ #include "setting-debug.h"
+
+ EXPORT_PUBLIC int setting_helper_process_launch_or_exit(app_control_h app, const char *default_path)
+ {
+    const char *launch_path = NULL;
+
+    /* check, if launched with path */
+
+    int ret = app_control_get_extra_data(app, PATH_KEY, &launch_path);
+
+    if(ret != APP_CONTROL_ERROR_NONE) {
+        SETTING_TRACE_DEBUG("Path cannot be retrieved - %s; Setting path as %s", get_error_message(ret), default_path);
+        navigation_navigate_to(default_path);
+    } else {
+        navigation_navigate_to(launch_path);
+        free(launch_path);
+    }
+
+    /* if view stack is empty, close */
+
+    if(view_manager_views_count() == 0) {
+        ui_app_exit();
+    }
+    return 0;
+}
diff --git a/setting-common/src/setting-common-navigation.c b/setting-common/src/setting-common-navigation.c
new file mode 100644 (file)
index 0000000..424580a
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * 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 "setting-common-navigation.h"
+#include <string.h>
+#include <stdlib.h>
+
+#include "setting-common-general-func.h"
+#include "setting-debug.h"
+
+#define START_SIZE 10
+
+typedef struct path_info {
+       navigation_cb entry;
+       char *path;
+       void *data;
+} path_info_t;
+
+typedef struct module {
+       path_info_t *paths;
+       int paths_size;
+       int reserved;
+} module_t;
+
+static module_t g_module = {0, };
+
+static int _realloc_capacity(module_t *module)
+{
+       path_info_t *p = realloc(module->paths, module->reserved*2*sizeof(path_info_t));
+       if(p == NULL) {
+               SETTING_TRACE_ERROR("Cannot reallocate memory");
+               return -1;
+       }
+       module->paths = p;
+       module->reserved *= 2;
+       return 0;
+}
+
+EXPORT_PUBLIC
+int navigation_init()
+{
+       g_module.paths = (path_info_t*) malloc(START_SIZE*sizeof(path_info_t));
+       if(!g_module.paths) {
+               SETTING_TRACE_ERROR("Cannot allocate memory for paths");
+               return -1;
+       }
+       g_module.reserved = START_SIZE;
+       return 0;
+}
+
+EXPORT_PUBLIC
+int navigation_fini()
+{
+       for(int i = 0; i < g_module.paths_size; ++i ) {
+               free(g_module.paths[i].path);
+       }
+       g_module.reserved = 0;
+       g_module.paths_size = 0;
+       free(g_module.paths);
+       return 0;
+}
+
+EXPORT_PUBLIC
+int navigation_navigate_to(const char *path)
+{
+       for(int i = 0; i < g_module.paths_size; ++i) {
+               if(!strcmp(path, g_module.paths[i].path)) {
+                       if(g_module.paths[i].entry) {
+                               SETTING_TRACE_DEBUG("Navigating to %s", path);
+                               g_module.paths[i].entry(g_module.paths[i].path, g_module.paths[i].data);
+                               return 0;
+                       } else {
+                               SETTING_TRACE_ERROR("Nullpointer callback for registered path");
+                               return -2;
+                       }
+               }
+       }
+       SETTING_TRACE_ERROR("Path %s was not registered", path);
+       return -1;
+}
+
+EXPORT_PUBLIC
+int navigation_register(const char *path, navigation_cb navigate_callback, void *user_data)
+{
+       if(!navigate_callback) {
+               SETTING_TRACE_ERROR("Callback for path cannot be null");
+               return -1;
+       }
+       for(int i = 0; i < g_module.paths_size; ++i) {
+               if(!strcmp(path, g_module.paths[i].path)) {
+                       SETTING_TRACE_WARNING("Path %s was already registered", path);
+                       return -1;
+               }
+       }
+       if(g_module.reserved == g_module.paths_size + 1) {
+               if(_realloc_capacity(&g_module) < 0) {
+                       return -1;
+               }
+       }
+       g_module.paths[g_module.paths_size].path = strdup(path);
+       g_module.paths[g_module.paths_size].entry = navigate_callback;
+       g_module.paths[g_module.paths_size].data = user_data;
+       g_module.paths_size++;
+       return 0;
+}
diff --git a/setting-common/src/setting-common-view-manager.c b/setting-common/src/setting-common-view-manager.c
new file mode 100644 (file)
index 0000000..5acff3b
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * 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 "setting-common-view-manager.h"
+
+#include <app.h>
+#include <glib.h>
+#include "setting-common-view.h"
+#include "setting-common-general-func.h"
+
+#include "setting-debug.h"
+
+typedef struct module {
+       GQueue *stack;
+} module_s;
+
+static module_s g_module = {0,};
+
+static void _init(module_s *module)
+{
+       if(module->stack) {
+               return;
+       }
+       module->stack = g_queue_new();
+}
+
+static void _fini(module_s *module)
+{
+       if(module->stack == NULL) {
+               return;
+       }
+       g_queue_free(module->stack);
+       module->stack = NULL;
+}
+
+static void _close(module_s *module)
+{
+       _fini(module);
+       ui_app_exit();
+}
+
+static void _push_view(module_s *module, setting_view *view)
+{
+       g_queue_push_head(module->stack, (void*) view);
+}
+
+static setting_view *_pop_view(module_s *module)
+{
+       return (setting_view*) g_queue_pop_head(module->stack);
+}
+
+static setting_view *_peek_view(module_s *module)
+{
+       return (setting_view*) g_queue_peek_head(module->stack);
+}
+
+EXPORT_PUBLIC
+void view_manager_push_view(setting_view *view, void *cleanup_data, void *create_data)
+{
+       if(g_module.stack == NULL) {
+               _init(&g_module);
+       }
+       if(g_module.stack->length > 0) {
+               setting_view_cleanup(_peek_view(&g_module), cleanup_data);
+       }
+       _push_view(&g_module, view);
+       setting_view_create(view, create_data);
+}
+
+EXPORT_PUBLIC
+setting_view *view_manager_pop_view(void *destroy_data, void *update_data)
+{
+       setting_view *view = _pop_view(&g_module);
+       setting_view_destroy(view, destroy_data);
+       if(g_module.stack->length == 0) {
+               SETTING_TRACE("No more views on stack - closing app");
+               _close(&g_module);
+       } else {
+               setting_view_update(_peek_view(&g_module), update_data);
+       }
+       return view;
+}
+
+EXPORT_PUBLIC
+setting_view *view_manager_peek_view()
+{
+       return _peek_view(&g_module);
+}
+
+EXPORT_PUBLIC
+void view_manager_update_front_view(void *data)
+{
+       setting_view_update(_peek_view(&g_module), data);
+}
+
+EXPORT_PUBLIC
+unsigned int view_manager_views_count()
+{
+       return g_module.stack->length;
+}
diff --git a/setting-search/CMakeLists.txt b/setting-search/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8b0d443
--- /dev/null
@@ -0,0 +1,52 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include)
+
+SET(PROJECT_SETTING_SEARCH "setting-search")
+SET(SETTING_PKG_SEARCH "org.tizen.setting-search")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs_search REQUIRED
+       capi-appfw-application
+       capi-system-system-settings
+       dlog
+       efl-extension
+       elementary
+       notification
+       vconf
+       capi-appfw-app-manager
+       pkgmgr
+       pkgmgr-info
+       capi-appfw-package-manager
+)
+
+FOREACH(flag ${pkgs_search_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE -Werror-implicit-function-declaration")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+       ADD_DEFINITIONS("-DTARGET")
+       MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+ADD_DEFINITIONS("-shared")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+ADD_EXECUTABLE(${PROJECT_SETTING_SEARCH}
+       ./src/setting-search-app.c
+       ./src/setting-search-common.c
+       ./src/setting-search-main.c
+       ./src/setting-search-util.c
+       )
+
+TARGET_LINK_LIBRARIES(${PROJECT_SETTING_SEARCH} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common)
+TARGET_LINK_LIBRARIES(${PROJECT_SETTING_SEARCH} ${pkgs_search_LDFLAGS} -pie)
+
+INSTALL(PROGRAMS ${PROJECT_SETTING_SEARCH} DESTINATION ${TZ_SYS_RO_APP}/${SETTING_PKG_NAME}/bin)
diff --git a/setting-search/include/setting-search-app.h b/setting-search/include/setting-search-app.h
new file mode 100644 (file)
index 0000000..91f68dc
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ */
+#ifndef __SETTING_NOTIFICATION_H__
+#define __SETTING_NOTIFICATION_H__
+
+#include "setting-common-init.h"
+#include "setting-common-general-func.h"
+#include "setting-common-draw-widget.h"
+#include "setting-common-view.h"
+
+#include "setting-search-util.h"
+
+
+typedef struct _SettingSearchData SettingSearchData;
+
+/**
+ * Setting Notification UG context
+ * all UG function has void* as an agument. this is casted back to
+ * _SettingSearchData and the functions access app context.
+ */
+struct _SettingSearchData {
+       MainData md;
+
+
+       Evas_Object *search_bar;
+       char *last_search;
+       search_result_t **results;
+       int results_size;
+       Elm_Genlist_Item_Class *search_result_itc;
+       Elm_Genlist_Item_Class *search_bar_itc;
+
+};
+
+extern setting_view setting_view_search_main;
+
+#endif
diff --git a/setting-search/include/setting-search-util.h b/setting-search/include/setting-search-util.h
new file mode 100644 (file)
index 0000000..6241c4b
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef __SETTING_SEARCH_H__
+#define __SETTING_SEARCH_H__
+
+typedef struct search_result search_result_t;
+
+search_result_t **setting_search(const char *name, int *size);
+void setting_search_free(search_result_t *result);
+void setting_search_free_all(search_result_t **results, int size);
+const char *search_result_get_path(search_result_t *result);
+const char *search_result_get_title(search_result_t *result);
+const char *search_result_get_icon_path(search_result_t *result);
+const char *search_result_get_app_id(search_result_t *result);
+const char **search_result_get_matching_values(search_result_t *result);
+unsigned int search_result_get_matching_values_size(search_result_t *result);
+
+#endif
diff --git a/setting-search/src/setting-search-app.c b/setting-search/src/setting-search-app.c
new file mode 100644 (file)
index 0000000..c368b4a
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * 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 "setting-debug.h"
+#include "setting-common-data-type.h"
+#include "setting-common-general-func.h"
+
+#include "setting-search-app.h"
+
+#define SETTING_SEARCH_PACKAGE_NAME "org.tizen.setting-search"
+
+
+static bool _setting_search_app_create(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+       SettingSearchData *ad = priv;
+       retv_if(!ad, NULL);
+
+       if (app_init(&ad->md, SETTING_SEARCH_PACKAGE_NAME)
+                       != SETTING_RETURN_SUCCESS) {
+               SETTING_TRACE_ERROR("Cannot initialize application");
+               return false;
+       }
+
+
+       bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR);
+
+       /* register view node table */
+       setting_view_node_table_intialize();
+       setting_view_node_table_register(&setting_view_search_main, NULL);
+
+       /* creating a view. */
+       setting_view_node_set_cur_view(&setting_view_search_main);
+       setting_view_create(&setting_view_search_main, (void *)ad);
+
+       evas_object_show(ad->md.window);
+
+       return true;
+}
+
+static void _setting_search_app_pause(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+       ret_if(priv == NULL);
+}
+
+static void _setting_search_app_resume(void *priv)
+{
+       ret_if(priv == NULL);
+       SettingSearchData *appdata = (SettingSearchData *)priv;
+}
+
+static void _setting_search_app_terminate(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+       ret_if(priv == NULL);
+       SettingSearchData *ad = priv;
+
+       /* it is the view manage strategy to invoke view's destory operation */
+       setting_view_destroy(&setting_view_search_main, ad);
+
+       SETTING_TRACE_END;
+}
+
+static void _setting_search_lang_changed(app_event_info_h event_info, void *data)
+{
+       char *lang = NULL;
+
+       if (app_event_get_language(event_info, &lang) == APP_ERROR_NONE) {
+               SETTING_TRACE_DEBUG("Setting - language is changed : %s", lang);
+               elm_language_set(lang);
+               elm_config_all_flush();
+               free(lang);
+       } else {
+               SETTING_TRACE_ERROR("Cannot get language from event_info");
+       }
+}
+
+EXPORT_PUBLIC
+int main(int argc, char *argv[])
+{
+       app_event_handler_h handlers[5] = {NULL, };
+       ui_app_lifecycle_callback_s ops = {
+               .create = _setting_search_app_create,
+               .pause = _setting_search_app_pause,
+               .resume = _setting_search_app_resume,
+               .terminate = _setting_search_app_terminate,
+               .app_control = NULL
+       };
+
+       SettingSearchData app_data;
+       memset(&app_data, 0, sizeof(SettingSearchData));
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY],
+                       APP_EVENT_LOW_MEMORY, NULL, NULL);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY],
+                       APP_EVENT_LOW_BATTERY, NULL, NULL);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+                       APP_EVENT_LANGUAGE_CHANGED, _setting_search_lang_changed,
+                       &app_data);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
+                       APP_EVENT_REGION_FORMAT_CHANGED, NULL, NULL);
+       ui_app_add_event_handler(
+                       &handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED],
+                       APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, NULL);
+
+       return ui_app_main(argc, argv, &ops, &app_data);
+}
diff --git a/setting-search/src/setting-search-common.c b/setting-search/src/setting-search-common.c
new file mode 100644 (file)
index 0000000..6264075
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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 "setting-search-app.h"
+
+
+
diff --git a/setting-search/src/setting-search-main.c b/setting-search/src/setting-search-main.c
new file mode 100644 (file)
index 0000000..2f83dbc
--- /dev/null
@@ -0,0 +1,423 @@
+/*
+ * 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 <notification_setting.h>
+//#include <notification_setting_internal.h>
+
+#include "setting-search-app.h"
+// #include "setting-common-data-type.h"
+#include <setting-common-general-func.h>
+#include <app_manager.h>
+#include <setting-search-util.h>
+#include <system_info.h>
+#include <efl_extension.h>
+
+
+#define DO_NOT_DISTURB_OP \
+       "http://tizen.org/appcontrol/operation/setting/do_not_disturb"
+#define APP_SEARCH_OP \
+       "http://tizen.org/appcontrol/operation/setting/app_search"
+
+static int _view_create(void *cb);
+static int _view_destroy(void *cb);
+static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it);
+static void _mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
+               void *event_info);
+
+static void _get_lite_main_list(void *data);
+
+static Evas_Object *_setting_search_bar_create(SettingSearchData *ad);
+static void _search_bar_changed_cb(void *data, Evas_Object *obj, void *event_info);
+
+setting_view setting_view_search_main = {
+       .create = _view_create,
+       .destroy = _view_destroy,
+       .update = NULL,
+       .cleanup = NULL
+};
+
+
+static char* _search_result_txt_cb(void *data, Evas_Object *obj, const char *part)
+{
+       if (!strcmp(part, "elm.text") && data) {
+               search_result_t *result = (search_result_t*) data;
+               return safeStrDup(search_result_get_title(result));
+       }
+
+       return NULL;
+}
+
+static Elm_Genlist_Item_Class *_setting_search_result_item_class_create()
+{
+       Elm_Genlist_Item_Class *_search_result_itc = elm_genlist_item_class_new();
+       _search_result_itc->item_style = "group_index";
+       _search_result_itc->func.text_get = _search_result_txt_cb;
+
+       return _search_result_itc;
+}
+
+static void _path_selected(void *data, Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       search_result_t *result = (search_result_t *)data;
+       app_launcher_navigation_path(search_result_get_app_id(result), search_result_get_path(result));
+
+       SETTING_TRACE_END;
+}
+
+static void _view_search_result_getter(SettingSearchData *ad)
+{
+       SETTING_TRACE_BEGIN;
+       if(!ad->search_result_itc) {
+               ad->search_result_itc = _setting_search_result_item_class_create();
+       }
+       if(ad->results) {
+               setting_search_free_all(ad->results,ad->results_size);
+       }
+       ad->results = setting_search(ad->last_search, &(ad->results_size));
+       SETTING_TRACE_DEBUG("Search finished, found %d results", ad->results_size);
+       for(int i = 0; i<ad->results_size; ++i) {
+               Elm_Widget_Item *ret = elm_genlist_item_append(ad->md.genlist, ad->search_result_itc, ad->results[i], NULL, ELM_GENLIST_ITEM_NONE, _path_selected, ad->results[i]);
+               if(!ret) {
+                       SETTING_TRACE_DEBUG("Failed to append search result to list");
+               }
+       }
+       SETTING_TRACE_END;
+}
+
+static void _genlist_items_clear(SettingSearchData *ad)
+{
+       Evas_Object *item = elm_genlist_last_item_get(ad->md.genlist);
+       if(item == NULL) {
+               return;
+       }
+       Evas_Object *first = elm_genlist_first_item_get(ad->md.genlist);
+       while(item != first) {
+               elm_object_item_del(item);
+               item = elm_genlist_last_item_get(ad->md.genlist);
+       }
+}
+
+
+static void _naviframe_search_cb(void *data, Evas_Object *obj, void *event_info)
+{
+
+       _search_bar_changed_cb(data, obj, event_info);
+#if 0
+       setting_main_appdata *ad = (setting_main_appdata *)data;
+       ret_if(NULL == ad);
+
+       app_group_launcher("org.tizen.setting-search");
+
+//     elm_genlist_item_append(ad->md.genlist, ad->search_bar_itc, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+#endif
+}
+
+
+static void _search_bar_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       SettingSearchData *ad = (SettingSearchData *) data;
+       if(ad->last_search) {
+               free(ad->last_search);
+       }
+       ad->last_search = strdup(elm_entry_entry_get(obj));
+       _genlist_items_clear(ad);
+       if(!strcmp(ad->last_search, "")) {
+               SETTING_TRACE_DEBUG("Entry is empty, returning to applist view");
+               _get_lite_main_list(ad);
+       } else {
+               SETTING_TRACE_DEBUG("Entry is not empty, processing search text %s", ad->last_search);
+               _view_search_result_getter(ad);
+       }
+}
+
+static Evas_Object * _genlist_search_bar_cb(void *data, Evas_Object *obj, const char *part)
+{
+       SettingSearchData *ad = (SettingSearchData *) data;
+       Evas_Object *content = NULL;
+       if(!strcmp(part, "elm.swallow.content")) {
+               ad->search_bar = _setting_search_bar_create(ad);
+               content = ad->search_bar;
+       }
+       return content;
+}
+
+static Elm_Genlist_Item_Class *_setting_search_bar_item_class_create()
+{
+       Elm_Genlist_Item_Class *_search_bar_itc = elm_genlist_item_class_new();
+               _search_bar_itc->item_style = "full";
+               _search_bar_itc->func.text_get     = NULL;
+               _search_bar_itc->func.content_get  = _genlist_search_bar_cb;
+               _search_bar_itc->func.state_get    = NULL;
+               _search_bar_itc->func.del          = NULL;
+
+       return _search_bar_itc;
+}
+
+static Evas_Object *_setting_search_bar_create(SettingSearchData *ad)
+{
+       Evas_Object *search_bar = elm_entry_add(ad->md.genlist);
+       elm_entry_entry_set(search_bar, ad->last_search);
+       evas_object_size_hint_weight_set(search_bar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_entry_input_panel_layout_set(search_bar, ELM_INPUT_PANEL_LAYOUT_TERMINAL);
+       elm_object_part_text_set(search_bar, "guide", "Search");
+       evas_object_show(search_bar);
+       evas_object_smart_callback_add(search_bar, "changed,user", _search_bar_changed_cb, ad);
+       return search_bar;
+}
+
+static void
+entry_activated_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       printf("enter key clicked!!\n");
+}
+
+
+/* ***************************************************
+ *
+ * Public functions
+ *
+ ***************************************************/
+
+/* ***************************************************
+ *
+ * basic func
+ *
+ ***************************************************/
+
+static void _get_lite_main_list(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       ret_if(!data);
+       SettingSearchData *ad = (SettingSearchData *)data;
+
+       Evas_Object *genlist = ad->md.genlist;
+
+       elm_genlist_block_count_set(genlist, 3);
+       elm_genlist_homogeneous_set(genlist, EINA_FALSE);
+
+#if 0
+       /* Search - Do not disturb */
+       const char *sub_desc = setting_search_do_not_disturb_is_enable(data);
+       ad->data_do_not_disturb = setting_create_Gendial_field_def(
+                       genlist,
+                       &itc_2text_2,
+                       _mouse_up_Gendial_list_cb,
+                       data,
+                       SWALLOW_Type_INVALID,
+                       NULL,
+                       NULL,
+                       0,
+                       "IDS_ST_MBODY_DO_NOT_DISTURB_ABB",
+                       sub_desc,
+                       NULL);
+       if (!ad->data_do_not_disturb)
+               SETTING_TRACE_ERROR("ad->data_do_not_disturb is NULL");
+
+       /* Search - App search */
+       setting_create_Gendial_field_def(
+                       genlist,
+                       &itc_2text_2,
+                       _mouse_up_Gendial_list_cb,
+                       data,
+                       SWALLOW_Type_INVALID,
+                       NULL,
+                       NULL,
+                       0,
+                       "IDS_ST_MBODY_APP_SEARCH",
+                       "IDS_ST_BODY_ALLOW_OR_BLOCK_SEARCH_FROM_"
+                       "INDIVIDUAL_APPLICATIONS",
+                       NULL);
+#endif
+
+       ad->md.genlist = genlist;
+
+       elm_genlist_item_append(ad->md.genlist, ad->search_bar_itc, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+}
+
+static void _click_softkey_back_cb(void *data,
+               Evas_Object *obj, void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+       SettingSearchData *ad = (SettingSearchData *)data;
+       ret_if(!ad);
+       elm_naviframe_item_pop(ad->md.naviframe);
+}
+
+static int _view_create(void *cb)
+{
+       Evas_Object *back_button = NULL;
+
+       SETTING_TRACE_BEGIN;
+       retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+       SettingSearchData *ad = (SettingSearchData *) cb;
+
+       int ret = view_init(&ad->md, "Search");
+       if (ret != SETTING_RETURN_SUCCESS)
+               return ret;
+
+       ad->search_bar_itc = _setting_search_bar_item_class_create();
+
+
+
+       Evas_Object *box = elm_box_add(ad->md.naviframe);
+       elm_box_horizontal_set(box, EINA_TRUE);
+       elm_box_padding_set(box, ELM_SCALE_SIZE(40), 0);
+
+
+       /* Single Entry */
+       Evas_Object *entry = elm_entry_add(ad->md.naviframe);
+       elm_entry_single_line_set(entry, EINA_TRUE);
+       elm_entry_scrollable_set(entry, EINA_TRUE);
+       eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
+       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_smart_callback_add(entry, "activated", entry_activated_cb, NULL);
+
+       evas_object_show(entry);
+
+       elm_box_pack_end(box, entry);
+       //elm_object_part_content_set(layout, "entry_part", entry);
+
+
+       /* Icon Button */
+       Evas_Object *search_button = elm_button_add(ad->md.naviframe);
+       elm_object_style_set(search_button, "icon");
+
+       evas_object_smart_callback_add(search_button, "clicked", _naviframe_search_cb, ad);
+
+       evas_object_show(search_button);
+
+       /* Icon Button image */
+       Evas_Object *img = elm_image_add(search_button);
+       elm_image_file_set(img, IMG_SEARCH, NULL);
+       elm_object_part_content_set(search_button, "icon", img);
+
+       elm_box_pack_end(box, search_button);
+
+       /* Title Content */
+       elm_object_item_part_content_set(ad->md.naviframe_it, "title_content", box);
+
+
+       _get_lite_main_list(ad);
+
+       back_button = setting_create_button(ad->md.naviframe,
+                       _(NULL), NAVI_BACK_ARROW_BUTTON_STYLE,
+                       _click_softkey_back_cb, ad);
+       elm_layout_content_set(ad->md.naviframe, "prev_btn",
+                       back_button);
+       elm_naviframe_item_pop_cb_set(ad->md.naviframe_it, _view_pop_cb, ad);
+       elm_object_item_domain_text_translatable_set(
+                       ad->md.naviframe_it, SETTING_PACKAGE,
+                       EINA_TRUE);
+
+       setting_view_search_main.is_create = TRUE;
+
+       SETTING_TRACE_END;
+       return SETTING_RETURN_SUCCESS;
+}
+
+static int _view_destroy(void *cb)
+{
+       /* error check */
+       retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+       SETTING_TRACE_BEGIN;
+
+       SettingSearchData *ad = (SettingSearchData *) cb;
+       elm_genlist_item_class_free(ad->search_bar_itc);
+
+       retv_if(!setting_view_search_main.is_create,
+                       SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+
+       evas_object_del(ad->md.window);
+       ad->md.window = NULL;
+
+       setting_view_search_main.is_create = FALSE;
+       return SETTING_RETURN_SUCCESS;
+}
+
+static Eina_Bool _view_pop_cb(void *data, Elm_Object_Item *it)
+{
+       SETTING_TRACE_BEGIN;
+       SettingSearchData *ad = data;
+       retv_if(!ad, EINA_FALSE);
+       ui_app_exit();
+       return EINA_TRUE;
+}
+
+/* ***************************************************
+ *
+ *general func
+ *
+ ***************************************************/
+
+static void _mouse_up_Gendial_list_cb(void *data,
+               Evas_Object *obj,
+               void *event_info)
+{
+       SETTING_TRACE_BEGIN;
+
+#if 1
+       if(event_info == NULL) {
+               return;
+       }
+#endif
+
+       app_control_h service = 0;
+       SettingSearchData *ad = NULL;
+       Elm_Object_Item *item = NULL;
+       Setting_GenGroupItem_Data *list_item = NULL;
+
+       ad = data;
+       ret_if(!ad);
+
+       item = (Elm_Object_Item *)event_info;
+       retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+
+       elm_genlist_item_selected_set(item, 0);
+       list_item = elm_object_item_data_get(item);
+       ret_if(!list_item);
+
+       SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
+#if 0
+       if (!safeStrCmp("IDS_ST_MBODY_DO_NOT_DISTURB_ABB",
+                       list_item->keyStr)) {
+               app_control_create(&service);
+               app_control_set_app_id(service,
+                               "org.tizen.setting-notification");
+               app_control_set_operation(service, DO_NOT_DISTURB_OP);
+               app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
+               app_control_send_launch_request(service, NULL, NULL);
+               app_control_destroy(service);
+       } else if (!safeStrCmp("Search",
+                       list_item->keyStr)) {
+               app_control_create(&service);
+               app_control_set_app_id(service,
+                               "org.tizen.setting-notification");
+               app_control_set_operation(service, APP_SEARCH_OP);
+               app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
+               app_control_send_launch_request(service, NULL, NULL);
+               app_control_destroy(service);
+       }
+#endif
+}
diff --git a/setting-search/src/setting-search-util.c b/setting-search/src/setting-search-util.c
new file mode 100644 (file)
index 0000000..f5da53b
--- /dev/null
@@ -0,0 +1,410 @@
+/*
+ * 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 "setting-search-util.h"
+
+#include <system_settings.h>
+#include <package_manager.h>
+#include <app_manager.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include <stdbool.h>
+#include <regex.h>
+
+#include "setting-common-navigation.h"
+#include "setting-common-general-func.h"
+#include "setting.h"
+
+#define START_SIZE 10
+#define ERR_BUF_SIZE 1024
+#define REGEX_BUF_SIZE 1024
+#define REGEX_MAX_MATCHES 3
+#define PACKAGE_NAME "org.tizen.setting"
+#define PREFIX_REGEX_STRING "^("REGEX_SETTING_BASE_PATH"\\/.*)\\/"
+#define LOCALED_SUFFIX_REGEX_STRING "\\/([^\\/]*)$"
+#define UNLOCALED_SUFFIX_REGEX_STRING "([^\\/]*)$"
+#define TITLE "title"
+#define KEYWORDS "keywords"
+#define ICONPATH "icon"
+
+typedef struct search_result {
+       char *app_id;
+       char *path;
+       char *icon_path;
+       char *title;
+       char **matching_values;
+       size_t matching_value_size;
+} search_result_t;
+
+const char *search_result_get_path(search_result_t *info)
+{
+       return info->path;
+}
+
+const char *search_result_get_icon_path(search_result_t *info)
+{
+       return info->icon_path;
+}
+
+const char *search_result_get_title(search_result_t *info)
+{
+       return info->title;
+}
+
+const char *search_result_get_app_id(search_result_t *info)
+{
+       return info->app_id;
+}
+
+const char **search_result_get_matching_values(search_result_t *info)
+{
+       return info->matching_values;
+}
+
+size_t search_result_get_matching_values_size(search_result_t *info)
+{
+       return info->matching_value_size;
+}
+
+typedef struct search_value {
+       const char *path;
+       char **values;
+       const char *title;
+       const char *app_id;
+       const char *icon_path;
+       size_t values_size;
+} search_value_t;
+
+typedef struct app_search_result {
+       const char *app_id;
+       int previous_offset;
+} app_search_result_t;
+
+typedef struct setting_search_module {
+       bool is_initialized;
+       search_value_t *data_base;
+       int data_base_size;
+       char *locale;
+       regex_t localed_regex;
+       regex_t unlocaled_regex;
+       char err_buf[ERR_BUF_SIZE];
+       char regex_buf[REGEX_BUF_SIZE];
+       app_search_result_t app_search;
+} setting_search_module_t;
+
+
+static setting_search_module_t g_module = {0,};
+
+static const char *_package_err_to_str(package_manager_error_e error)
+{
+       switch(error) {
+       case PACKAGE_MANAGER_ERROR_INVALID_PARAMETER:
+               return "PACKAGE_MANAGER_ERROR_INVALID_PARAMETER";
+       case PACKAGE_MANAGER_ERROR_IO_ERROR:
+               return "PACKAGE_MANAGER_ERROR_IO_ERROR";
+       case PACKAGE_MANAGER_ERROR_NONE:
+               return "PACKAGE_MANAGER_ERROR_NONE";
+       case PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE:
+               return "PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE";
+       case PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY:
+               return "PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY";
+       case PACKAGE_MANAGER_ERROR_PERMISSION_DENIED:
+               return "PACKAGE_MANAGER_ERROR_PERMISSION_DENIED";
+       case PACKAGE_MANAGER_ERROR_SYSTEM_ERROR:
+               return "PACKAGE_MANAGER_ERROR_SYSTEM_ERROR";
+       default:
+               return "UNKNOWN_ERROR";
+       }
+}
+
+static int _find_path_in_db(const char *path, setting_search_module_t *module) {
+       if(!module->is_initialized || !module->data_base) {
+               return -1;
+       }
+       for(int i = 0; i < module->data_base_size; ++i) {
+               if(!strcmp(path,module->data_base[i].path)) {
+                       return i;
+               }
+       }
+       return -1;
+}
+
+static char *_substr_from_offsets(const char *string, int start, int end) {
+       size_t len = end - start + 1;
+       char *result = (char*) malloc(len);
+       strncpy(result, string + start, len - 1);
+       result[len - 1] = '\0';
+       return result;
+}
+
+static char *_substr_from_pointers(const char *start, const char *end) {
+       size_t len = end - start + 1;
+       char *result = (char*) malloc(len);
+       strncpy(result, start, len - 1);
+       result[len - 1] = '\0';
+       return result;
+}
+
+static char *_substr_from_regmatch(const char *string, const regmatch_t pmatch) {
+       return _substr_from_offsets(string, pmatch.rm_so, pmatch.rm_eo);
+}
+
+//In case delimiter is following with another one, value is saved as string "\0"
+static char **_csv_split(const char *string, size_t *size, char delimiter) {
+       if(!string) {
+               *size = 0;
+               return NULL;
+       }
+       *size = 0;
+       char *text = strdup(string);
+       char **split = (char**) malloc(START_SIZE*sizeof(char*));
+       size_t reserved = START_SIZE;
+       size_t i = 0;
+       size_t prev_pos = 0;    //Position of start actual value
+       for(; text[i]; ++i)
+       {
+               if(text[i] == delimiter) {
+                       //If delimiter is found, the value needs to be saved and prev_pos set to next sign
+                       if(*size + 1 == reserved) {
+                               //Realloc memory if necessary
+                               reserved *= 2;
+                               split = (char**) realloc(split, reserved*sizeof(char*));
+                       }
+                       split[*size] = text + prev_pos;
+                       text[i] = '\0';
+                       *size += 1;
+                       prev_pos = i + 1;
+               }
+       }
+       //After browsing through all characters, last value is without delimiter
+       //Set split to exact necessary size
+       split = (char**) realloc(split, sizeof(char*)*(*size + 1));
+       split[*size] = text + prev_pos;
+       *size += 1;
+       return split;
+}
+
+static void _csv_split_free(char **csv, size_t size)
+{
+       if(!csv) {
+               return;
+       }
+       for(size_t i = 0; i < size; ++i) {
+               free(csv[i]);
+       }
+       free(csv);
+}
+
+static bool _foreach_key_value_pair_cb(const char *metadata_key, const char *metadata_value, void *user_data)
+{
+       //app_search_result_t* act_app = (app_search_result_t*) user_data;
+       setting_search_module_t *module = (setting_search_module_t*) user_data;
+       if(!metadata_value || *metadata_value == '\0') {
+               return true;
+       }
+       int res;
+       regmatch_t pmatch[REGEX_MAX_MATCHES];
+       res = regexec(&(module->localed_regex), metadata_key, REGEX_MAX_MATCHES, pmatch, 0);
+       if(res != 0) {
+               //If data is not localed, try take unlocaled
+               res = regexec(&(module->unlocaled_regex), metadata_key, REGEX_MAX_MATCHES, pmatch, 0);
+       }
+       if(res == 0) {
+               //Match - now load data to database
+               char *path = _substr_from_regmatch(metadata_key, pmatch[1]);
+               char *type = _substr_from_regmatch(metadata_key, pmatch[2]);
+               search_value_t *searchvalue = NULL;
+               if(module->app_search.previous_offset != -1 && !strcmp(path, module->data_base[module->app_search.previous_offset].path)) {
+                       //It is good chance that previous path was the same
+                       searchvalue = module->data_base + module->app_search.previous_offset;
+               } else {
+                       //Else find it in database
+                       int ret = _find_path_in_db(path, module);
+                       if(ret >= 0) {
+                               searchvalue = module->data_base + ret;
+                               module->app_search.previous_offset = ret;
+                       }
+               }
+               if(!searchvalue) {
+                       //If it was not found, create new and load known values
+                       module->data_base_size++;
+                       SETTING_TRACE_DEBUG("New path found: %s", path);
+                       module->data_base = (search_value_t*) realloc(module->data_base, module->data_base_size*sizeof(search_value_t));
+                       searchvalue = module->data_base + (module->data_base_size - 1);
+                       searchvalue->app_id = safeStrDup(module->app_search.app_id);
+                       searchvalue->path = safeStrDup(path);
+                       searchvalue->icon_path = NULL;
+                       searchvalue->title = NULL;
+                       searchvalue->values = NULL;
+                       searchvalue->values_size = 0;
+
+                       module->app_search.previous_offset = module->data_base_size - 1;
+               }
+               if(!strcmp(type, KEYWORDS)) {
+                       searchvalue->values =_csv_split(metadata_value, &(searchvalue->values_size), ',');
+               } else if(!strcmp(type, TITLE)) {
+                       searchvalue->title = safeStrDup(metadata_value);
+               } else if(!strcmp(type, ICONPATH)) {
+                       searchvalue->icon_path = safeStrDup(metadata_value);
+               }
+               //Remove unnecessary variables
+               free(path);
+               free(type);
+       }
+       return true;
+}
+
+static bool _foreach_app_cb(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
+{
+       setting_search_module_t *module = (setting_search_module_t*) user_data;
+       module->app_search.app_id = strdup(app_id);
+       module->app_search.previous_offset = -1;
+
+       app_info_h app_info;
+       app_info_create(app_id, &app_info);
+       app_info_foreach_metadata(app_info, _foreach_key_value_pair_cb, module);
+       app_info_destroy(app_info);
+       return true;
+}
+
+static void _build_db(setting_search_module_t *module)
+{
+       int res;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &(module->locale));
+       package_info_h pi;
+       res = package_manager_get_package_info(PACKAGE_NAME, &pi);
+       if(res != PACKAGE_MANAGER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("Failed to retrieve info about package: %s", _package_err_to_str(res));
+               return;
+       }
+
+       strncpy(module->regex_buf, PREFIX_REGEX_STRING, strlen(PREFIX_REGEX_STRING));
+       strncat(module->regex_buf, module->locale, strlen(module->locale) + 1);
+       strncat(module->regex_buf, LOCALED_SUFFIX_REGEX_STRING, strlen(LOCALED_SUFFIX_REGEX_STRING)+ 1);
+       res = regcomp(&module->localed_regex, module->regex_buf, REG_EXTENDED);
+       SETTING_TRACE_DEBUG("Regex localed buf: %s", module->regex_buf);
+       if(res != PACKAGE_MANAGER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("Failed to compile localed regex: %d", res);
+       }
+
+       memset(module->regex_buf, 0, REGEX_BUF_SIZE);
+
+       strncpy(module->regex_buf, PREFIX_REGEX_STRING, strlen(PREFIX_REGEX_STRING) + 1);
+       strncat(module->regex_buf, UNLOCALED_SUFFIX_REGEX_STRING, strlen(UNLOCALED_SUFFIX_REGEX_STRING) + 1);
+       res = regcomp(&module->unlocaled_regex, module->regex_buf, REG_EXTENDED);
+       SETTING_TRACE_DEBUG("Regex unlocaled buf: %s", module->regex_buf);
+       if(res != PACKAGE_MANAGER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("Failed to compile unlocaled regex: %d", res);
+       }
+
+       res = package_info_foreach_app_from_package(pi, PACKAGE_INFO_ALLAPP, _foreach_app_cb, module);
+       if(res != PACKAGE_MANAGER_ERROR_NONE) {
+               SETTING_TRACE_ERROR("Failed to collect information about applications in package: %s", _package_err_to_str(res));
+       }
+}
+
+static search_result_t **_search_db(regex_t *reg, int *found_size, setting_search_module_t *module)
+{
+       //Allocate maximum necessary size for main array
+       search_result_t **result = (search_result_t**) malloc(sizeof(search_result_t*)*module->data_base_size);
+       int found_apps = 0;
+       for(int i = 0; i < module->data_base_size; ++i) {
+               size_t found_values = 0;
+               for(size_t j = 0; j < module->data_base[i].values_size; ++j) {
+                       int res;
+                       res = regexec(reg, module->data_base[i].values[j], 0, NULL, 0);
+                       if(res == 0) {
+                               if(found_values == 0) {
+                                       //If this is first time, alloc new structure
+                                       result[found_apps] = (search_result_t*) malloc(sizeof(search_result_t));
+                                       result[found_apps]->title = safeStrDup(module->data_base[i].title);
+                                       result[found_apps]->app_id = safeStrDup(module->data_base[i].app_id);
+                                       result[found_apps]->icon_path = safeStrDup(module->data_base[i].icon_path);
+                                       result[found_apps]->path = safeStrDup(module->data_base[i].path);
+                                       //Allocate maximum necessary size for values
+                                       result[found_apps]->matching_values = (char **) malloc(sizeof(char*)*module->data_base[i].values_size);
+                               }
+                               result[found_apps]->matching_values[found_values] = safeStrDup(module->data_base[i].values[j]);
+                               found_values++;
+                       }
+               }
+               if(found_values > 0) {
+                       //Trim this array
+                       result[found_apps]->matching_values = (char**) realloc(result[found_apps]->matching_values, found_values*sizeof(char*));
+                       result[found_apps]->matching_value_size = found_values;
+                       found_apps++;
+               }
+       }
+       //Trim main array to necessary size
+       result = (search_result_t**) realloc(result, found_apps*sizeof(search_result_t*));
+       *found_size = found_apps;
+       return result;
+}
+
+search_result_t **setting_search(const char *search, int *found_size)
+{
+       regex_t regex;
+       int res;
+       res = regcomp(&regex, search, REG_NOSUB);
+       if(res != 0) {
+               SETTING_TRACE_ERROR("Regex compilation error: %d", res);
+               return NULL;
+       }
+       if(!g_module.data_base) {
+               SETTING_TRACE("Search database not found - building started");
+               _build_db(&g_module);
+               SETTING_TRACE("Finished building search database");
+       }
+       return _search_db(&regex, found_size, &g_module);
+}
+
+void setting_search_free(search_result_t *info)
+{
+       if(info->matching_values) {
+               for(size_t i = 0; i < info->matching_value_size; ++i) {
+                       free(info->matching_values[i]);
+               }
+               free(info->matching_values);
+       }
+       if(info->title) {
+               free(info->title);
+       }
+       if(info->icon_path) {
+               free(info->icon_path);
+       }
+       if(info->app_id) {
+               free(info->app_id);
+       }
+       free(info);
+}
+
+void setting_search_free_all(search_result_t **info, int size)
+{
+       if(!info) {
+               return;
+       }
+
+       for(int i = 0; i < size; ++i) {
+               setting_search_free(info[i]);
+       }
+       free(info);
+}
index d5fc7a622139bb7e6b91502a12c4dc73aa97a4a0..53c9c83b706d02f8cb58736043cda30658e2f590 100755 (executable)
@@ -25,7 +25,6 @@
  *
  * first view has tabbar and Gengrid
  */
-
 #include "setting-main.h"
 #include "setting-cfg.h"
 
@@ -105,6 +104,19 @@ static Eina_Bool _naviframe_back_pop_cb(void *data, Elm_Object_Item *it)
        return EINA_FALSE;
 }
 
+
+
+static void _naviframe_search_cb(void *data, Evas_Object *obj,
+               void *event_info)
+{
+       setting_main_appdata *ad = (setting_main_appdata *)data;
+       ret_if(NULL == ad);
+
+       app_group_launcher("org.tizen.setting-search");
+
+}
+
+
 static void _setting_genlist_itc_init(void *cb)
 {
        setting_main_appdata *ad = (setting_main_appdata *) cb;
@@ -163,6 +175,28 @@ static int setting_main_create(void *cb)
                free(profile_string);
 
 }
+
+       Evas_Object *box = elm_box_add(ad->md.naviframe);
+       elm_box_horizontal_set(box, EINA_TRUE);
+       elm_box_padding_set(box, ELM_SCALE_SIZE(40), 0);
+
+       /* Icon Button */
+       Evas_Object *search_button = elm_button_add(ad->md.naviframe);
+       elm_object_style_set(search_button, "icon");
+
+       evas_object_smart_callback_add(search_button, "clicked", _naviframe_search_cb, ad);
+
+       evas_object_show(search_button);
+
+       /* Icon Button image */
+       Evas_Object *img = elm_image_add(search_button);
+       elm_image_file_set(img, IMG_SEARCH, NULL);
+       elm_object_part_content_set(search_button, "icon", img);
+
+       elm_box_pack_end(box, search_button);
+       elm_object_item_part_content_set(ad->md.naviframe_it, "title_content", box);
+
+
        elm_naviframe_item_pop_cb_set(ad->md.naviframe_it,
                        _naviframe_back_pop_cb, ad);
 
@@ -201,6 +235,7 @@ static void setting_main_click_list_cb(void *data, Evas_Object *obj,
                                                                                void *event_info)
 {
        SETTING_TRACE_BEGIN;
+
        Elm_Object_Item *item = NULL;
        Setting_GenGroupItem_Data *selected_item_data = NULL;
        const char *item_name = NULL;
index fb9789c31daa72efa69e62c76d6cff7a37121fe9..056c0baa522b414f381f701bc98d11bcea037c15 100755 (executable)
@@ -135,7 +135,7 @@ static void setting_main_app_ctl(app_control_h service, void *data)
 
 int main(int argc, char *argv[])
 {
-       setting_main_appdata ad = {};
+       setting_main_appdata ad = {0,};
        app_event_handler_h handlers[5] = {NULL, };
 
        ui_app_lifecycle_callback_s ops = {