From 17b6f4e78a1630d719f9f33607fe5b6bbbd717c2 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 7 May 2021 03:43:30 +0200 Subject: [PATCH] Don't allow to open multiple file dialog at the same time Fix #291 --- imports/NeoChat/Page/AccountsPage.qml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/imports/NeoChat/Page/AccountsPage.qml b/imports/NeoChat/Page/AccountsPage.qml index db03f7172..61f79614d 100644 --- a/imports/NeoChat/Page/AccountsPage.qml +++ b/imports/NeoChat/Page/AccountsPage.qml @@ -104,15 +104,27 @@ Kirigami.ScrollablePage { source: userEditSheet.connection.localUser.avatarMediaId ? ("image://mxc/" + userEditSheet.connection.localUser.avatarMediaId) : "" MouseArea { + id: mouseArea anchors.fill: parent + property var fileDialog: null; onClicked: { - const fileDialog = openFileDialog.createObject(Controls.ApplicationWindow.Overlay) + if (fileDialog != null) { + return; + } + + fileDialog = openFileDialog.createObject(Controls.ApplicationWindow.Overlay) fileDialog.chosen.connect(function(receivedSource) { - if (!receivedSource) return - parent.source = receivedSource - }) - fileDialog.open() + mouseArea.fileDialog = null; + if (!receivedSource) { + return; + } + parent.source = receivedSource; + }); + fileDialog.onRejected.connect(function() { + mouseArea.fileDialog = null; + }); + fileDialog.open(); } } }