Merge pull request #3025

f5c5df7 main: accountsDir runtime configuration support (xiphon)
This commit is contained in:
luigi1111 2020-10-04 17:38:14 -05:00
commit cdfe9f338f
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
8 changed files with 17 additions and 16 deletions

View file

@ -65,7 +65,7 @@ function createWalletPath(isIOS, folder_path,account_name){
return folder_path + "/" + account_name + "/" + 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(!filename || filename === "") return false;
if(!directory || directory === "") return false; if(!directory || directory === "") return false;
@ -76,7 +76,7 @@ function walletPathExists(directory, filename, isIOS, walletManager) {
directory += "/" directory += "/"
if(isIOS) if(isIOS)
var path = moneroAccountsDir + filename; var path = accountsDir + filename;
else else
var path = directory + filename + "/" + filename; var path = directory + filename + "/" + filename;

View file

@ -61,6 +61,7 @@ ApplicationWindow {
property bool hideBalanceForced: false property bool hideBalanceForced: false
property bool ctrlPressed: false property bool ctrlPressed: false
property alias persistentSettings : persistentSettings property alias persistentSettings : persistentSettings
property string accountsDir: !persistentSettings.portable ? moneroAccountsDir : persistentSettings.portableFolderName + "/wallets"
property var currentWallet; property var currentWallet;
property bool disconnected: currentWallet ? currentWallet.disconnected : false property bool disconnected: currentWallet ? currentWallet.disconnected : false
property var transaction; property var transaction;
@ -261,7 +262,7 @@ ApplicationWindow {
// wallet already opened with wizard, we just need to initialize it // wallet already opened with wizard, we just need to initialize it
var wallet_path = persistentSettings.wallet_path; var wallet_path = persistentSettings.wallet_path;
if(isIOS) 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, "with password: ", appWindow.walletPassword);
console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet"); console.log("opening wallet at: ", wallet_path, ", network type: ", persistentSettings.nettype == NetworkType.MAINNET ? "mainnet" : persistentSettings.nettype == NetworkType.TESTNET ? "testnet" : "stagenet");
@ -801,7 +802,7 @@ ApplicationWindow {
function walletsFound() { function walletsFound() {
if (persistentSettings.wallet_path.length > 0) { if (persistentSettings.wallet_path.length > 0) {
if(isIOS) if(isIOS)
return walletManager.walletExists(moneroAccountsDir + persistentSettings.wallet_path); return walletManager.walletExists(appWindow.accountsDir + persistentSettings.wallet_path);
else else
return walletManager.walletExists(persistentSettings.wallet_path); return walletManager.walletExists(persistentSettings.wallet_path);
} }
@ -916,7 +917,7 @@ ApplicationWindow {
FileDialog { FileDialog {
id: saveTxDialog id: saveTxDialog
title: "Please choose a location" title: "Please choose a location"
folder: "file://" +moneroAccountsDir folder: "file://" + appWindow.accountsDir
selectExisting: false; selectExisting: false;
onAccepted: { onAccepted: {

View file

@ -1709,7 +1709,7 @@ Rectangle {
informationPopup.open(); informationPopup.open();
} }
Component.onCompleted: { Component.onCompleted: {
var _folder = 'file://' + moneroAccountsDir; var _folder = 'file://' + appWindow.accountsDir;
try { try {
_folder = 'file://' + desktopFolder; _folder = 'file://' + desktopFolder;
} }

View file

@ -621,7 +621,7 @@ Rectangle {
FileDialog { FileDialog {
id: signTxDialog id: signTxDialog
title: qsTr("Please choose a file") + translationManager.emptyString title: qsTr("Please choose a file") + translationManager.emptyString
folder: "file://" +moneroAccountsDir folder: "file://" + appWindow.accountsDir
nameFilters: [ "Unsigned transfers (*)"] nameFilters: [ "Unsigned transfers (*)"]
onAccepted: { onAccepted: {
@ -682,7 +682,7 @@ Rectangle {
FileDialog { FileDialog {
id: submitTxDialog id: submitTxDialog
title: qsTr("Please choose a file") + translationManager.emptyString title: qsTr("Please choose a file") + translationManager.emptyString
folder: "file://" +moneroAccountsDir folder: "file://" + appWindow.accountsDir
nameFilters: [ "signed transfers (*)"] nameFilters: [ "signed transfers (*)"]
onAccepted: { onAccepted: {

View file

@ -135,7 +135,7 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
color: MoneroComponents.Style.dimmedFontColor color: MoneroComponents.Style.dimmedFontColor
font.pixelSize: 14 font.pixelSize: 14
property string walletPath: (isIOS ? moneroAccountsDir : "") + persistentSettings.wallet_path property string walletPath: (isIOS ? appWindow.accountsDir : "") + persistentSettings.wallet_path
text: "\ text: "\
<style type='text/css'>\ <style type='text/css'>\
a {cursor:pointer;text-decoration: none; color: #FF6C3C}\ a {cursor:pointer;text-decoration: none; color: #FF6C3C}\

View file

@ -307,7 +307,7 @@ Rectangle {
FileDialog { FileDialog {
id: fileDialog id: fileDialog
title: qsTr("Please choose a file") + translationManager.emptyString title: qsTr("Please choose a file") + translationManager.emptyString
folder: "file://" + moneroAccountsDir folder: "file://" + appWindow.accountsDir
nameFilters: [ "Wallet files (*.keys)"] nameFilters: [ "Wallet files (*.keys)"]
sidebarVisible: false sidebarVisible: false
@ -381,7 +381,7 @@ Rectangle {
}; };
if (isIOS) { if (isIOS) {
new_wallet_filename = moneroAccountsDir + new_wallet_filename; new_wallet_filename = appWindow.accountsDir + new_wallet_filename;
} }
console.log("saving new wallet to", new_wallet_filename); console.log("saving new wallet to", new_wallet_filename);
wizardController.m_wallet.storeAsync(handler, new_wallet_filename); wizardController.m_wallet.storeAsync(handler, new_wallet_filename);
@ -539,7 +539,7 @@ Rectangle {
persistentSettings.wallet_path = fn; persistentSettings.wallet_path = fn;
if(isIOS) if(isIOS)
persistentSettings.wallet_path = persistentSettings.wallet_path.replace(moneroAccountsDir, ""); persistentSettings.wallet_path = persistentSettings.wallet_path.replace(appWindow.accountsDir, "");
appWindow.openWallet(); appWindow.openWallet();
} }

View file

@ -299,7 +299,7 @@ Rectangle {
function onPageCompleted(previousView){ function onPageCompleted(previousView){
if(previousView.viewName == "wizardHome"){ if(previousView.viewName == "wizardHome"){
walletKeysFilesModel.refresh(moneroAccountsDir); walletKeysFilesModel.refresh(appWindow.accountsDir);
wizardOpenWallet1.walletCount = walletKeysFilesModel.rowCount(); wizardOpenWallet1.walletCount = walletKeysFilesModel.rowCount();
flow._height = flow.calcHeight(); flow._height = flow.calcHeight();
} }

View file

@ -55,7 +55,7 @@ GridLayout {
function reset() { function reset() {
walletName.error = !walletName.verify(); walletName.error = !walletName.verify();
walletLocation.error = walletLocation.text === ""; walletLocation.error = walletLocation.text === "";
walletLocation.text = moneroAccountsDir; walletLocation.text = appWindow.accountsDir;
walletName.text = defaultAccountName; walletName.text = defaultAccountName;
} }
@ -66,7 +66,7 @@ GridLayout {
function verify(){ function verify(){
if(walletLocation === "" || /[\\\/]/.test(walletName.text)) return false; if(walletLocation === "" || /[\\\/]/.test(walletName.text)) return false;
var exists = Wizard.walletPathExists(walletLocation.text, walletName.text, isIOS, walletManager); var exists = Wizard.walletPathExists(appWindow.accountsDir, walletLocation.text, walletName.text, isIOS, walletManager);
return !exists && walletLocation.error === false; return !exists && walletLocation.error === false;
} }
@ -88,7 +88,7 @@ GridLayout {
labelFontSize: 14 labelFontSize: 14
placeholderText: "..." placeholderText: "..."
placeholderFontSize: 16 placeholderFontSize: 16
text: moneroAccountsDir + "/" text: appWindow.accountsDir + "/"
inlineButton.small: true inlineButton.small: true
inlineButtonText: qsTr("Browse") + translationManager.emptyString inlineButtonText: qsTr("Browse") + translationManager.emptyString
inlineButton.onClicked: { inlineButton.onClicked: {