From 3d21b1168f0aba8e91e6e75271211d5340d198e8 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Tue, 8 Aug 2017 11:30:08 +0200 Subject: [PATCH] Add blockchain folder FileDialog --- main.qml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/main.qml b/main.qml index e6342d8a..39764948 100644 --- a/main.qml +++ b/main.qml @@ -1022,6 +1022,58 @@ ApplicationWindow { } + // Choose blockchain folder + FileDialog { + id: blockchainFileDialog + title: "Please choose a folder" + selectFolder: true + folder: "file://" + persistentSettings.blockchainDataDir + + onAccepted: { + var dataDir = walletManager.urlToLocalPath(blockchainFileDialog.fileUrl) + var validator = daemonManager.validateDataDir(dataDir); + if(!validator.valid) { + + confirmationDialog.title = qsTr("Warning") + translationManager.emptyString; + confirmationDialog.text = ""; + if(validator.readOnly) + confirmationDialog.text += qsTr("Error: Filesystem is read only") + "\n\n" + if(validator.storageAvailable < 20) + confirmationDialog.text += qsTr("Warning: There's only %1 GB available on the device. Blockchain requires ~%30 GB of data.").arg(validator.storageAvailable).arg(15) + "\n\n" + else + confirmationDialog.text += qsTr("Note: There's %1 GB available on the device. Blockchain requires ~%30 GB of data.").arg(validator.storageAvailable).arg(15) + "\n\n" + if(!validator.lmdbExists) + confirmationDialog.text += qsTr("Note: lmdb folder not found. A new folder will be created.") + "\n\n" + + + confirmationDialog.icon = StandardIcon.Question + confirmationDialog.cancelText = qsTr("Cancel") + + // Continue + confirmationDialog.onAcceptedCallback = function() { + persistentSettings.blockchainDataDir = dataDir + } + + // Cancel + confirmationDialog.onRejectedCallback = function() { + }; + + confirmationDialog.open() + } else { + persistentSettings.blockchainDataDir = dataDir + } + + delete validator; + + + } + onRejected: { + console.log("data dir selection canceled") + } + + } + + PasswordDialog { id: passwordDialog