diff --git a/HackAndroidFileDialog.qrc b/HackAndroidFileDialog.qrc
deleted file mode 100644
index 509c471..0000000
--- a/HackAndroidFileDialog.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- src/QmlControls/HackAndroidFileDialog.qml
-
-
diff --git a/HackFileDialog.qrc b/HackFileDialog.qrc
deleted file mode 100644
index a7436f2..0000000
--- a/HackFileDialog.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- src/QmlControls/HackFileDialog.qml
-
-
diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index aba1506..8a0b3dd 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -362,15 +362,6 @@ CustomBuild {
$$PWD/resources/InstrumentValueIcons/InstrumentValueIcons.qrc \
}
-# On Qt 5.9 android versions there is the following bug: https://bugreports.qt.io/browse/QTBUG-61424
-# This prevents FileDialog from being used. So we have a temp hack workaround for it which just no-ops
-# the FileDialog fallback mechanism on android 5.9 builds.
-equals(QT_MAJOR_VERSION, 5):equals(QT_MINOR_VERSION, 9):AndroidBuild {
- RESOURCES += $$PWD/HackAndroidFileDialog.qrc
-} else {
- RESOURCES += $$PWD/HackFileDialog.qrc
-}
-
#
# Main QGroundControl portion of project file
#
diff --git a/src/MissionManager/QGCMapPolylineVisuals.qml b/src/MissionManager/QGCMapPolylineVisuals.qml
index 2a864ee..46c43b5 100644
--- a/src/MissionManager/QGCMapPolylineVisuals.qml
+++ b/src/MissionManager/QGCMapPolylineVisuals.qml
@@ -128,7 +128,6 @@ Item {
title: qsTr("Select KML File")
selectExisting: true
nameFilters: ShapeFileHelper.fileDialogKMLFilters
- fileExtension: QGroundControl.settingsManager.appSettings.kmlFileExtension
onAcceptedForLoad: {
mapPolyline.loadKMLFile(file)
diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml
index 141abed..2fe5fec 100644
--- a/src/PlanView/PlanView.qml
+++ b/src/PlanView/PlanView.qml
@@ -271,8 +271,6 @@ Item {
fileDialog.planFiles = true
fileDialog.selectExisting = true
fileDialog.nameFilters = _planMasterController.loadNameFilters
- fileDialog.fileExtension = _appSettings.planFileExtension
- fileDialog.fileExtension2 = _appSettings.missionFileExtension
fileDialog.openForLoad()
}
@@ -284,8 +282,6 @@ Item {
fileDialog.planFiles = true
fileDialog.selectExisting = false
fileDialog.nameFilters = _planMasterController.saveNameFilters
- fileDialog.fileExtension = _appSettings.planFileExtension
- fileDialog.fileExtension2 = _appSettings.missionFileExtension
fileDialog.openForSave()
}
@@ -301,8 +297,6 @@ Item {
fileDialog.planFiles = false
fileDialog.selectExisting = false
fileDialog.nameFilters = ShapeFileHelper.fileDialogKMLFilters
- fileDialog.fileExtension = _appSettings.kmlFileExtension
- fileDialog.fileExtension2 = ""
fileDialog.openForSave()
}
}
diff --git a/src/QmlControls/AppMessages.qml b/src/QmlControls/AppMessages.qml
index b6717b9..95015b4 100644
--- a/src/QmlControls/AppMessages.qml
+++ b/src/QmlControls/AppMessages.qml
@@ -162,7 +162,6 @@ Item {
id: writeDialog
folder: QGroundControl.settingsManager.appSettings.logSavePath
nameFilters: [qsTr("Log files (*.txt)"), qsTr("All Files (*)")]
- fileExtension: qsTr("txt")
selectExisting: false
title: qsTr("Select log save file")
onAcceptedForSave: {
diff --git a/src/QmlControls/HackFileDialog.qml b/src/QmlControls/HackFileDialog.qml
deleted file mode 100644
index 24e0c5d..0000000
--- a/src/QmlControls/HackFileDialog.qml
+++ /dev/null
@@ -1,9 +0,0 @@
-import QtQuick 2.3
-import QtQuick.Dialogs 1.2
-
-// On Qt 5.9 android versions there is the following bug: https://bugreports.qt.io/browse/QTBUG-61424
-// This prevents FileDialog from being used. So we have a temp hack workaround for it which just no-ops
-// the FileDialog fallback mechanism on android 5.9 builds.
-
-FileDialog {
-}
diff --git a/src/QmlControls/KMLOrSHPFileDialog.qml b/src/QmlControls/KMLOrSHPFileDialog.qml
index cf57c11..a7b3e97 100644
--- a/src/QmlControls/KMLOrSHPFileDialog.qml
+++ b/src/QmlControls/KMLOrSHPFileDialog.qml
@@ -19,6 +19,4 @@ QGCFileDialog {
title: qsTr("Select Polygon File")
selectExisting: true
nameFilters: ShapeFileHelper.fileDialogKMLOrSHPFilters
- fileExtension: QGroundControl.settingsManager.appSettings.kmlFileExtension
- fileExtension2: QGroundControl.settingsManager.appSettings.shpFileExtension
}
diff --git a/src/QmlControls/LogReplayStatusBar.qml b/src/QmlControls/LogReplayStatusBar.qml
index ab56388..e51ba01 100644
--- a/src/QmlControls/LogReplayStatusBar.qml
+++ b/src/QmlControls/LogReplayStatusBar.qml
@@ -28,8 +28,7 @@ Rectangle {
QGCFileDialog {
id: filePicker
title: qsTr("Select Telemetery Log")
- nameFilters: [qsTr("Telemetry Logs (*.%1)").arg(_logFileExtension), qsTr("All Files (*)")]
- fileExtension: _logFileExtension
+ nameFilters: [ qsTr("Telemetry Logs (*.%1)").arg(_logFileExtension), qsTr("All Files (*)") ]
selectExisting: true
folder: QGroundControl.settingsManager.appSettings.telemetrySavePath
onAcceptedForLoad: {
diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml
index 13ffcac..e8e0b81 100644
--- a/src/QmlControls/ParameterEditor.qml
+++ b/src/QmlControls/ParameterEditor.qml
@@ -287,7 +287,6 @@ Item {
QGCFileDialog {
id: fileDialog
folder: _appSettings.parameterSavePath
- fileExtension: _appSettings.parameterFileExtension
nameFilters: [ qsTr("Parameter Files (*.%1)").arg(_appSettings.parameterFileExtension) , qsTr("All Files (*.*)") ]
onAcceptedForSave: {
diff --git a/src/QmlControls/QGCFileDialog.qml b/src/QmlControls/QGCFileDialog.qml
index aba634b..baafccf 100644
--- a/src/QmlControls/QGCFileDialog.qml
+++ b/src/QmlControls/QGCFileDialog.qml
@@ -15,41 +15,14 @@ Item {
visible: false
property string folder // Due to Qt bug with file url parsing this must be an absolute path
- property var nameFilters
- property string fileExtension // Primary file extension to search for
- property string fileExtension2: "" // Secondary file extension to search for
+ property var nameFilters: [] // Important: Only name filters with simple wildcarding like *.foo are supported.
property string title
property bool selectExisting
property bool selectFolder
- property bool _openForLoad: true
- property real _margins: ScreenTools.defaultFontPixelHeight / 2
- property bool _mobileDlg: QGroundControl.corePlugin.options.useMobileFileDialog
- property var _rgExtensions
- property string _mobileShortPath
-
- Component.onCompleted: {
- setupFileExtensions()
- _updateMobileShortPath()
- }
-
- onFileExtensionChanged: setupFileExtensions()
- onFileExtension2Changed: setupFileExtensions()
- onFolderChanged: _updateMobileShortPath()
-
- function _updateMobileShortPath() {
- if (ScreenTools.isMobile) {
- _mobileShortPath = controller.fullFolderPathToShortMobilePath(folder);
- }
- }
-
- function setupFileExtensions() {
- if (fileExtension2 == "") {
- _rgExtensions = [ fileExtension ]
- } else {
- _rgExtensions = [ fileExtension, fileExtension2 ]
- }
- }
+ signal acceptedForLoad(string file)
+ signal acceptedForSave(string file)
+ signal rejected
function openForLoad() {
_openForLoad = true
@@ -73,17 +46,48 @@ Item {
fullFileDialog.close()
}
- signal acceptedForLoad(string file)
- signal acceptedForSave(string file)
- signal rejected
+ property bool _openForLoad: true
+ property real _margins: ScreenTools.defaultFontPixelHeight / 2
+ property bool _mobileDlg: QGroundControl.corePlugin.options.useMobileFileDialog
+ property var _rgExtensions
+ property string _mobileShortPath
+
+ Component.onCompleted: {
+ _setupFileExtensions()
+ _updateMobileShortPath()
+ }
+
+ onFolderChanged: _updateMobileShortPath()
+ onNameFiltersChanged: _setupFileExtensions()
+
+ function _updateMobileShortPath() {
+ if (ScreenTools.isMobile) {
+ _mobileShortPath = controller.fullFolderPathToShortMobilePath(folder);
+ }
+ }
+
+ function _setupFileExtensions() {
+ _rgExtensions = [ ]
+ for (var i=0; i<_root.nameFilters.length; i++) {
+ var filter = _root.nameFilters[i]
+ var regExp = /^.*\((.*)\)$/
+ var result = regExp.exec(filter)
+ if (result.length === 2) {
+ filter = result[1]
+ }
+ var rgFilters = filter.split(" ")
+ for (var j=0; j