X-Git-Url: https://www.flypig.org.uk/git/?p=openvpnui.git;a=blobdiff_plain;f=qml%2Ffilebrowse%2Fcomponents%2FInteractionBlocker.qml;fp=qml%2Ffilebrowse%2Fcomponents%2FInteractionBlocker.qml;h=89ea2e586929c7eaca88104a0e6aa627b297415d;hp=0000000000000000000000000000000000000000;hb=e24363e314aca32e7bee952f02f517a04a8dc5f2;hpb=ee3968ffa08d4e0fcbad87765efa3aeb32ff0554 diff --git a/qml/filebrowse/components/InteractionBlocker.qml b/qml/filebrowse/components/InteractionBlocker.qml new file mode 100644 index 0000000..89ea2e5 --- /dev/null +++ b/qml/filebrowse/components/InteractionBlocker.qml @@ -0,0 +1,38 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + +// This component blocks all components under it and displays a dark background +Rectangle { + id: interactionBlocker + + // clicked signal is emitted when the component is clicked + signal clicked + + visible: false + color: "#000000" + opacity: 0.4 + + MouseArea { + anchors.fill: parent + enabled: true + onClicked: interactionBlocker.clicked() + } + // use a timer to delay the visibility of interaction blocker by adjusting opacity + // this is done to prevent flashing if the file operation is fast + onVisibleChanged: { + if (visible === true) { + interactionBlocker.opacity = 0; + blockerTimer.start(); + } else { + blockerTimer.stop(); + } + } + Timer { + id: blockerTimer + interval: 300 + onTriggered: { + interactionBlocker.opacity = 0.3; + stop(); + } + } +}