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 ...@@ -37,6 +37,7 @@ import QtQuick.Window 2.1
import org.nemomobile.time 1.0 import org.nemomobile.time 1.0
import org.nemomobile.configuration 1.0 import org.nemomobile.configuration 1.0
import org.freedesktop.contextkit 1.0 import org.freedesktop.contextkit 1.0
import "scripts/desktop.js" as Desktop
Page { Page {
...@@ -112,6 +113,20 @@ Page { ...@@ -112,6 +113,20 @@ Page {
font.pointSize: 8 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 { Pager {
id: pager id: pager
......
...@@ -25,6 +25,7 @@ import QtQuick 2.0 ...@@ -25,6 +25,7 @@ import QtQuick 2.0
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import "compositor" import "compositor"
import "scripts/desktop.js" as Desktop
Compositor { Compositor {
id: root id: root
...@@ -118,7 +119,7 @@ Compositor { ...@@ -118,7 +119,7 @@ Compositor {
id: gestureArea id: gestureArea
z: 2 z: 2
anchors.fill: parent anchors.fill: parent
enabled: root.appActive
property real swipeThreshold: 0.15 property real swipeThreshold: 0.15
...@@ -129,11 +130,25 @@ Compositor { ...@@ -129,11 +130,25 @@ Compositor {
} }
onGestureFinished: { onGestureFinished: {
if (gestureArea.progress >= swipeThreshold) { if (root.appActive) {
swipeAnimation.valueTo = inverted ? -max : max if (gestureArea.progress >= swipeThreshold) {
swipeAnimation.start() swipeAnimation.valueTo = inverted ? -max : max
} else { swipeAnimation.start()
cancelAnimation.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 { ...@@ -151,12 +166,6 @@ Compositor {
x: gestureArea.horizontal ? gestureArea.value : 0 x: gestureArea.horizontal ? gestureArea.value : 0
y: gestureArea.horizontal ? 0 : gestureArea.value 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 @@ ...@@ -34,5 +34,6 @@
<file>qml/theme/icon-m-framework-close-thumbnail.png</file> <file>qml/theme/icon-m-framework-close-thumbnail.png</file>
<file>qml/NotificationPreview.qml</file> <file>qml/NotificationPreview.qml</file>
<file>qml/images/notification-circle.png</file> <file>qml/images/notification-circle.png</file>
<file>qml/scripts/desktop.js</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -41,6 +41,7 @@ OTHER_FILES += qml/*.qml \ ...@@ -41,6 +41,7 @@ OTHER_FILES += qml/*.qml \
qml/compositor/WindowWrapperBase.qml \ qml/compositor/WindowWrapperBase.qml \
qml/compositor/WindowWrapperAlpha.qml \ qml/compositor/WindowWrapperAlpha.qml \
qml/compositor/ScreenGestureArea.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