Commit 0ea10c58 authored by Aleksi Suomalainen's avatar Aleksi Suomalainen

Merge pull request #8 from locusf/lock_from_anywhere

[lock] Lock the screen from anywhere in the homescreen. Also kill application by dragging it down.
parents 3b6707c3 02b683bb
......@@ -37,6 +37,7 @@ import QtQuick.Window 2.1
import org.nemomobile.time 1.0
import org.nemomobile.configuration 1.0
import org.freedesktop.contextkit 1.0
import "scripts/desktop.js" as Desktop
Page {
......@@ -112,6 +113,20 @@ Page {
font.pointSize: 8
}
}
Component.onCompleted: {
Desktop.instance = desktop
}
function lockscreenVisible() {
return LipstickSettings.lockscreenVisible === true
}
function setLockScreen(enabled) {
if (enabled) {
LipstickSettings.lockScreen(true)
} else {
LipstickSettings.lockscreenVisible = false
}
}
Pager {
id: pager
......
......@@ -25,6 +25,7 @@ import QtQuick 2.0
import org.nemomobile.lipstick 0.1
import "compositor"
import "scripts/desktop.js" as Desktop
Compositor {
id: root
......@@ -118,7 +119,7 @@ Compositor {
id: gestureArea
z: 2
anchors.fill: parent
enabled: root.appActive
property real swipeThreshold: 0.15
......@@ -129,11 +130,25 @@ Compositor {
}
onGestureFinished: {
if (gestureArea.progress >= swipeThreshold) {
swipeAnimation.valueTo = inverted ? -max : max
swipeAnimation.start()
} else {
cancelAnimation.start()
if (root.appActive) {
if (gestureArea.progress >= swipeThreshold) {
swipeAnimation.valueTo = inverted ? -max : max
swipeAnimation.start()
if (gestureArea.gesture == "down") {
Lipstick.compositor.closeClientForWindowId(topmostWindow.window.windowId)
}
} else {
cancelAnimation.start()
}
} else if (root.homeActive){
if (gestureArea.progress >= swipeThreshold) {
// Locks or unlocks depending if the screen is locked.
if (!Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(true)
} else {
Desktop.instance.setLockScreen(false)
}
}
}
}
......@@ -151,12 +166,6 @@ Compositor {
x: gestureArea.horizontal ? gestureArea.value : 0
y: gestureArea.horizontal ? 0 : gestureArea.value
}
PropertyChanges {
target: homeLayer
opacity: 0.6 + 0.4 * gestureArea.progress
scale: 0.8 + 0.2 * gestureArea.progress
}
}
]
......
......@@ -34,5 +34,6 @@
<file>qml/theme/icon-m-framework-close-thumbnail.png</file>
<file>qml/NotificationPreview.qml</file>
<file>qml/images/notification-circle.png</file>
<file>qml/scripts/desktop.js</file>
</qresource>
</RCC>
......@@ -41,6 +41,7 @@ OTHER_FILES += qml/*.qml \
qml/compositor/WindowWrapperBase.qml \
qml/compositor/WindowWrapperAlpha.qml \
qml/compositor/ScreenGestureArea.qml \
qml/NotificationPreview.qml
qml/NotificationPreview.qml \
qml/scripts/desktop.js
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