From f5c5df7b677e10c78bddb2defa7b392bfe42696a Mon Sep 17 00:00:00 2001 From: xiphon Date: Tue, 28 Jul 2020 17:42:59 +0000 Subject: [PATCH] main: accountsDir runtime configuration support --- js/Wizard.js | 4 ++-- main.qml | 7 ++++--- pages/History.qml | 2 +- pages/Transfer.qml | 4 ++-- pages/settings/SettingsInfo.qml | 2 +- wizard/WizardController.qml | 6 +++--- wizard/WizardOpenWallet1.qml | 2 +- wizard/WizardWalletInput.qml | 6 +++--- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/js/Wizard.js b/js/Wizard.js index 054b13f7..52c43a84 100644 --- a/js/Wizard.js +++ b/js/Wizard.js @@ -65,7 +65,7 @@ function createWalletPath(isIOS, folder_path,account_name){ return folder_path + "/" + account_name + "/" + account_name } -function walletPathExists(directory, filename, isIOS, walletManager) { +function walletPathExists(accountsDir, directory, filename, isIOS, walletManager) { if(!filename || filename === "") return false; if(!directory || directory === "") return false; @@ -76,7 +76,7 @@ function walletPathExists(directory, filename, isIOS, walletManager) { directory += "/" if(isIOS) - var path = moneroAccountsDir + filename; + var path = accountsDir + filename; else var path = directory + filename + "/" + filename; diff --git a/main.qml b/main.qml index 4d49e8a9..21e687c5 100644 --- a/main.qml +++ b/main.qml @@ -57,6 +57,7 @@ ApplicationWindow { property bool hideBalanceForced: false property bool ctrlPressed: false property alias persistentSettings : persistentSettings + property string accountsDir: !persistentSettings.portable ? moneroAccountsDir : persistentSettings.portableFolderName + "/wallets" property var currentWallet; property bool disconnected: currentWallet ? currentWallet.disconnected : false property var transaction; @@ -257,7 +258,7 @@ ApplicationWindow { // wallet already opened with wizard, we just need to initialize it var wallet_path = persistentSettings.wallet_path; if(isIOS) - wallet_path = moneroAccountsDir + wallet_path; + wallet_path = appWindow.accountsDir + wallet_path; // console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.walletPassword); console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet"); @@ -776,7 +777,7 @@ ApplicationWindow { function walletsFound() { if (persistentSettings.wallet_path.length > 0) { if(isIOS) - return walletManager.walletExists(moneroAccountsDir + persistentSettings.wallet_path); + return walletManager.walletExists(appWindow.accountsDir + persistentSettings.wallet_path); else return walletManager.walletExists(persistentSettings.wallet_path); } @@ -891,7 +892,7 @@ ApplicationWindow { FileDialog { id: saveTxDialog title: "Please choose a location" - folder: "file://" +moneroAccountsDir + folder: "file://" + appWindow.accountsDir selectExisting: false; onAccepted: { diff --git a/pages/History.qml b/pages/History.qml index 9422593f..7869c013 100644 --- a/pages/History.qml +++ b/pages/History.qml @@ -1692,7 +1692,7 @@ Rectangle { informationPopup.open(); } Component.onCompleted: { - var _folder = 'file://' + moneroAccountsDir; + var _folder = 'file://' + appWindow.accountsDir; try { _folder = 'file://' + desktopFolder; } diff --git a/pages/Transfer.qml b/pages/Transfer.qml index dc344069..c3ebeff3 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -621,7 +621,7 @@ Rectangle { FileDialog { id: signTxDialog title: qsTr("Please choose a file") + translationManager.emptyString - folder: "file://" +moneroAccountsDir + folder: "file://" + appWindow.accountsDir nameFilters: [ "Unsigned transfers (*)"] onAccepted: { @@ -682,7 +682,7 @@ Rectangle { FileDialog { id: submitTxDialog title: qsTr("Please choose a file") + translationManager.emptyString - folder: "file://" +moneroAccountsDir + folder: "file://" + appWindow.accountsDir nameFilters: [ "signed transfers (*)"] onAccepted: { diff --git a/pages/settings/SettingsInfo.qml b/pages/settings/SettingsInfo.qml index 703e4b6b..310243a6 100644 --- a/pages/settings/SettingsInfo.qml +++ b/pages/settings/SettingsInfo.qml @@ -135,7 +135,7 @@ Rectangle { Layout.fillWidth: true color: MoneroComponents.Style.dimmedFontColor font.pixelSize: 14 - property string walletPath: (isIOS ? moneroAccountsDir : "") + persistentSettings.wallet_path + property string walletPath: (isIOS ? appWindow.accountsDir : "") + persistentSettings.wallet_path text: "\