From 894322a3a1d9c098a76cf2eec97a05f30a74dfe9 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 18 Aug 2018 08:11:48 +0200 Subject: Hopefully fixed file dialogs on mac. There seems to be a problem with setting visible=true before the component is completed. The dialog doesn't have to wrapped in a component anyways, and we can just show it using open. --- accounts/maildir/qml/AccountSettings.qml | 24 ++++++++++-------------- views/composer/qml/View.qml | 26 +++++++++++--------------- views/people/qml/PersonComposer.qml | 21 ++++++++++----------- 3 files changed, 31 insertions(+), 40 deletions(-) diff --git a/accounts/maildir/qml/AccountSettings.qml b/accounts/maildir/qml/AccountSettings.qml index 9553135b..44713b00 100644 --- a/accounts/maildir/qml/AccountSettings.qml +++ b/accounts/maildir/qml/AccountSettings.qml @@ -82,22 +82,18 @@ Item { iconName: Kube.Icons.folder onClicked: { - fileDialogComponent.createObject(parent) + fileDialog.open() } - Component { - id: fileDialogComponent - Dialogs.FileDialog { - id: fileDialog - - visible: true - title: "Choose the maildir folder" - - selectFolder: true - - onAccepted: { - maildirSettings.path = fileDialog.fileUrl - } + Dialogs.FileDialog { + id: fileDialog + title: qsTr("Choose a maildir folder") + folder: shortcuts.home + selectFolder: true + selectExisting: true + selectMultiple: false + onAccepted: { + maildirSettings.path = fileDialog.fileUrl } } } diff --git a/views/composer/qml/View.qml b/views/composer/qml/View.qml index de3a6a5b..9e390156 100644 --- a/views/composer/qml/View.qml +++ b/views/composer/qml/View.qml @@ -348,23 +348,19 @@ Kube.View { text: qsTr("Attach file") onClicked: { - fileDialogComponent.createObject(parent) + fileDialog.open() } - Component { - id: fileDialogComponent - Dialogs.FileDialog { - id: fileDialog - visible: true - title: qsTr("Choose a file to attach") - folder: shortcuts.home - selectFolder: false - selectExisting: true - selectMultiple: true - onAccepted: { - for (var i = 0; i < fileDialog.fileUrls.length; ++i) { - composerController.attachments.add({url: fileDialog.fileUrls[i]}) - } + Dialogs.FileDialog { + id: fileDialog + title: qsTr("Choose a file to attach") + folder: shortcuts.home + selectFolder: false + selectExisting: true + selectMultiple: true + onAccepted: { + for (var i = 0; i < fileDialog.fileUrls.length; ++i) { + composerController.attachments.add({url: fileDialog.fileUrls[i]}) } } } diff --git a/views/people/qml/PersonComposer.qml b/views/people/qml/PersonComposer.qml index ff24a456..19e8c56b 100644 --- a/views/people/qml/PersonComposer.qml +++ b/views/people/qml/PersonComposer.qml @@ -90,19 +90,18 @@ Flickable { color: "#00000000" onClicked: { - fileDialogComponent.createObject(parent) + fileDialog.open() } - Component { - id: fileDialogComponent - Dialogs.FileDialog { - id: fileDialog - visible: true - title: "Choose an Avatar" - selectFolder: false - onAccepted: { - //TODO - } + Dialogs.FileDialog { + id: fileDialog + title: qsTr("Choose an Avatar") + folder: shortcuts.home + selectFolder: false + selectExisting: true + selectMultiple: false + onAccepted: { + //TODO } } } -- cgit v1.2.3