diff --git a/src/QmlControls/QGCFileDialog.qml b/src/QmlControls/QGCFileDialog.qml index 256a2c6e11a31d22a429585b7d0a7790435ca54b..e770bc714a84cae3927d74c58a6842a8de062825 100644 --- a/src/QmlControls/QGCFileDialog.qml +++ b/src/QmlControls/QGCFileDialog.qml @@ -17,8 +17,8 @@ Item { property var qgcView property string folder property var nameFilters - property string fileExtension // Primary file extension to search for - property string fileExtension2 // Secondary file extension to search for + property string fileExtension // Primary file extension to search for + property string fileExtension2: "" // Secondary file extension to search for property string title property bool selectExisting property bool selectFolder @@ -28,12 +28,16 @@ Item { property bool _mobileDlg: QGroundControl.corePlugin.options.useMobileFileDialog property var _rgExtensions - Component.onCompleted: { - if (fileExtension2 === "") { + Component.onCompleted: setupFileExtensions() + + onFileExtensionChanged: setupFileExtensions() + onFileExtension2Changed: setupFileExtensions() + + function setupFileExtensions() { + if (fileExtension2 == "") { _rgExtensions = [ fileExtension ] } else { _rgExtensions = [ fileExtension, fileExtension2 ] - } } @@ -128,10 +132,7 @@ Item { property string fileToDelete - onAboutToHide: { - fileButton.highlight = false - hideDialog() - } + onAboutToHide: fileButton.highlight = false MenuItem { text: qsTr("Delete") @@ -143,7 +144,7 @@ Item { QGCLabel { text: qsTr("No files") - visible: fileList.model.length == 0 && fileList2.model.length == 0 + visible: fileList.model.length == 0 } } }