2
* Copyright (C) 2013-2016 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 MeeGo.QOfono 0.2
19
import Ubuntu.Components 1.3
20
import Ubuntu.SystemSettings.SecurityPrivacy 1.0
21
import Ubuntu.SystemSettings.Diagnostics 1.0
23
import "../Components"
27
objectName: "wizardPages"
32
// These should be set by a security page and we apply the settings when
33
// the user exits the wizard.
34
property int passwordMethod: UbuntuSecurityPrivacyPanel.Passphrase
35
property string password: ""
37
property bool seenSIMPage: false // we want to see the SIM page at most once
39
property alias modemManager: modemManager
40
property alias simManager0: simManager0
41
property alias simManager1: simManager1
43
theme: ThemeSettings {
44
name: "Ubuntu.Components.Themes.Ambiance"
47
UbuntuSecurityPrivacyPanel {
49
objectName: "securityPrivacy"
54
objectName: "diagnostics"
57
OfonoManager { // need it here for the language and country detection
59
readonly property bool gotSimCard: available && ((simManager0.ready && simManager0.present) || (simManager1.ready && simManager1.present))
60
property bool ready: false
66
// Ideally we would query the system more cleverly than hardcoding two
67
// sims. But we don't yet have a more clever way. :(
70
modemPath: modemManager.modems.length >= 1 ? modemManager.modems[0] : ""
75
modemPath: modemManager.modems.length >= 2 ? modemManager.modems[1] : ""
78
function quitWizard() {
79
pageStack.currentPage.enabled = false;
82
var errorMsg = securityPrivacy.setSecurity("", password, passwordMethod)
83
if (errorMsg !== "") {
84
// Ignore (but log) any errors, since we're past where the user set
85
// the method. Worst case, we just leave the user with a swipe
86
// security method and they fix it in the system settings.
87
console.log("Error setting security method:", errorMsg)
94
MouseArea { // eat anything that gets past widgets
110
objectName: "pageStack"
114
// If we've opened any extra (non-main) pages, pop them before
115
// continuing so back button returns to the previous main page.
116
while (pageList.index < pageStack.depth - 1)
118
load(pageList.next());
122
var isPrimaryPage = currentPage && !currentPage.customTitle;
123
if (pageList.index >= pageStack.depth - 1) {
124
pageList.prev(); // update pageList.index, but not for extra pages
127
if (!currentPage || currentPage.opacity === 0) { // undo skipped pages
130
currentPage.enabled = true;
134
currentPage.aboutToShow(UbuntuAnimation.BriskDuration, Qt.LeftToRight);
136
currentPage.aboutToShowSecondary(UbuntuAnimation.BriskDuration);
140
function load(path) {
142
currentPage.enabled = false
145
// First load it invisible, check that we should actually use
146
// this page, and either skip it or continue.
147
push(path, {"opacity": 0, "enabled": false})
151
// Check for immediate skip or not. We may have to wait for
152
// skipValid to be assigned (see Connections object below)
155
var isPrimaryPage = !currentPage.customTitle;
157
currentPage.aboutToShow(UbuntuAnimation.BriskDuration, Qt.RightToLeft);
159
currentPage.aboutToShowSecondary(UbuntuAnimation.BriskDuration);
163
function checkSkip() {
164
if (!currentPage) { // may have had a parse error
166
} else if (currentPage.skipValid) {
167
if (currentPage.skip) {
170
currentPage.opacity = 1
171
currentPage.enabled = true
179
objectName: "timeout"
180
interval: 2000 // wizard pages shouldn't take long
182
console.warn("Wizard page " + pageStack.currentPage.objectName + " skipped due to taking too long!!!");
183
pageStack.currentPage.skip = true;
184
pageStack.currentPage.skipValid = true;
189
target: pageStack.currentPage
190
onSkipValidChanged: pageStack.checkSkip()
193
Component.onCompleted: next()