Unity 8
passcode-confirm.qml
1 /*
2  * Copyright (C) 2014-2016 Canonical, Ltd.
3  *
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.
7  *
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.
12  *
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/>.
15  */
16 
17 import QtQuick 2.4
18 import Ubuntu.Components 1.3
19 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20 import ".." as LocalComponents
21 import "../../Components"
22 
23 /**
24  * See the main passwd-type page for an explanation of why we don't actually
25  * directly set the password here.
26  */
27 
28 LocalComponents.Page {
29  id: passcodeConfirmPage
30  objectName: "passcodeConfirmPage"
31  customTitle: true
32  backButtonText: i18n.tr("Cancel")
33 
34  // If we are entering this page, clear any saved password and get focus
35  onEnabledChanged: if (enabled) lockscreen.clear(false)
36 
37  Lockscreen {
38  id: lockscreen
39  anchors {
40  fill: content
41  }
42 
43  infoText: i18n.tr("Confirm passcode")
44 
45  errorText: i18n.tr("Incorrect passcode.") + "\n" + i18n.ctr("Enter the passcode again", "Please re-enter.")
46 
47  foregroundColor: textColor
48 
49  showEmergencyCallButton: false
50  showCancelButton: false
51  alphaNumeric: false
52  minPinLength: 4
53  maxPinLength: 4
54 
55  onEntered: {
56  if (passphrase === root.password) {
57  confirmTimer.start();
58  } else {
59  clear(true);
60  }
61  }
62 
63  Timer {
64  id: confirmTimer
65  interval: UbuntuAnimation.SnapDuration
66  onTriggered: pageStack.next()
67  }
68  }
69 }