Commit 88359531 authored by eekkelund's avatar eekkelund

[Lockscreen] DeviceLock: add missing attemps and visual feedback if attemp...

[Lockscreen] DeviceLock: add missing attemps and visual feedback if attemp failed. Add notifications to lockscreen. Add displayOff if lockscreen on for 7sek
parent 50d5cd22
...@@ -14,6 +14,8 @@ Item { ...@@ -14,6 +14,8 @@ Item {
property bool shouldAuthenticate: Lipstick.compositor.visible property bool shouldAuthenticate: Lipstick.compositor.visible
&& authenticator.availableMethods !== 0 && authenticator.availableMethods !== 0
property int remainingAttempts
onShouldAuthenticateChanged: { onShouldAuthenticateChanged: {
if (shouldAuthenticate) { if (shouldAuthenticate) {
DeviceLock.authorization.requestChallenge() DeviceLock.authorization.requestChallenge()
...@@ -36,16 +38,18 @@ Item { ...@@ -36,16 +38,18 @@ Item {
} }
} }
Authenticator { Authenticator {
id: authenticator id: authenticator
onAuthenticated: { onAuthenticated: {
DeviceLock.unlock(authenticationToken) DeviceLock.unlock(authenticationToken)
Desktop.instance.setLockScreen(false) Desktop.instance.setLockScreen(false)
Desktop.instance.codepadVisible = false Desktop.instance.codepadVisible = false
remainingAttempts = 0
} }
onFeedback: { onFeedback: {
console.log('### still locked', feedback, attemptsRemaining) console.log('### still locked', feedback, attemptsRemaining)
remainingAttempts = attemptsRemaining
animation.start()
} }
} }
...@@ -53,6 +57,21 @@ Item { ...@@ -53,6 +57,21 @@ Item {
anchors.fill: parent anchors.fill: parent
spacing: Theme.itemSpacingLarge spacing: Theme.itemSpacingLarge
SequentialAnimation {
id: animation;
SequentialAnimation {
loops: 4
NumberAnimation { target: codePad; property: "anchors.horizontalCenterOffset"; to: 55; duration: 50 }
NumberAnimation { target: codePad; property: "anchors.horizontalCenterOffset"; to: 0; duration: 50 }
}
NumberAnimation { target: codePad; property: "anchors.horizontalCenterOffset"; to: 0; duration: 100 }
}
Label {
font.pixelSize: Theme.fontSizeMedium
width: parent.width
text: remainingAttempts > 0 ? qsTr("Attempts remaining:") + " " + remainingAttempts : ""
anchors.horizontalCenter: parent.horizontalCenter
}
TextField { TextField {
id: lockCodeField id: lockCodeField
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
...@@ -62,6 +81,7 @@ Item { ...@@ -62,6 +81,7 @@ Item {
} }
GridLayout { GridLayout {
id: codePad
height: parent.height height: parent.height
width: parent.width width: parent.width
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
......
...@@ -190,7 +190,7 @@ MouseArea { ...@@ -190,7 +190,7 @@ MouseArea {
} }
Timer {//Just placeholder to get visual feedback Timer {//Just placeholder to get visual feedback
id:deleteTimer id:deleteTimer
interval: 5000 interval: 3000
onTriggered: { onTriggered: {
iconWrapper.opacity=1.0 iconWrapper.opacity=1.0
enabled = true enabled = true
......
import QtQuick 2.0 import QtQuick 2.6
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import org.nemomobile.devicelock 1.0 import org.nemomobile.devicelock 1.0
import org.nemomobile.configuration 1.0 import org.nemomobile.configuration 1.0
import "notifications"
Image { Image {
id: lockScreen id: lockScreen
source: lockScreenWallpaper.value source: lockScreenWallpaper.value
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
property bool displayOn
ConfigurationValue{ ConfigurationValue{
id: lockScreenWallpaper id: lockScreenWallpaper
key: "/home/glacier/lockScreen/wallpaperImage" key: "/home/glacier/lockScreen/wallpaperImage"
...@@ -22,22 +26,78 @@ Image { ...@@ -22,22 +26,78 @@ Image {
right: parent.right right: parent.right
} }
} }
DeviceLockUI {
id: deviceLockUI MouseArea {
visible: false//DeviceLock.state === DeviceLock.Locked id:mouseArea
anchors { anchors.fill: parent
top: clock.bottom }
left: parent.left Connections {
target:Lipstick.compositor
onDisplayOff: {
displayOn = false
displayOffTimer.stop()
}
onDisplayOn:{
displayOn = true
displayOffTimer.stop()
}
} }
height: parent.height-clock.height Connections {
width: parent.width target: LipstickSettings
onLockscreenVisibleChanged: {
if (lockscreenVisible() && displayOn) {
displayOffTimer.restart()
}
}
}
Timer {
id:displayOffTimer
interval: 7000
onRunningChanged: {
if(running && !displayOn) {
stop()
}
}
onTriggered: {
if(displayOn && lockscreenVisible() && !Lipstick.compositor.gestureOnGoing && !codepad.visible) {
setLockScreen(true)
Lipstick.compositor.setDisplayOff()
}
}
}
//visible: ListView {
z: 201 id: notificationColumn
opacity: codePad.visible ? 1 - codePad.opacity : 1
anchors{
top: clock.bottom
topMargin: Theme.itemSpacingHuge
bottom:parent.bottom
bottomMargin: Theme.itemSpacingHuge
left:parent.left
leftMargin: Theme.itemSpacingLarge
right:parent.right
rightMargin: Theme.itemSpacingLarge
} }
interactive:false
spacing: 0
MouseArea { model: NotificationListModel {
anchors.fill: parent id: notifmodel
}
delegate: NotificationItem {
enabled:DeviceLock.state !== DeviceLock.Locked
scale: notificationColumn.opacity
transformOrigin: Item.Left
iconSize: Theme.itemHeightMedium
appName.font.pixelSize: Theme.fontSizeSmall
appName.visible: DeviceLock.state !== DeviceLock.Locked
appName.anchors.verticalCenter: appIcon.verticalCenter
appName.anchors.top: null
appBody.font.pixelSize: Theme.fontSizeTiny
appBody.visible: false
appSummary.visible: false
}
} }
} }
...@@ -46,9 +46,17 @@ Page { ...@@ -46,9 +46,17 @@ Page {
// This is used in the favorites page and in the lock screen // This is used in the favorites page and in the lock screen
WallClock { WallClock {
id: wallClock id: wallClock
enabled: true /* XXX: Disable when display is off */ enabled: true
updateFrequency: WallClock.Minute updateFrequency: WallClock.Minute
} }
//force refresh
Connections {
target: Lipstick.compositor
onDisplayAboutToBeOn: {
wallClock.enabled = false
wallClock.enabled = true
}
}
// This is used in the lock screen // This is used in the lock screen
ConfigurationValue { ConfigurationValue {
id: wallpaperSource id: wallpaperSource
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
****************************************************************************************/ ****************************************************************************************/
import QtQuick 2.6 import QtQuick 2.6
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import QtQuick.Controls 1.4
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.contacts 1.0 import org.nemomobile.contacts 1.0
...@@ -151,7 +150,6 @@ Item { ...@@ -151,7 +150,6 @@ Item {
filterType: PeopleModel.FilterAll filterType: PeopleModel.FilterAll
filterPattern: searchString filterPattern: searchString
requiredProperty: PeopleModel.PhoneNumberRequired requiredProperty: PeopleModel.PhoneNumberRequired
//searchableProperty: root.searchableProperty
} }
//Orginal function ** Copyright (C) 2013 Jolla Ltd. ** Contact: Joona Petrell <joona.petrell@jollamobile.com> //Orginal function ** Copyright (C) 2013 Jolla Ltd. ** Contact: Joona Petrell <joona.petrell@jollamobile.com>
......
...@@ -59,7 +59,7 @@ Item { ...@@ -59,7 +59,7 @@ Item {
property int oldY property int oldY
anchors.fill: row anchors.fill: row
z: row.z + 10 z: row.z + 10
enabled: !lockscreenVisible() //enabled: !lockscreenVisible()
onClicked: { onClicked: {
if(oldX != mouseX && oldY !== mouseY && row.childAt(mouseX, mouseY) && row.currentChild !== row.childAt(mouseX, mouseY)) { if(oldX != mouseX && oldY !== mouseY && row.childAt(mouseX, mouseY) && row.currentChild !== row.childAt(mouseX, mouseY)) {
row.currentChild = row.childAt(mouseX, mouseY) row.currentChild = row.childAt(mouseX, mouseY)
......
...@@ -45,6 +45,8 @@ Compositor { ...@@ -45,6 +45,8 @@ Compositor {
property Item topmostApplicationWindow property Item topmostApplicationWindow
property Item topmostAlarmWindow: null property Item topmostAlarmWindow: null
property bool gestureOnGoing
function windowToFront(winId) { function windowToFront(winId) {
var o = root.windowForId(winId) var o = root.windowForId(winId)
var window = null var window = null
...@@ -141,6 +143,7 @@ Compositor { ...@@ -141,6 +143,7 @@ Compositor {
swipeAnimation.stop() swipeAnimation.stop()
cancelAnimation.stop() cancelAnimation.stop()
lockAnimation.stop() lockAnimation.stop()
gestureOnGoing = true
if (root.appActive) { if (root.appActive) {
state = "swipe" state = "swipe"
} }
...@@ -176,6 +179,9 @@ Compositor { ...@@ -176,6 +179,9 @@ Compositor {
// Locks // Locks
if (!Desktop.instance.lockscreenVisible()) { if (!Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(true) Desktop.instance.setLockScreen(true)
if(gesture == "down") {
setDisplayOff()
}
} }
// Brings up codepad, only left and right swipes allowed for it for now // Brings up codepad, only left and right swipes allowed for it for now
else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && (gesture !== "down" && gesture !== "up")) { else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && (gesture !== "down" && gesture !== "up")) {
...@@ -193,6 +199,7 @@ Compositor { ...@@ -193,6 +199,7 @@ Compositor {
cancelAnimation.start() cancelAnimation.start()
} }
} }
gestureOnGoing = false
} }
// States are for the animations that follow your finger during swipes // States are for the animations that follow your finger during swipes
states: [ states: [
......
...@@ -6,7 +6,14 @@ MouseArea { ...@@ -6,7 +6,14 @@ MouseArea {
id: notifyArea id: notifyArea
height: childrenRect.height height: childrenRect.height
width: rootitem.width width: parent.width
property alias appIcon: appIcon
property alias appBody: appBody
property alias appName: appName
property alias appSummary: appSummary
property int iconSize: Theme.itemHeightExtraLarge
drag.target: notifyArea drag.target: notifyArea
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
...@@ -54,10 +61,10 @@ MouseArea { ...@@ -54,10 +61,10 @@ MouseArea {
Image { Image {
id: appIcon id: appIcon
height: Theme.itemHeightExtraLarge
width: height
property string defaultIcon: "/usr/share/lipstick-glacier-home-qt5/qml/images/glacier.svg" property string defaultIcon: "/usr/share/lipstick-glacier-home-qt5/qml/images/glacier.svg"
height: iconSize
width: iconSize
anchors{ anchors{
left: parent.left left: parent.left
leftMargin: Theme.itemSpacingLarge leftMargin: Theme.itemSpacingLarge
...@@ -78,7 +85,7 @@ MouseArea { ...@@ -78,7 +85,7 @@ MouseArea {
Label { Label {
id: appName id: appName
text: modelData.appName text: modelData.appName
width: (rootitem.width-appIcon.width)-Theme.itemSpacingHuge width: (parent.width-appIcon.width)-Theme.itemSpacingHuge
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
...@@ -93,7 +100,7 @@ MouseArea { ...@@ -93,7 +100,7 @@ MouseArea {
Label { Label {
id: appSummary id: appSummary
text: modelData.summary text: modelData.summary
width: (rootitem.width-appIcon.width)-Theme.itemSpacingHuge width: (parent.width-appIcon.width)-Theme.itemSpacingHuge
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
//font.bold :true //font.bold :true
...@@ -109,7 +116,7 @@ MouseArea { ...@@ -109,7 +116,7 @@ MouseArea {
Label { Label {
id: appBody id: appBody
width: (rootitem.width-appIcon.width)-Theme.itemSpacingHuge width: (parent.width-appIcon.width)-Theme.itemSpacingHuge
text: modelData.body text: modelData.body
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
......
...@@ -35,7 +35,9 @@ Item { ...@@ -35,7 +35,9 @@ Item {
} }
MouseArea { MouseArea {
id:mouse id:mouse
anchors.fill: parent anchors.centerIn: parent
width: parent.width + Theme.itemSpacingSmall
height: parent.height + Theme.itemSpacingSmall
enabled: !lockscreenVisible() enabled: !lockscreenVisible()
onClicked: parent.clicked() onClicked: parent.clicked()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment