-DDB_INSTALL_DIR=%{TZ_SYS_DB} \
-DRUN_INSTALL_DIR=%{TZ_SYS_RUN} \
-DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \
- -DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RW_PACKAGES}" \
+ -DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}" \
-DPAMD_INSTALL_DIR=/etc/pam.d
make %{?jobs:-j%jobs}
%install
rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/apps/org.tizen.zone-setup-wizard/data
%make_install
%clean
%files -n org.tizen.ode
%defattr(-,root,root,-)
%{odeapp_home}/bin/*
-%{TZ_SYS_RW_PACKAGES}/org.tizen.ode.xml
+%{TZ_SYS_RO_PACKAGES}/org.tizen.ode.xml
+
+## ZONE Setup Wizard Package #################################################
+%package -n org.tizen.zone-setup-wizard
+Summary: Tizen ZONE Setup wizard Interface
+Group: Security/Other
+BuildRequires: pkgconfig(efl-extension)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(evas)
+Requires: libdpm = %{version}-%{release}
+
+%description -n org.tizen.zone-setup-wizard
+Tizen ZONE setup wizard interface for zone
+
+%post -n org.tizen.zone-setup-wizard
+%{_sbindir}/ldconfig
+%postun -n org.tizen.zone-setup-wizard
+%{_sbindir}/ldconfig
+
+%define setup_home %{TZ_SYS_RO_APP}/org.tizen.zone-setup-wizard
+
+mkdir -p %{setup_home}/data
+
+%files -n org.tizen.zone-setup-wizard
+%defattr(-,root,root,-)
+%manifest tools/zone-setup-wizard/org.tizen.zone-setup-wizard.manifest
+%{setup_home}/bin/*
+%{setup_home}/res/*
+%{setup_home}/res/data/.sample-BundleManifest.xml
+%{setup_home}/data
+%{TZ_SYS_RO_PACKAGES}/org.tizen.zone-setup-wizard.xml
## PAM Plugin Package #######################################################
%package -n dpm-pam-zone
SET(DPM_CLI ${DPM_TOOLS}/cli)
SET(DPM_ODE ${DPM_TOOLS}/ode)
+SET(DPM_ZONE_SETUP_WIZARD ${DPM_TOOLS}/zone-setup-wizard)
ADD_SUBDIRECTORY(${DPM_CLI})
ADD_SUBDIRECTORY(${DPM_ODE})
+ADD_SUBDIRECTORY(${DPM_ZONE_SETUP_WIZARD})
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(org.tizen.zone-setup-wizard C)
+
+INCLUDE_DIRECTORIES(./include)
+
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(tools_pkgs REQUIRED
+ dlog
+ glib-2.0
+ bundle
+ efl-extension
+ elementary
+ capi-appfw-application
+ evas
+)
+
+INCLUDE_DIRECTORIES(${tools_pkgs_INCLUDE_DIRS} ${DPM_LIBS})
+LINK_DIRECTORIES(${tools_pkgs_LIBRARY_DIRS})
+
+SET(PKG_NAME "${PROJECT_NAME}")
+SET(PKG_SRC src/main.c
+ src/ui.c
+ src/util.c
+ src/widget.c)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+
+ADD_EXECUTABLE(${PKG_NAME} ${PKG_SRC})
+INSTALL(TARGETS ${PKG_NAME} DESTINATION ${APP_INSTALL_PREFIX}/${PKG_NAME}/bin)
+
+TARGET_LINK_LIBRARIES(${PKG_NAME} ${tools_pkgs_LIBRARIES} dpm)
+
+#Create edj file
+ADD_CUSTOM_TARGET(org.tizen.zone-setup-wizard.edj
+ COMMAND edje_cc -no-save -id ${CMAKE_CURRENT_SOURCE_DIR}/res/images
+ ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.zone-setup-wizard.edc
+ ${CMAKE_BINARY_DIR}/org.tizen.zone-setup-wizard.edj
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.zone-setup-wizard.edc)
+
+ADD_DEPENDENCIES(${PROJECT_NAME} org.tizen.zone-setup-wizard.edj)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/org.tizen.zone-setup-wizard.edj DESTINATION ${APP_INSTALL_PREFIX}/${PKG_NAME}/res)
+
+#Install app data
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PKG_NAME}.xml DESTINATION ${APP_SHARE_PACKAGES_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/data/.sample-BundleManifest.xml DESTINATION ${APP_INSTALL_PREFIX}/${PKG_NAME}/res/data)
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard application
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 WIDGET_H_
+#define WIDGET_H_
+
+#include <app.h>
+#include <dlog.h>
+#include <Elementary.h>
+#include <efl_extension.h>
+
+Evas_Object *_create_win(const char *package);
+Evas_Object *_create_conformant(Evas_Object *parent);
+Evas_Object *_create_layout(Evas_Object *parent, char *file, const char *group);
+Evas_Object *_create_button(Evas_Object *parent, const char *text, const char *style);
+Evas_Object *_create_textblock(Evas_Object *parent, const char *text, Evas_Textblock_Style *style);
+Evas_Object *_create_progressbar(Evas_Object *parent, const char *style);
+
+#endif /* WIDGET_H_ */
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard application
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 __ZONE_SETUP_H__
+#define __ZONE_SETUP_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <app.h>
+#include <app_common.h>
+#include <bundle.h>
+#include <dlog.h>
+#include <Elementary.h>
+#include <efl_extension.h>
+#include <dpm/zone.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "zone-setup-wizard"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.zone-setup-wizard"
+#endif
+
+#define SETUP_TEXT_STYLE "DEFAULT='font=Tizen:style=Regular font_size=34 color=#ffffff wrap=mixed align=center'"
+
+typedef enum {
+ WELCOME_VIEW = 0,
+ SETUP_COMPLETE_VIEW,
+} view_num;
+
+typedef struct {
+ char *zone_name;
+ char *provision_path;
+ dpm_client_h dpm_client;
+ bool create_done;
+} appdata_s;
+
+void _create_base_window(appdata_s *data);
+void _create_welcome_view(appdata_s *data);
+void _create_zone_popup(appdata_s *data);
+void _create_setup_complete_view(appdata_s *data);
+
+int _send_zone_provision_data(const char *zone_name, const char *target_path);
+
+#endif /* __ZONE_SETUP_H__ */
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.zone-setup-wizard" version="1.0.0">
+ <profile name="mobile"/>
+ <ui-application appid="org.tizen.zone-setup-wizard" exec="/usr/apps/org.tizen.zone-setup-wizard/bin/org.tizen.zone-setup-wizard" multiple="false" nodisplay="true" taskmanage="false" type="capp">
+ <label>zone-setup</label>
+ </ui-application>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<bundle-manifest>
+<version>0.1.0</version>
+ <version>0.1.0</version>
+ <require>
+ <os>tizen3.0</os>
+ </require>
+
+ <namspace>
+ <dropped-capability>CAP_SYS_ADMIN</dropped-capability>
+ <hostname>ZoneName</hostname>
+ <!--<init>/sbin/init</init>-->
+ <filesystem root="/">
+ <!--<entry source="/home/ZoneName" target="/home/.zone/ZoneName" type="bind" option="rw" />-->
+ </filesystem>
+ <network>
+ <!--<interface name="eth0" address="10.254.34.232" netmask="" gateway="" />-->
+ </network>
+ <ipc />
+ </namspace>
+</bundle-manifest>
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard Layout
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+group { name: "create_popup_layout";
+ styles {
+ style { name: "popup_content_style";
+ base: "font=Tizen:style=Regular align=left font_size="24" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+ tag: "br" "\n";
+ tag: "tab" "\t";
+ }
+ }
+ parts {
+ part { name: "base";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0;}
+ rel2 { relative: 1.0 1.0;}
+ color: 255 255 255 255;
+ min: 0 200;
+ }
+ }
+ part { name: "processing";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 0 1;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 22 0;}
+ rel2 { relative: 0.3 1.0; to: "base";}
+ align: 0.0 0.5;
+ }
+ }
+ part { name: "text";
+ type: TEXTBLOCK;
+ scale: 1;
+ description { state: "default" 0.0;
+ fixed: 0 1;
+ rel1 { relative: 1.0 0.0; to:"processing"; offset:22 0;}
+ rel2 { relative: 1.0 1.0; to:"base"; offset:-22 0;}
+ text { style: "popup_content_style"; min: 0 1;}
+ color: 0 0 0 255;
+ align: 0.0 0.5;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard Layout
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+group { name: "base_layout";
+ parts {
+ part { name: "base";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative : 0.0 0.0;}
+ rel2 { relative : 1.0 1.0;}
+ }
+ }
+ part { name: "content_layout";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "base";}
+ rel2 { relative: 1.0 0.0; to: "bottom_layout";}
+ }
+ }
+ part { name: "bottom_layout";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "base"; offset: 0 -162;}
+ rel2 { relative: 1.0 1.0; to: "base";}
+ }
+ }
+ }
+}
+
+group { name: "one_button_layout";
+ parts {
+ part { name: "base";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color: 255 255 255 255;
+ }
+ }
+ part { name : "button";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 22 22;}
+ rel2 { relative: 1.0 1.0; to: "base"; offset: -22 -22;}
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard Layout
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+group { name: "setup_complete_layout";
+ images {
+ image : "../images/icon.png" COMP;
+ }
+ styles {
+ style { name: "complete_title_style";
+ base: "font=Tizen:style=Regular align=left font_size="32" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+ tag: "br" "\n";
+ tag: "tab" "\t";
+ }
+ style { name: "complete_content_style";
+ base: "font=Tizen:style=Regular font_size="20" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
+ tag: "br" "\n";
+ tag: "tab" "\t";
+ }
+ }
+ parts {
+ part { name: "base";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 0.0 0.0;}
+ rel2 {relative: 1.0 1.0;}
+ color: 246 246 246 255;
+ }
+ }
+ part { name: "main_title";
+ type: TEXT;
+ scale: 1;
+ effect: SHADOW;
+ description { state: "default" 0.0;
+ color: 68 68 68 255;
+ color3: 85 88 88 255;
+ rel1 { relative: 0.0 0.0; to: "base"; offset: 22 150;}
+ rel2 { relative: 1.0 0.0; to: "base"; offset: -22 300;}
+ text { font: "Tizen:style=Regular"; size: "52"; align: 0.5 0.5; text: "Tizen ZONE";}
+ }
+ }
+ part { name: "main_image";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 0.0 1.0; to_x: "base"; to_y: "main_title"; offset: 0 35;}
+ rel2 {relative: 1.0 1.0; to_x: "base"; to_y: "main_title"; offset: 0 400;}
+ max: 230 230;
+ image.normal: "../images/icon.png";
+ }
+ }
+ part { name: "sub_title_base";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 0.0 1.0; to_x: "base"; to_y: "main_image"; offset: 22 50;}
+ rel2 {relative: 1.0 1.0; to_x: "base"; to_y: "main_image"; offset: -22 130;}
+ visible: 0;
+ }
+ }
+ part { name: "sub_title_icon";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 0.0 0.0; to: "sub_title_base";}
+ rel2 {relative: 0.0 1.0; to: "sub_title_base"; offset: 90 0;}
+ image.normal: "../images/icon.png";
+ }
+ }
+ part { name: "sub_title_text";
+ type: TEXTBLOCK;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 1.0 0.0; to_x:"sub_title_icon"; to_y:"sub_title_base"; offset: 22 0;}
+ rel2 {relative: 1.0 1.0; to: "sub_title_base";}
+ text {style: "complete_title_style"; min: 0 1;}
+ color: 0 0 0 255;
+ }
+ }
+ part { name: "content_text";
+ type: TEXTBLOCK;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 {relative: 0.0 1.0; to_x: "base"; to_y: "sub_title_base"; offset: 22 20;}
+ rel2 {relative: 1.0 1.0; to: "base"; offset: -22 0;}
+ text {style: "complete_content_style"; min: 0 1; align: 0.0 0.0;}
+ color: 0 0 0 255;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard Layout
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+group { name: "welcome_layout";
+ images {
+ image: "../images/icon.png" COMP;
+ image: "../images/theme_bg.png" COMP;
+ }
+ parts {
+ part { name: "bg";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ image.normal: "../images/theme_bg.png";
+ }
+ }
+ part { name: "title";
+ type: TEXT;
+ scale: 1;
+ effect: SHADOW;
+ description { state: "default" 0.0;
+ color: 255 255 255 255;
+ color3: 85 88 88 255;
+ rel1 { relative: 0.0 0.0; to: "bg"; offset: 22 200;}
+ rel2 { relative: 1.0 0.0; to: "bg"; offset: -22 350;}
+ text { font: "Tizen:style=Regular"; size: "52"; align: 0.5 0.5; text: "Tizen ZONE";}
+ }
+ }
+ part { name: "icon_base";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to_x: "bg"; to_y: "title"; offset: 0 80;}
+ rel2 { relative: 1.0 1.0; to_x: "bg"; to_y: "title"; offset: 0 350;}
+ visible: 0;
+ }
+ }
+ part { name: "icon";
+ type: IMAGE;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "icon_base";}
+ rel2 { relative: 1.0 1.0; to: "icon_base";}
+ align: 0.5 0.0;
+ max: 170 170;
+ image.normal: "../images/icon.png";
+ }
+ }
+ part { name: "top_padding";
+ type: RECT;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "icon_base"; }
+ rel2 { relative: 1.0 1.0; to: "icon_base"; offset: 0 80;}
+ visible: 0;
+ }
+ }
+ part { name: "content_text";
+ type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "top_padding";}
+ rel2 { relative: 1.0 1.0; to: "bg";}
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ *
+ */
+
+collections {
+ base_scale: 1.8;
+ #include "./edc_resource/layout.edc"
+ #include "./edc_resource/welcome.edc"
+ #include "./edc_resource/create-popup.edc"
+ #include "./edc_resource/setup-complete.edc"
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard application
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "zone-setup.h"
+#include "widget.h"
+
+static void __create_zone_done(zone_state_e event, const char *name, void *info, void *user_data)
+{
+ appdata_s *ad = (appdata_s *) user_data;
+ if (event == DPM_ZONE_DEFINED)
+ ad->create_done = true;
+ return ;
+}
+
+static bool __app_create(void *data)
+{
+ return true;
+}
+
+static void __app_pause(void *data)
+{
+ return ;
+}
+
+static void __app_resume(void *data)
+{
+ return ;
+}
+
+static void __app_terminate(void *data)
+{
+ appdata_s *ad = (appdata_s *) data;
+
+ dpm_unsubscribe_zone_signal(ad->dpm_client, __create_zone_done);
+ dpm_destroy_client(ad->dpm_client);
+ ad->dpm_client = NULL;
+ return ;
+}
+
+static void __app_control(app_control_h app_control, void *data)
+{
+ appdata_s *ad = (appdata_s *) data;
+ int ret = 0;
+
+ ret = app_control_get_extra_data(app_control, "Zone", &ad->zone_name);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to get zone name");
+ ui_app_exit();
+ }
+
+ ret = app_control_get_extra_data(app_control, "ProvisionDir", &ad->provision_path);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to get zone provision data path");
+ ui_app_exit();
+ }
+
+ ad->dpm_client = dpm_create_client();
+ if (ad->dpm_client == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to get dpm client");
+ ui_app_exit();
+ }
+
+ if (dpm_subscribe_zone_signal(ad->dpm_client, __create_zone_done, ad) != 0) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to set signal callback");
+ ui_app_exit();
+ }
+
+ elm_app_base_scale_set(1.8);
+ _create_base_window(ad);
+
+ return ;
+}
+
+int main(int argc, char *argv[])
+{
+ appdata_s ad = {0, };
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0, };
+
+ event_callback.create = __app_create;
+ event_callback.terminate = __app_terminate;
+ event_callback.pause = __app_pause;
+ event_callback.resume = __app_resume;
+ event_callback.app_control = __app_control;
+
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main is failed. err = %d", ret);
+
+ return ret;
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard application
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "zone-setup.h"
+#include "widget.h"
+
+#define SETUP_TITLE "Tizen ZONE"
+#define WELCOME_TEXT "Welcome<br>Keep your applications and content safe<br>with ZONE."
+#define POPUP_CONTENT_TEXT "Creating Zone..."
+#define COMPLETE_SUB_TEXT "The application shortcut will be created<br>on your personal home screen."
+
+typedef struct {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *nf;
+ Evas_Object *popup;
+ char *edj_path;
+ view_num current_view;
+} uidata_s;
+
+uidata_s ud = {0, };
+
+static Eina_Bool __naviframe_pop_cb(void *data, Elm_Object_Item *it)
+{
+ switch (ud.current_view) {
+ case WELCOME_VIEW:
+ ui_app_exit();
+ return EINA_FALSE;
+ case SETUP_COMPLETE_VIEW:
+ ud.current_view = WELCOME_VIEW;
+ elm_object_signal_emit(ud.conform, "elm,state,indicator,overlap", "elm");
+ return EINA_TRUE;
+ default:
+ return EINA_FALSE;
+ }
+}
+
+static void __next_btn_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ appdata_s *ad = (appdata_s *)data;
+
+ switch (ud.current_view) {
+ case WELCOME_VIEW:
+ ud.current_view = SETUP_COMPLETE_VIEW;
+ if (_send_zone_provision_data(ad->zone_name, ad->provision_path) != 0)
+ ui_app_exit();
+ _create_zone_popup(ad);
+ break;
+ case SETUP_COMPLETE_VIEW:
+ ui_app_exit();
+ break;
+ default:
+ break;
+ }
+ return ;
+}
+
+static void __set_one_btn_bottom_layout(Evas_Object *layout, appdata_s *ad, const char *btn_text)
+{
+ Evas_Object *bottom_layout;
+ Evas_Object *btn;
+
+ bottom_layout = _create_layout(layout, ud.edj_path, "one_button_layout");
+
+ btn = _create_button(bottom_layout, btn_text, "bottom");
+ elm_object_part_content_set(bottom_layout, "button", btn);
+ evas_object_smart_callback_add(btn, "clicked", __next_btn_cb, ad);
+
+ elm_object_part_content_set(layout, "bottom_layout", bottom_layout);
+ return ;
+}
+
+static void __popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ appdata_s *ad = (appdata_s *)data;
+
+ Evas_Object *timer = evas_object_data_get(obj, "timer");
+ ecore_timer_del(timer);
+
+ eext_object_event_callback_add(ud.nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ _create_setup_complete_view(ad);
+ return ;
+}
+
+static Eina_Bool __progressbar_timer_cb(void *data)
+{
+ appdata_s *ad = (appdata_s *) data;
+
+ if (ad->create_done) {
+ evas_object_data_del(ud.popup, "timer");
+ evas_object_del(ud.popup);
+
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ return ECORE_CALLBACK_RENEW;
+}
+
+void _create_base_window(appdata_s *ad)
+{
+ Evas_Object *layout;
+
+ char edj_path[PATH_MAX] = "\0";
+ char *res_path = NULL;
+
+ /* Initialize data */
+ ud.current_view = WELCOME_VIEW;
+ ad->create_done = false;
+
+ /* Get EDJ path */
+ res_path = app_get_resource_path();
+ if (res_path == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed get resource path");
+ ui_app_exit();
+ }
+ snprintf(edj_path, PATH_MAX, "%s%s", res_path, "org.tizen.zone-setup-wizard.edj");
+
+ ud.edj_path = strdup(edj_path);
+ free(res_path);
+
+ /* Create main UI widget */
+ ud.win = _create_win(PACKAGE);
+ ud.conform = _create_conformant(ud.win);
+ layout = _create_layout(ud.conform, NULL, NULL);
+ elm_object_content_set(ud.conform, layout);
+ ud.nf = elm_naviframe_add(layout);
+
+ _create_welcome_view(ad);
+
+ elm_object_part_content_set(layout, "elm.swallow.content", ud.nf);
+ eext_object_event_callback_add(ud.nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+
+ evas_object_show(ud.win);
+ return ;
+}
+
+void _create_welcome_view(appdata_s *ad)
+{
+ Elm_Object_Item *nf_it;
+ Evas_Object *layout, *welcome_layout;
+ Evas_Object *text;
+ Evas_Textblock_Style *text_st;
+
+ elm_object_signal_emit(ud.conform, "elm,state,indicator,overlap", "elm");
+
+ layout = _create_layout(ud.nf, ud.edj_path, "base_layout");
+ welcome_layout = _create_layout(layout, ud.edj_path, "welcome_layout");
+
+ text_st = evas_textblock_style_new();
+ evas_textblock_style_set(text_st, SETUP_TEXT_STYLE);
+ text = _create_textblock(welcome_layout, WELCOME_TEXT, text_st);
+ elm_object_part_content_set(welcome_layout, "content_text", text);
+ evas_textblock_style_free(text_st);
+
+ elm_object_part_content_set(layout, "content_layout", welcome_layout);
+
+ __set_one_btn_bottom_layout(layout, ad, "Set up");
+
+ nf_it = elm_naviframe_item_push(ud.nf, NULL, NULL, NULL, layout, NULL);
+ elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_TRUE);
+ elm_naviframe_item_pop_cb_set(nf_it, __naviframe_pop_cb, NULL);
+
+ return ;
+}
+
+void _create_zone_popup(appdata_s *ad)
+{
+ Evas_Object *layout;
+ Evas_Object *popup;
+ Evas_Object *progressbar, *timer;
+
+ eext_object_event_callback_del(ud.nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb);
+ popup = elm_popup_add(ud.win);
+
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_text_set(popup, "title,text", SETUP_TITLE);
+
+ layout = _create_layout(popup, ud.edj_path, "create_popup_layout");
+ elm_object_part_text_set(layout, "text", POPUP_CONTENT_TEXT);
+
+ progressbar = _create_progressbar(layout, "process_large");
+ elm_object_part_content_set(layout, "processing", progressbar);
+ elm_object_part_content_set(popup, "elm.swallow.content", layout);
+
+ evas_object_show(popup);
+ ud.popup = popup;
+
+ /* set popup timer callback*/
+ timer = ecore_timer_add(0.1, __progressbar_timer_cb, ad);
+ evas_object_data_set(popup, "timer", timer);
+ evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __popup_del_cb, ad);
+
+ return ;
+}
+
+void _create_setup_complete_view(appdata_s *ad)
+{
+ Elm_Object_Item *nf_it;
+ Evas_Object *layout, *complete_layout;
+
+ elm_object_signal_emit(ud.conform, "elm,state,indicator,nooverlap", "elm");
+
+ layout = _create_layout(ud.nf, ud.edj_path, "base_layout");
+
+ complete_layout = _create_layout(layout, ud.edj_path, "setup_complete_layout");
+ elm_object_part_text_set(complete_layout, "sub_title_text", SETUP_TITLE);
+ elm_object_part_text_set(complete_layout, "content_text", COMPLETE_SUB_TEXT);
+ elm_object_part_content_set(layout, "content_layout", complete_layout);
+
+ __set_one_btn_bottom_layout(layout, ad, "Done");
+
+ nf_it = elm_naviframe_item_push(ud.nf, NULL, NULL, NULL, layout, NULL);
+ elm_naviframe_item_title_enabled_set(nf_it, EINA_FALSE, EINA_TRUE);
+ elm_naviframe_item_pop_cb_set(nf_it, __naviframe_pop_cb, NULL);
+
+ return ;
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard application
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "zone-setup.h"
+
+#define TARGET_ZONE "ZoneName"
+#define PROVISION_DATA "/manifest.xml"
+#define PROVISION_COMPLETE "/.complete"
+
+static char *__get_zone_metadata(void)
+{
+ FILE *fp = NULL;
+ char *res_path = NULL;
+ char *metadata = NULL;
+ char metadata_path[PATH_MAX] = "\0";
+ long fsize = 0;
+ int ret = -1;
+
+ res_path = app_get_resource_path();
+ if (res_path == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to get resource path");
+ return NULL;
+ }
+ snprintf(metadata_path, PATH_MAX, "%s%s", res_path, "data/.sample-BundleManifest.xml");
+ free(res_path);
+
+ fp = fopen(metadata_path, "r");
+ if (fp != NULL) {
+ if (fseek(fp, 0, SEEK_END) == -1)
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to fseek");
+
+ fsize = ftell(fp);
+ if (fsize == -1) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to get file size");
+ fclose(fp);
+ return NULL;
+ }
+
+ metadata = malloc(fsize + 1);
+ if (metadata == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to allocate memory");
+ fclose(fp);
+ return NULL;
+ }
+ memset(metadata, 0, fsize + 1);
+ if (fseek(fp, 0, SEEK_SET) == -1) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to fseek");
+ fclose(fp);
+ free(metadata);
+ return NULL;
+ }
+
+ ret = fread(metadata, fsize, 1, fp);
+ if (ret < 0) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to read metadata file");
+ fclose(fp);
+ free(metadata);
+ return NULL;
+ }
+ } else {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to open metadata file");
+ return NULL;
+ }
+
+ fclose(fp);
+
+ return metadata;
+}
+
+static void __create_zone_manifest(char *metadata, char *manifest, const char *zone_name)
+{
+ while (1) {
+ int index = 0;
+ int len = 0;
+ char tmp[PATH_MAX] = "\0";
+ char *found = strstr(metadata, TARGET_ZONE);
+
+ if (!found) {
+ strncpy(manifest, metadata, strlen(metadata)+1);
+ break;
+ }
+
+ index = found - metadata;
+ strncpy(tmp, metadata, index);
+ strncat(tmp, zone_name, strlen(zone_name));
+ len = strlen(found)-strlen(TARGET_ZONE);
+ if (len > 0) {
+ strncat(tmp, metadata+index+strlen(TARGET_ZONE), len);
+ }
+
+ strncpy(manifest, tmp, strlen(tmp)+1);
+ strncpy(metadata, manifest, strlen(manifest)+1);
+ }
+
+ return ;
+}
+
+int _send_zone_provision_data(const char *zone_name, const char *target_path)
+{
+ FILE *fp = NULL;
+ char *metadata = NULL;
+ char manifest[PATH_MAX] = "\0";
+ char data_path[PATH_MAX] = "\0";
+
+ metadata = __get_zone_metadata();
+ if (metadata == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to get metadata");
+ return -1;
+ }
+
+ __create_zone_manifest(metadata, manifest, zone_name);
+ free(metadata);
+
+ snprintf(data_path, strlen(target_path)+strlen(PROVISION_DATA)+1, "%s%s", target_path, PROVISION_DATA);
+ fp = fopen(data_path, "w");
+ if (fp != NULL) {
+ fwrite(manifest, 1, strlen(manifest), fp);
+ } else {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to create provisioning file");
+ return -1;
+ }
+ fclose(fp);
+
+ snprintf(data_path, strlen(target_path)+strlen(PROVISION_COMPLETE)+1, "%s%s", target_path, PROVISION_COMPLETE);
+ fp = fopen(data_path, "w");
+ if (fp == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "failed to touch complete file");
+ return -1;
+ }
+
+ fclose(fp);
+ return 0;
+}
--- /dev/null
+/*
+ * Tizen Zone Setup-Wizard application
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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 "widget.h"
+
+static void __win_delete_request_cb(void *data , Evas_Object *obj , void *event_info)
+{
+ ui_app_exit();
+}
+
+Evas_Object *_create_win(const char *package)
+{
+ Evas_Object *win = elm_win_util_standard_add(package, package);
+ elm_win_conformant_set(win, EINA_TRUE);
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ if (elm_win_wm_rotation_supported_get(win)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(win, (const int *)(&rots), 4);
+ }
+
+ evas_object_smart_callback_add(win, "delete,request", __win_delete_request_cb, NULL);
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_TRANSPARENT);
+
+ return win;
+}
+
+Evas_Object *_create_conformant(Evas_Object *parent)
+{
+ Evas_Object *conform = elm_conformant_add(parent);
+
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(parent, conform);
+
+ evas_object_show(conform);
+
+ return conform;
+}
+
+Evas_Object *_create_layout(Evas_Object *parent, char *file, const char *group)
+{
+ Evas_Object *layout = elm_layout_add(parent);
+
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+ if (file == NULL)
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ else
+ elm_layout_file_set(layout, file, group);
+
+ evas_object_show(layout);
+
+ return layout;
+}
+
+Evas_Object *_create_button(Evas_Object *parent, const char *text, const char *style)
+{
+ Evas_Object *btn = elm_button_add(parent);
+
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(btn, text);
+
+ if (style != NULL)
+ elm_object_style_set(btn, style);
+
+ evas_object_show(btn);
+
+ return btn;
+}
+
+Evas_Object *_create_textblock(Evas_Object *parent, const char *text, Evas_Textblock_Style *style)
+{
+ Evas_Object *txt = evas_object_textblock_add(parent);
+
+ if (style != NULL)
+ evas_object_textblock_style_set(txt, style);
+ evas_object_textblock_text_markup_set(txt, text);
+ evas_object_show(txt);
+
+ return txt;
+}
+
+Evas_Object *_create_progressbar(Evas_Object *parent, const char *style)
+{
+ Evas_Object *progressbar = elm_progressbar_add(parent);
+
+ elm_object_style_set(progressbar, style);
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+ elm_progressbar_value_set(progressbar, 0.0);
+ evas_object_show(progressbar);
+
+ return progressbar;
+}