Don't allow to open multiple file dialog at the same time

Fix #291
This commit is contained in:
Carl Schwan
2021-05-07 03:43:30 +02:00
parent 757cc99ff0
commit 17b6f4e78a

View File

@@ -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();
}
}
}