Skip to content

Commit

Permalink
WIP: Introduce a global default directory for file selection
Browse files Browse the repository at this point in the history
TODO:
- Save as QSettings item instead?
  • Loading branch information
Vogtinator committed Mar 27, 2022
1 parent 1a424ff commit ae1fdc8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions qml/Firebird/UIComponents/FileSelect.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ RowLayout {
id: dialogLoader
active: false
sourceComponent: FileDialog {
folder: Emu.dir(filePath)
folder: filePath ? Emu.dir(filePath) : Global.lastFileDialogDir
// If save dialogs are not supported, force an open dialog
selectExisting: root.selectExisting || !Emu.saveDialogSupported()
onAccepted: filePath = Emu.toLocalFile(fileUrl)
onAccepted: {
filePath = Emu.toLocalFile(fileUrl);
Global.lastFileDialogDir = Emu.dir(filePath);
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions qml/Firebird/UIComponents/Global.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pragma Singleton
import QtQuick 2.0

QtObject {
property string lastFileDialogDir: ""
}
1 change: 1 addition & 0 deletions qml/Firebird/UIComponents/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ FBLink 1.0 FBLink.qml
Toast 1.0 Toast.qml
VerticalSwipeBar 1.0 VerticalSwipeBar.qml
singleton TextMetrics 1.0 TextMetrics.qml
singleton Global 1.0 Global.qml
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<file>qml/MobileUIDrawer.qml</file>
<file>qml/DrawerButton.qml</file>
<file>qml/Firebird/UIComponents/VerticalSwipeBar.qml</file>
<file>qml/Firebird/UIComponents/Global.qml</file>
<file>qml/FlashDialog.qml</file>
</qresource>
<qresource prefix="/i18n">
Expand Down

0 comments on commit ae1fdc8

Please sign in to comment.