2 * Copyright (C) 2013,2014,2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Ubuntu.Components 1.3
19 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
21 import "../Components"
25 objectName: "wizardPages"
28 // The background wallpaper to use
29 property string background
33 // These should be set by a security page and we apply the settings when
34 // the user exits the wizard.
35 property int passwordMethod: UbuntuSecurityPrivacyPanel.Passcode
36 property string password: ""
38 UbuntuSecurityPrivacyPanel {
40 objectName: "securityPrivacy"
43 function quitWizard() {
44 pageStack.currentPage.enabled = false;
46 var errorMsg = securityPrivacy.setSecurity("", password, passwordMethod)
47 if (errorMsg !== "") {
48 // Ignore (but log) any errors, since we're past where the user set
49 // the method. Worst case, we just leave the user with a swipe
50 // security method and they fix it in the system settings.
51 console.log("Error setting security method:", errorMsg)
57 MouseArea { // eat anything that gets past widgets
63 // Use x/y/height/width instead of anchors so that we don't adjust
64 // the image when the OSK appears.
69 sourceSize.height: height
70 sourceSize.width: width
71 source: root.background
72 fillMode: Image.PreserveAspectCrop
73 visible: status === Image.Ready
82 objectName: "pageStack"
86 // If we've opened any extra (non-main) pages, pop them before
87 // continuing so back button returns to the previous main page.
88 while (pageList.index < pageStack.depth - 1)
94 if (pageList.index >= pageStack.depth - 1)
95 pageList.prev() // update pageList.index, but not for extra pages
97 if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
100 currentPage.enabled = true
104 function load(path) {
106 currentPage.enabled = false
109 // First load it invisible, check that we should actually use
110 // this page, and either skip it or continue.
111 push(path, {"opacity": 0, "enabled": false})
115 // Check for immediate skip or not. We may have to wait for
116 // skipValid to be assigned (see Connections object below)
120 function checkSkip() {
121 if (!currentPage) { // may have had a parse error
123 } else if (currentPage.skipValid) {
124 if (currentPage.skip) {
127 currentPage.opacity = 1
128 currentPage.enabled = true
136 objectName: "timeout"
137 interval: 2000 // wizard pages shouldn't take long
139 pageStack.currentPage.skip = true;
140 pageStack.currentPage.skipValid = true;
145 target: pageStack.currentPage
146 onSkipValidChanged: pageStack.checkSkip()
149 Component.onCompleted: next()