2
* Copyright (C) 2013 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.1
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
var errorMsg = securityPrivacy.setSecurity("", password, passwordMethod)
45
if (errorMsg !== "") {
46
// Ignore (but log) any errors, since we're past where the user set
47
// the method. Worst case, we just leave the user with a swipe
48
// security method and they fix it in the system settings.
49
console.log("Error setting security method:", errorMsg)
55
MouseArea { // eat anything that gets past widgets
61
// Use x/y/height/width instead of anchors so that we don't adjust
62
// the image when the OSK appears.
67
sourceSize.height: height
68
sourceSize.width: width
69
source: root.background
70
fillMode: Image.PreserveAspectCrop
71
visible: status === Image.Ready
80
objectName: "pageStack"
84
// If we've opened any extra (non-main) pages, pop them before
85
// continuing so back button returns to the previous main page.
86
while (pageList.index < pageStack.depth - 1)
92
if (pageList.index >= pageStack.depth - 1)
93
pageList.prev() // update pageList.index, but not for extra pages
95
if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
98
currentPage.enabled = true
102
function load(path) {
104
currentPage.enabled = false
107
// First load it invisible, check that we should actually use
108
// this page, and either skip it or continue.
109
push(path, {"opacity": 0, "enabled": false})
111
// Check for immediate skip or not. We may have to wait for
112
// skipValid to be assigned (see Connections object below)
116
function checkSkip() {
117
if (!currentPage) { // may have had a parse error
119
} else if (currentPage.skipValid) {
120
if (currentPage.skip) {
123
currentPage.opacity = 1
124
currentPage.enabled = true
130
target: pageStack.currentPage
131
onSkipValidChanged: pageStack.checkSkip()
134
Component.onCompleted: next()