Integrated file selection dialogue with the main code. Improved the
[openvpnui.git] / qml / filebrowse / components / InteractionBlocker.qml
1 import QtQuick 2.0
2 import Sailfish.Silica 1.0
3
4 // This component blocks all components under it and displays a dark background
5 Rectangle {
6     id: interactionBlocker
7
8     // clicked signal is emitted when the component is clicked
9     signal clicked
10
11     visible: false
12     color: "#000000"
13     opacity: 0.4
14
15     MouseArea {
16         anchors.fill: parent
17         enabled: true
18         onClicked: interactionBlocker.clicked()
19     }
20     // use a timer to delay the visibility of interaction blocker by adjusting opacity
21     // this is done to prevent flashing if the file operation is fast
22     onVisibleChanged: {
23         if (visible === true) {
24             interactionBlocker.opacity = 0;
25             blockerTimer.start();
26         } else {
27             blockerTimer.stop();
28         }
29     }
30     Timer {
31         id: blockerTimer
32         interval: 300
33         onTriggered: {
34             interactionBlocker.opacity = 0.3;
35             stop();
36         }
37     }
38 }