From b06ce798bc8d2d9b32d70f3889edf0afe4205947 Mon Sep 17 00:00:00 2001 From: D33r-Gee Date: Wed, 27 Mar 2024 11:35:07 -0700 Subject: [PATCH] qml: UI only. Added FileDialog and the initial custom datadir functionality without wiring --- src/qml/components/StorageLocations.qml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/qml/components/StorageLocations.qml b/src/qml/components/StorageLocations.qml index 241477e775..f947c0356b 100644 --- a/src/qml/components/StorageLocations.qml +++ b/src/qml/components/StorageLocations.qml @@ -5,6 +5,10 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 +import QtQuick.Dialogs 1.3 + +import org.bitcoincore.qt 1.0 + import "../controls" ColumnLayout { @@ -25,5 +29,21 @@ ColumnLayout { ButtonGroup.group: group text: qsTr("Custom") description: qsTr("Choose the directory and storage device.") + onClicked: fileDialog.open() + } + FileDialog { + id: fileDialog + selectFolder: true + folder: optionsModel.getDefaultDataDirectory + onAccepted: { + optionsModel.setCustomDataDirString(fileDialog.fileUrls[0].toString()) + var customDataDir = fileDialog.fileUrl.toString(); + if (customDataDir !== "") { + optionsModel.setCustomDataDirArgs(customDataDir); + } + } + onRejected: { + console.log("Custom datadir selection canceled") + } } -} +} \ No newline at end of file