setting-reset: add new module UI 37/224737/4
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Wed, 12 Feb 2020 14:55:17 +0000 (15:55 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 21 Feb 2020 16:07:23 +0000 (17:07 +0100)
Limitations:
* Lack of translation strings
* only factory-reset logic is currently implemented

Change-Id: Ie57fc46f69895612b81854eb48a7e0e7971dae40

14 files changed:
CMakeLists.txt
org.tizen.setting.xml.in
packaging/org.tizen.setting-profile_common.spec
setting-common/src/setting-cfg.c
setting-reset/CMakeLists.txt [new file with mode: 0644]
setting-reset/include/controls/confirm-popup.h [new file with mode: 0644]
setting-reset/include/setting-reset.h [new file with mode: 0644]
setting-reset/src/controls/confirm-popup.c [new file with mode: 0644]
setting-reset/src/setting-reset-factory-reset.c [new file with mode: 0644]
setting-reset/src/setting-reset-initial-config.c [new file with mode: 0644]
setting-reset/src/setting-reset-main.c [new file with mode: 0644]
setting-reset/src/setting-reset-network.c [new file with mode: 0644]
setting-reset/src/setting-reset-settings.c [new file with mode: 0644]
setting-reset/src/setting-reset.c [new file with mode: 0644]

index 38272a0e108e0c344cb3abecde81c06247da6361..3f470231047902310dbef6f24f3308d374f35f62 100755 (executable)
@@ -39,6 +39,7 @@ SET(SETTING_FILEVIEW setting-fileview)
 SET(SETTING_RINGTONE setting-ringtone)
 SET(SETTING_APPMGR setting-appmgr)
 SET(SETTING_PRIVACY setting-privacy)
+SET(SETTING_RESET setting-reset)
 
 SET(LIB_SETTING_COMMON setting-common)
 
@@ -97,3 +98,4 @@ ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_RINGTONE})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_STORAGE})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_TIME})
 ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PRIVACY})
+ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_RESET})
index d54ce585aa2313978e37c2b2c71af09b529e29a9..da73512128bb6695f54b47a252c8b7da8396ffbb 100644 (file)
                        <label xml:lang="ko-kr">날짜 및 시간</label>
                         <datacontrol access="ReadOnly" providerid="http://org.tizen.setting-time/datacontrol/provider/uiapp" type="bin"/>
        </ui-application>
+       <ui-application appid="org.tizen.setting-reset" exec="@TZ_SYS_RO_APP@/org.tizen.setting/bin/setting-reset" nodisplay="true" multiple="false" type="capp" taskmanage="false" hw-acceleration="on" launch_mode="caller">
+               <label>Reset</label>
+       </ui-application>
        <privileges>
                <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
                <privilege>http://tizen.org/privilege/appmanager.kill</privilege>
index 5c9c7c8d411e1c3492f4f2dd08f08a42d669df89..1394d9f8623f5c162bd9e6c53b71b9652028ecdf 100755 (executable)
@@ -83,6 +83,7 @@ BuildRequires:  cmake
 BuildRequires:  edje-tools
 BuildRequires:  gettext-tools
 BuildRequires:  hash-signer
+BuildRequires:  dbus
 Requires(post): attr
 
 %description
index 186fedc0a8f06dd0c51704cbe2a225712b9b6084..1c649e40a1647ae7a764da1f6f203b2d213363a1 100755 (executable)
@@ -180,6 +180,13 @@ static Setting_Cfg_Node_T s_cfg_node_array[] = {
                Cfg_Item_AppLauncher_Node,
                NULL
        },
+       {       KeyStr_Reset,
+               NULL,
+               "org.tizen.setting-reset",
+               Cfg_Item_Pos_Level0,
+               Cfg_Item_AppLauncher_Node,
+               NULL
+       },
        {       KeyStr_AboutDevice,
                IMG_AboutDevice,
                "org.tizen.setting-about",
diff --git a/setting-reset/CMakeLists.txt b/setting-reset/CMakeLists.txt
new file mode 100644 (file)
index 0000000..58be68b
--- /dev/null
@@ -0,0 +1,36 @@
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include)
+
+SET(PROJECT_SETTING_RESET "setting-reset")
+SET(SETTING_PKG_RESET "org.tizen.setting-reset")
+
+INCLUDE(FindPkgConfig)
+
+pkg_check_modules(pkgs_profile REQUIRED
+       capi-appfw-application
+       elementary
+       dlog
+       dbus-1
+)
+
+FOREACH(flag ${pkgs_profile_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_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+ADD_EXECUTABLE(${PROJECT_SETTING_RESET}
+       ./src/setting-reset.c
+       ./src/setting-reset-main.c
+       ./src/setting-reset-initial-config.c
+       ./src/setting-reset-factory-reset.c
+       ./src/setting-reset-network.c
+       ./src/setting-reset-settings.c
+       ./src/controls/confirm-popup.c
+       )
+
+TARGET_LINK_LIBRARIES(${PROJECT_SETTING_RESET} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common)
+TARGET_LINK_LIBRARIES(${PROJECT_SETTING_RESET} ${pkgs_profile_LDFLAGS} -pie)
+INSTALL(PROGRAMS ${PROJECT_SETTING_RESET} DESTINATION ${TZ_SYS_RO_APP}/${SETTING_PKG_NAME}/bin)
diff --git a/setting-reset/include/controls/confirm-popup.h b/setting-reset/include/controls/confirm-popup.h
new file mode 100644 (file)
index 0000000..18344de
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 CONFIRM_POPUP_H
+#define CONFIRM_POPUP_H
+
+#include <Elementary.h>
+
+/**
+ * @brief Creates new confirm popup widget, with title, content text
+ * and two buttons: "confirm", "reject"
+ *
+ * --------------------------------
+ * |              Title           |
+ * |------------------------------|
+ * |                              |
+ * |              Text            |
+ * |                              |
+ * |-------------- ---------------|
+ * ||Reject button||Confirm button|
+ * --------------------------------
+ *
+ * Usage:
+ *
+ *   Evas_Object *cp = confirm_popup_create(window);
+ *
+ *   confirm_popup_title_set(cp, "Confirmation");
+ *   confirm_popup_text_set(cp, "Remove all files?");
+ *   confirm_popup_accept_text_set(cp, "Remove");
+ *   confirm_popup_reject_text_set(cp, "Cancel");
+ *
+ *   evas_object_smart_callback_add(cp, "confirmed", accepted_cb, NULL);
+ *   evas_object_smart_callback_add(cp, "rejected", rejected_cb, NULL);
+ *
+ *   evas_object_show(cp);
+ */
+Evas_Object *confirm_popup_create(Evas_Object *parent);
+
+void confirm_popup_title_set(Evas_Object *confirm_popup, const char *title);
+
+void confirm_popup_text_set(Evas_Object *confirm_popup, const char *text);
+
+void confirm_popup_confirm_text_set(Evas_Object *confirm_popup, const char *text);
+
+void confirm_popup_reject_text_set(Evas_Object *confirm_popup, const char *text);
+
+#endif /* end of include guard: CONFIRM_POPUP_H */
diff --git a/setting-reset/include/setting-reset.h b/setting-reset/include/setting-reset.h
new file mode 100644 (file)
index 0000000..0909062
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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_RESET_H___
+#define ___SETTING_RESET_H__
+
+#include "setting-common-init.h"
+#include "setting-common-general-func.h"
+#include "setting-common-draw-widget.h"
+#include "setting-common-view.h"
+
+#define RESET_APP_NAME "org.tizen.setting-reset"
+#define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0])
+
+extern setting_view setting_view_reset;
+
+void setting_reset_settings();
+void setting_reset_network();
+void setting_reset_initial_config();
+void setting_reset_factory_reset();
+
+#endif /* end of include guard: ___SETTING_RESET_H__ */
diff --git a/setting-reset/src/controls/confirm-popup.c b/setting-reset/src/controls/confirm-popup.c
new file mode 100644 (file)
index 0000000..a2cb43c
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 "controls/confirm-popup.h"
+
+static void _on_reject_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_smart_callback_call(popup, "rejected", NULL);
+}
+
+static void _on_confirm_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       Evas_Object *popup = data;
+       evas_object_smart_callback_call(popup, "confirmed", NULL);
+}
+
+Evas_Object *confirm_popup_create(Evas_Object *parent)
+{
+       Evas_Object *popup = elm_popup_add(parent);
+
+       elm_popup_align_set(popup, 0.5, 1.0);
+       evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       Evas_Object *btn = elm_button_add(popup);
+       elm_object_style_set(btn, "popup");
+       evas_object_smart_callback_add(btn, "clicked", _on_reject_clicked, popup);
+       elm_object_part_content_set(popup, "button1", btn);
+
+       Evas_Object *btn2 = elm_button_add(popup);
+       elm_object_style_set(btn2, "popup");
+       evas_object_smart_callback_add(btn2, "clicked", _on_confirm_clicked, popup);
+       elm_object_part_content_set(popup, "button2", btn2);
+
+       return popup;
+}
+
+void confirm_popup_title_set(Evas_Object *confirm_popup, const char *title)
+{
+       elm_object_part_text_set(confirm_popup, "title,text", title);
+}
+
+void confirm_popup_text_set(Evas_Object *confirm_popup, const char *text)
+{
+       elm_object_text_set(confirm_popup, text);
+}
+
+void confirm_popup_confirm_text_set(Evas_Object *confirm_popup, const char *text)
+{
+       Evas_Object *btn = elm_object_part_content_get(confirm_popup, "button2");
+       elm_object_text_set(btn, text);
+}
+
+void confirm_popup_reject_text_set(Evas_Object *confirm_popup, const char *text)
+{
+       Evas_Object *btn = elm_object_part_content_get(confirm_popup, "button1");
+       elm_object_text_set(btn, text);
+}
diff --git a/setting-reset/src/setting-reset-factory-reset.c b/setting-reset/src/setting-reset-factory-reset.c
new file mode 100644 (file)
index 0000000..618f325
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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-general-func.h"
+
+#include <dbus/dbus.h>
+
+static void _dbus_call_notify_cb(DBusPendingCall *pending, void *data)
+{
+       SETTING_TRACE("dbus call end %p %d", pending,
+                                       dbus_pending_call_get_completed(pending));
+       if (TRUE == dbus_pending_call_get_completed(pending)) {
+               SETTING_TRACE_DEBUG("Dbus call completed");
+       }
+}
+
+void setting_reset_factory_reset()
+{
+       DBusMessage *message = NULL;
+       DBusConnection *conn = NULL;
+       DBusPendingCall *pending_call = NULL;
+
+       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       if (!conn) {
+               SETTING_TRACE_WARNING("dbus_bus_get() error");
+               return;
+       }
+       message = dbus_message_new_signal("/org/tizen/factoryreset",
+                       "org.tizen.factoryreset.start",
+                       "setting");
+       if (!message) {
+               SETTING_TRACE_WARNING("dbus_message_new_signal() error");
+               dbus_connection_unref(conn);
+               return;
+       }
+       dbus_message_set_destination(message, "org.tizen.factoryreset");
+
+       if (FALSE ==
+               dbus_connection_send_with_reply(conn, message, &pending_call, 100)) {
+               SETTING_TRACE_WARNING("dbus_connection_send_with_reply() error");
+               dbus_message_unref(message);
+               dbus_connection_unref(conn);
+               return;
+       }
+
+       if (FALSE == dbus_pending_call_set_notify(pending_call,
+                       _dbus_call_notify_cb, NULL, NULL)) {
+               SETTING_TRACE("dbus_pending_call_set_notify() error");
+       }
+
+       dbus_pending_call_block(pending_call);
+       dbus_message_unref(message);
+       dbus_connection_unref(conn);
+}
diff --git a/setting-reset/src/setting-reset-initial-config.c b/setting-reset/src/setting-reset-initial-config.c
new file mode 100644 (file)
index 0000000..9e4e649
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+void setting_reset_initial_config()
+{
+}
diff --git a/setting-reset/src/setting-reset-main.c b/setting-reset/src/setting-reset-main.c
new file mode 100644 (file)
index 0000000..8fe2a48
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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-reset.h"
+#include "controls/confirm-popup.h"
+
+struct item {
+       const char *display_title;
+       setting_call_back_func select;
+       const char *icon;
+};
+
+static int setting_reset_create(void *ad);
+static void setting_reset_settings_clicked(void *data, Evas_Object *obj, void *event_info);
+static void setting_reset_network_clicked(void *data, Evas_Object *obj, void *event_info);
+static void setting_reset_initial_config_clicked(void *data, Evas_Object *obj, void *event_info);
+static void setting_reset_factory_reset_clicked(void *data, Evas_Object *obj, void *event_info);
+
+setting_view setting_view_reset = {
+               .create = setting_reset_create,
+               .update = NULL,
+               .destroy = NULL,
+               .cleanup = NULL
+};
+
+static Elm_Genlist_Item_Class itc;
+
+const static struct item items[] = {
+       //TODO add i18n to display_title fields
+       { "Reset settings", setting_reset_settings_clicked, NULL},
+       { "Reset network settings", setting_reset_network_clicked, NULL},
+       { "Reset initial configuration", setting_reset_initial_config_clicked, NULL},
+       { "Factory data reset", setting_reset_factory_reset_clicked, NULL},
+};
+
+static void _dismiss_popup(void *data, Evas_Object *obj, void *event_info)
+{
+       evas_object_del(obj);
+}
+
+static void _on_confirmed_reset_settings(void *data, Evas_Object *obj, void *event_info)
+{
+       setting_reset_settings();
+       evas_object_del(obj);
+}
+
+static Evas_Object *_reset_confirm_popup_create(Evas_Object *parent)
+{
+       Evas_Object *confirm_popup = confirm_popup_create(parent);
+       confirm_popup_title_set(confirm_popup, "Confirm Reset");
+       confirm_popup_confirm_text_set(confirm_popup, "Reset");
+       confirm_popup_reject_text_set(confirm_popup, "Cancel");
+       return confirm_popup;
+}
+
+static void setting_reset_settings_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       MainData *md = data;
+       Evas_Object *confirm_popup = _reset_confirm_popup_create(md->window);
+       confirm_popup_text_set(confirm_popup, "<align=center>All settings will be reset.<br>This action cannot be undone.</align>");
+       evas_object_smart_callback_add(confirm_popup, "confirmed", _on_confirmed_reset_settings, NULL);
+       evas_object_smart_callback_add(confirm_popup, "rejected", _dismiss_popup, NULL);
+       elm_genlist_item_selected_set(event_info, EINA_FALSE);
+       evas_object_show(confirm_popup);
+}
+
+static void _on_confirmed_reset_network(void *data, Evas_Object *obj, void *event_info)
+{
+       setting_reset_network();
+       evas_object_del(obj);
+}
+
+static void setting_reset_network_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       MainData *md = data;
+       Evas_Object *confirm_popup = _reset_confirm_popup_create(md->window);
+       confirm_popup_text_set(confirm_popup, "<align=center>All network settings will be reset.<br>This action cannot be undone.</align>");
+       evas_object_smart_callback_add(confirm_popup, "confirmed", _on_confirmed_reset_network, NULL);
+       evas_object_smart_callback_add(confirm_popup, "rejected", _dismiss_popup, NULL);
+       elm_genlist_item_selected_set(event_info, EINA_FALSE);
+       evas_object_show(confirm_popup);
+}
+
+static void _on_confirmed_reset_initial_config(void *data, Evas_Object *obj, void *event_info)
+{
+       setting_reset_initial_config();
+       evas_object_del(obj);
+}
+
+static void setting_reset_initial_config_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       MainData *md = data;
+       Evas_Object *confirm_popup = _reset_confirm_popup_create(md->window);
+       confirm_popup_text_set(confirm_popup, "<align=center>Initial configuration will be reset.<br>This action cannot be undone.</align>");
+       evas_object_smart_callback_add(confirm_popup, "confirmed", _on_confirmed_reset_initial_config, NULL);
+       evas_object_smart_callback_add(confirm_popup, "rejected", _dismiss_popup, NULL);
+       elm_genlist_item_selected_set(event_info, EINA_FALSE);
+       evas_object_show(confirm_popup);
+}
+
+static void _on_confirmed_factory_reset(void *data, Evas_Object *obj, void *event_info)
+{
+       setting_reset_factory_reset();
+       evas_object_del(obj);
+}
+
+static void setting_reset_factory_reset_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+       MainData *md = data;
+       Evas_Object *confirm_popup = _reset_confirm_popup_create(md->window);
+       confirm_popup_text_set(confirm_popup, "<align=center>Factory reset will be performed.<br>This action cannot be undone.</align>");
+       evas_object_smart_callback_add(confirm_popup, "confirmed", _on_confirmed_factory_reset, NULL);
+       evas_object_smart_callback_add(confirm_popup, "rejected", _dismiss_popup, NULL);
+       elm_genlist_item_selected_set(event_info, EINA_FALSE);
+       evas_object_show(confirm_popup);
+}
+
+static Eina_Bool _cancel_cb(void *data, Elm_Object_Item *it)
+{
+       ui_app_exit();
+       return EINA_TRUE;
+}
+
+static int setting_reset_create(void *ad)
+{
+       SETTING_TRACE_BEGIN;
+
+       MainData *md = ad;
+       retv_if(!md, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+       int ret = view_init(md, _("IDS_ST_HEADER_RESET"));
+       if (ret != SETTING_RETURN_SUCCESS)
+               return ret;
+
+       setting_create_Gendial_itc(SETTING_GENLIST_ICON_1LINE_STYLE, &itc);
+       setting_add_back_button(md, _cancel_cb, NULL);
+
+       for (int i = 0; i < ARRAY_SIZE(items); ++i) {
+               const struct item *it = &items[i];
+
+               setting_create_Gendial_field_def(
+                                                       md->genlist,
+                                                       &itc,
+                                                       it->select,
+                                                       md,
+                                                       SWALLOW_Type_INVALID,
+                                                       (char*)it->icon,
+                                                       NULL,
+                                                       0,
+                                                       it->display_title,
+                                                       NULL,
+                                                       NULL);
+       }
+
+       setting_view_reset.is_create = 1;
+       evas_object_show(md->window);
+       SETTING_TRACE_END;
+       return SETTING_RETURN_SUCCESS;
+}
diff --git a/setting-reset/src/setting-reset-network.c b/setting-reset/src/setting-reset-network.c
new file mode 100644 (file)
index 0000000..ae5c45a
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+void setting_reset_network()
+{
+}
diff --git a/setting-reset/src/setting-reset-settings.c b/setting-reset/src/setting-reset-settings.c
new file mode 100644 (file)
index 0000000..894a3dd
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+void setting_reset_settings()
+{
+}
diff --git a/setting-reset/src/setting-reset.c b/setting-reset/src/setting-reset.c
new file mode 100644 (file)
index 0000000..191e19a
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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-reset.h"
+
+static bool _setting_reset_app_create(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+       MainData *ad = priv;
+       retv_if(!ad, NULL);
+
+       if (app_init(ad, RESET_APP_NAME) != SETTING_RETURN_SUCCESS) {
+               SETTING_TRACE_ERROR("Cannot initialize application");
+               return false;
+       }
+
+       setting_view_node_table_intialize();
+       setting_view_node_table_register(&setting_view_reset, NULL);
+       setting_view_node_set_cur_view(&setting_view_reset);
+       setting_view_create(&setting_view_reset, ad);
+
+       return true;
+}
+
+static void _setting_reset_app_pause(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+}
+
+static void _setting_reset_app_resume(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+}
+
+static void _setting_reset_app_terminate(void *priv)
+{
+       SETTING_TRACE_BEGIN;
+}
+
+static void _setting_sound_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_reset_app_create,
+               .pause = _setting_reset_app_pause,
+               .resume = _setting_reset_app_resume,
+               .terminate = _setting_reset_app_terminate,
+               .app_control = NULL
+       };
+
+       MainData app_data;
+       memset(&app_data, 0, sizeof(MainData));
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED],
+                       APP_EVENT_LANGUAGE_CHANGED, _setting_sound_lang_changed,
+                       &app_data);
+
+       return ui_app_main(argc, argv, &ops, &app_data);
+}