void info_popup_ok_text_set(Evas_Object *popup, const char *text);
+/**
+ * @Utility function creating and showing info popup with "OK" button
+ */
+void info_popup_show_message(Evas_Object *parent, const char *title, const char *text);
+
#endif /* end of include guard: INFO_POPUP_H */
elm_object_text_set(btn, text);
}
+EXPORT_PUBLIC
+void info_popup_show_message(Evas_Object *parent, const char *title, const char *text)
+{
+ Evas_Object *cp = info_popup_create(parent);
+
+ info_popup_title_set(cp, title);
+ info_popup_text_set(cp, text);
+
+ evas_object_show(cp);
+}
void setting_reset_settings();
void setting_reset_network();
-void setting_reset_initial_config();
+int setting_reset_initial_config();
void setting_reset_factory_reset();
#endif /* end of include guard: ___SETTING_RESET_H__ */
* limitations under the License.
*/
-void setting_reset_initial_config()
+#include "setting-common-general-func.h"
+#include "setting-reset.h"
+
+#include <app_control.h>
+
+#define OOBE_MAIN_APP_ID "org.tizen.oobe"
+#define OOBE_RESET_OPERATION "http://tizen.org/appcontrol/operation/reset"
+
+int setting_reset_initial_config()
{
+ app_control_h handle = NULL;
+ int ret = -1;
+
+ int err = app_control_create(&handle);
+ if (err != TIZEN_ERROR_NONE) {
+ SETTING_TRACE_ERROR("app_control_create failed: %s", get_error_message(err));
+ return -1;
+ }
+
+ err = app_control_set_app_id(handle, OOBE_MAIN_APP_ID);
+ if (err != TIZEN_ERROR_NONE) {
+ SETTING_TRACE_ERROR("app_control_set_appid failed: %s", get_error_message(err));
+ goto destroy;
+ }
+
+ err = app_control_set_operation(handle, OOBE_RESET_OPERATION);
+ if (err != TIZEN_ERROR_NONE) {
+ SETTING_TRACE_ERROR("app_control_set_opeartion failed: %s", get_error_message(err));
+ goto destroy;
+ }
+
+ err = app_control_send_launch_request(handle, NULL, NULL);
+ if (err != TIZEN_ERROR_NONE) {
+ SETTING_TRACE_ERROR("app_control_send_launch_request failed: %s", get_error_message(err));
+ goto destroy;
+ }
+
+ ret = 0;
+
+destroy:
+ app_control_destroy(handle);
+ return ret;
}
#include "setting-reset.h"
#include "controls/confirm-popup.h"
+#include "controls/info-popup.h"
#include <string.h>
}
#endif
+static void _show_reset_initial_config_result_popup(Evas_Object *parent, bool result)
+{
+ const char *title = _("IDS_ST_BODY_RESET_INITIAL_CONFIGURATION");
+ const char *content = result ? _("IDS_IM_BODY_SUCCESSFULLY_COMPLETED") : _("IDS_IM_POP_UNEXPECTED_ERROR");
+
+ info_popup_show_message(parent, title, content);
+}
+
static void _on_confirmed_reset_initial_config(void *data, Evas_Object *obj, void *event_info)
{
- setting_reset_initial_config();
+ int result = setting_reset_initial_config();
evas_object_del(obj);
+ _show_reset_initial_config_result_popup(obj, result == 0);
}
static void setting_reset_initial_config_clicked(void *data, Evas_Object *obj, void *event_info)