/usr/share/unity8/Components/Lockscreen.qml is in unity8-common 8.12+16.04.20160401-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import Ubuntu.Telephony 0.1 as Telephony
Showable {
id: root
// Determine if a numeric or alphanumeric pad is used.
property bool alphaNumeric: false
// Whether to show an emergency call button
property bool showEmergencyCallButton: true
// Whether to show a cancel button (not all lockscreen types normally do anyway)
property bool showCancelButton: true
// Informational text. (e.g. some text to tell which domain this is pin is entered for)
property string infoText: ""
// Retries text (e.g. 3 retries left)
// (This is not currently used, but will be necessary for SIM unlock screen)
property string retryText: ""
// The text to be displayed in case the login failed
property string errorText: ""
// If > 0, a forced delay is happening
property int delayMinutes: 0
// Set those to a value greater 0 to restrict the pin length.
// If both are unset, the Lockscreen will show a confirm button and allow typing any length of pin before
// confirming. If minPinLength is set to a value > 0, the confirm button will only become active when the
// entered pin is at least that long. If maxPinLength is set, the lockscreen won't allow entering any
// more numbers than that. If both are set to the same value, the lockscreen will enter auto confirming
// behavior, hiding the confirmation button and triggering that automatically when the entered pin reached
// that length. This is ignored by the alphaNumeric lockscreen as that one is always confirmed by pressing
// enter on the OSK.
property int minPinLength: -1
property int maxPinLength: -1
property url background: ""
// Use this to put a black overlay above the background
// 0: normal background, 1: black background
property real darkenBackground: 0
property color foregroundColor: "#f3f3e7"
readonly property string passphrase: (pinPadLoader.item && pinPadLoader.item.passphrase) ? pinPadLoader.item.passphrase : ""
signal entered(string passphrase)
signal cancel()
signal emergencyCall()
signal infoPopupConfirmed()
onActiveFocusChanged: if (activeFocus && pinPadLoader.item) pinPadLoader.item.forceActiveFocus()
function reset() {
// This causes the loader below to destry and recreate the source
pinPadLoader.resetting = true;
pinPadLoader.resetting = false;
}
function clear(showAnimation) {
if (pinPadLoader.item) {
pinPadLoader.item.clear(showAnimation);
}
pinPadLoader.showWrongText = showAnimation
pinPadLoader.waiting = false
}
function showInfoPopup(title, text) {
var popup = PopupUtils.open(infoPopupComponent, root, {title: title, text: text})
// FIXME: SDK will do this internally soonish
popup.z = Number.MAX_VALUE
}
Rectangle {
// In case background fails to load
id: backgroundBackup
anchors.fill: parent
color: "black"
visible: root.background.toString() !== ""
}
Image {
id: backgroundImage
objectName: "lockscreenBackground"
anchors {
fill: parent
}
// Limit how much memory we'll reserve for this image
sourceSize.height: height
sourceSize.width: width
source: root.required ? root.background : ""
fillMode: Image.PreserveAspectCrop
}
// This is to
// a) align it with the greeter and
// b) keep the white fonts readable on bright backgrounds
Rectangle {
anchors.fill: parent
color: "black"
opacity: root.darkenBackground
}
Loader {
id: pinPadLoader
objectName: "pinPadLoader"
anchors.fill: parent
property bool resetting: false
property bool waiting: false
property bool showWrongText: false
focus: true
source: {
if (resetting || !root.required) {
return ""
} else if (root.delayMinutes > 0) {
return "DelayedLockscreen.qml"
} else if (root.alphaNumeric) {
return "PassphraseLockscreen.qml"
} else {
return "PinLockscreen.qml"
}
}
onSourceChanged: {
waiting = false
showWrongText = false
}
Connections {
target: pinPadLoader.item
onEntered: {
pinPadLoader.waiting = true
root.entered(passphrase);
}
onCancel: {
root.cancel()
}
}
Binding {
target: pinPadLoader.item
property: "minPinLength"
value: root.minPinLength
}
Binding {
target: pinPadLoader.item
property: "maxPinLength"
value: root.maxPinLength
}
Binding {
target: pinPadLoader.item
property: "infoText"
value: root.infoText
}
Binding {
target: pinPadLoader.item
property: "retryText"
value: root.retryText
}
Binding {
target: pinPadLoader.item
property: "errorText"
value: pinPadLoader.showWrongText ? root.errorText : ""
}
Binding {
target: pinPadLoader.item
property: "entryEnabled"
value: !pinPadLoader.waiting
}
Binding {
target: pinPadLoader.item
property: "alphaNumeric"
value: root.alphaNumeric
}
Binding {
target: pinPadLoader.item
property: "delayMinutes"
value: root.delayMinutes
}
Binding {
target: pinPadLoader.item
property: "showCancelButton"
value: root.showCancelButton
}
Binding {
target: pinPadLoader.item
property: "foregroundColor"
value: root.foregroundColor
}
}
Item {
id: emergencyCallRow
visible: showEmergencyCallButton
anchors {
bottom: parent.bottom
bottomMargin: units.gu(7) + (Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0)
left: parent.left
right: parent.right
}
Label {
id: emergencyCallLabel
objectName: "emergencyCallLabel"
anchors.horizontalCenter: parent.horizontalCenter
text: callManager.hasCalls ? i18n.tr("Return to Call") : i18n.tr("Emergency Call")
color: root.foregroundColor
}
Icon {
id: emergencyCallIcon
anchors.left: emergencyCallLabel.right
anchors.leftMargin: units.gu(1)
width: emergencyCallLabel.height
height: emergencyCallLabel.height
name: "call-start"
color: root.foregroundColor
}
MouseArea {
anchors.top: emergencyCallLabel.top
anchors.bottom: emergencyCallLabel.bottom
anchors.left: emergencyCallLabel.left
anchors.right: emergencyCallIcon.right
onClicked: root.emergencyCall()
}
}
Component {
id: infoPopupComponent
ShellDialog {
id: dialog
objectName: "infoPopup"
property var dialogLoader // dummy to satisfy ShellDialog's context dependent prop
Button {
objectName: "infoPopupOkButton"
text: i18n.tr("OK")
onClicked: {
PopupUtils.close(dialog)
root.infoPopupConfirmed();
}
}
}
}
}
|