From 6aaf2124e10eebcd7634c27e0ab1bb10d508c184 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 12 Jun 2017 16:17:59 +0200 Subject: [PATCH] feat(ui/modules/Common/Form/Buttons/FileChooserButton): better file handling --- .../Common/Form/Buttons/FileChooserButton.qml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/linphone-desktop/ui/modules/Common/Form/Buttons/FileChooserButton.qml b/linphone-desktop/ui/modules/Common/Form/Buttons/FileChooserButton.qml index 2e20a817c..018d881ab 100644 --- a/linphone-desktop/ui/modules/Common/Form/Buttons/FileChooserButton.qml +++ b/linphone-desktop/ui/modules/Common/Form/Buttons/FileChooserButton.qml @@ -71,16 +71,24 @@ TextField { id: fileDialog folder: { - if (!textField.selectedFile.length) { + var selectedFile = textField.selectedFile + + if (!selectedFile.length) { return '' } - return Utils.getUriFromSystemPath(Utils.dirname(textField.selectedFile)) + return Utils.getUriFromSystemPath( + textField.selectFolder + ? selectedFile + : Utils.dirname(selectedFile) + ) } onAccepted: { - textField.selectedFile = Utils.getSystemPathFromUri(fileUrl) - textField.accepted(textField.selectedFile) + var selectedFile = Utils.getSystemPathFromUri(fileUrl) + + textField.selectedFile = selectedFile + textField.accepted(selectedFile) } onRejected: textField.rejected()