diff --git a/resources/qml/PrivacyScreen.qml b/resources/qml/PrivacyScreen.qml
new file mode 100644
index 00000000..497630f1
--- /dev/null
+++ b/resources/qml/PrivacyScreen.qml
@@ -0,0 +1,74 @@
+import QtQuick 2.12
+import QtGraphicalEffects 1.0
+
+Item {
+ property var timelineRoot
+ property var imageSource
+ property int screenTimeout
+ anchors.fill: parent
+
+ Timer {
+ id: screenSaverTimer
+ interval: screenTimeout * 1000
+ running: true
+ onTriggered: {
+ timelineRoot.grabToImage(function(result) {
+ imageSource = result.url;
+ screenSaver.visible = true
+ particles.resume()
+ }, Qt.size(width, height))
+ }
+ }
+
+ // Reset screensaver timer when clicks are received
+ MouseArea {
+ anchors.fill: parent
+ // Pass mouse events through
+ propagateComposedEvents: true
+ hoverEnabled: true
+ onClicked: {
+ screenSaverTimer.restart();
+ mouse.accepted = false;
+ }
+ }
+
+ Rectangle {
+ id: screenSaver
+ anchors.fill: parent
+ visible: false
+ color: "transparent"
+
+ Image {
+ id: image
+ visible : screenSaver.visible
+ anchors.fill: parent
+ source: imageSource
+ }
+
+ ShaderEffectSource {
+ id: effectSource
+
+ sourceItem: image
+ anchors.fill: image
+ sourceRect: Qt.rect(0,0, width, height)
+ }
+
+ FastBlur{
+ id: blur
+ anchors.fill: effectSource
+ source: effectSource
+ radius: 50
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ propagateComposedEvents: true
+ hoverEnabled: true
+ onClicked: {
+ screenSaver.visible = false;
+ screenSaverTimer.restart();
+ mouse.accepted = false
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index c4c18e0e..95a025cf 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -28,7 +28,7 @@ Item {
if (mouse.button === Qt.RightButton)
messageContextMenu.show(model.id, model.type, model.isEncrypted, row);
else
- event.accepted = false;
+ mouse.accepted = false;
}
onPressAndHold: {
messageContextMenu.show(model.id, model.type, model.isEncrypted, row, mapToItem(timelineRoot, mouse.x, mouse.y));
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index 38e3a928..5f43de55 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -1,3 +1,4 @@
+import "."
import "./delegates"
import "./device-verification"
import "./emoji"
@@ -187,6 +188,7 @@ Page {
}
ColumnLayout {
+ id: timelineLayout
visible: TimelineManager.timeline != null
anchors.fill: parent
spacing: 0
@@ -271,6 +273,12 @@ Page {
}
+ PrivacyScreen {
+ visible: Settings.privacyScreen
+ screenTimeout: Settings.privacyScreenTimeout
+ timelineRoot: timelineRoot
+ }
+
}
systemInactive: SystemPalette {
diff --git a/resources/res.qrc b/resources/res.qrc
index e3998bd1..308d81a6 100644
--- a/resources/res.qrc
+++ b/resources/res.qrc
@@ -131,6 +131,7 @@
<file>qml/MessageInput.qml</file>
<file>qml/MessageView.qml</file>
<file>qml/NhekoBusyIndicator.qml</file>
+ <file>qml/PrivacyScreen.qml</file>
<file>qml/Reactions.qml</file>
<file>qml/ReplyPopup.qml</file>
<file>qml/ScrollHelper.qml</file>
|