mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 16:28:14 +00:00
Merge pull request #93
e6fe9d3
wizard: empty seed box on page load (Jacob Brydolf)776a591
Wizard: Delete old wallet object before creating new (Jacob Brydolf)c873da7
added debug message on wallet close (Jacob Brydolf)9afa5d7
wizard: updated open from file icon (Jacob Brydolf)d637b58
wizard: warn user if wallet exists in path (Jacob Brydolf)e09ccd3
open last opened wallet on gui start. (Jacob Brydolf)1218bf3
Capitalized Monero in default path (Jacob Brydolf)6b7adbc
refresh transaction history on wallet change (Jacob Brydolf)fd67c61
show wizard if password dialog is closed (Jacob Brydolf)6818ecd
new wallet default path + open wallet from file (Jacob Brydolf)0974490
wizard: default account name on recover page (Jacob Brydolf)21414d7
wizardOptions: open from file button (Jacob Brydolf)ec3d586
wizard: change default account name + validation nextButton (Jacob Brydolf)469bb9f
wizard: disable donation page (Jacob Brydolf)1d0ddff
wizard: open fallet from file (Jacob Brydolf)12332ca
settings: close wallet button (Jacob Brydolf)675e35d
wizard: skip language page if only 1 language is availible (Jacob Brydolf)b795c4b
generate default account name from env username (Jacob Brydolf)a3c6c40
change default wallet path + remove auto create path on startup (Jacob Brydolf)a34efed
settings: remove daemon connection check (Jacob Brydolf)49c022b
Wizard: check pwd on page load (Jacob Brydolf)
This commit is contained in:
commit
6142afdb7b
11 changed files with 288 additions and 95 deletions
15
main.cpp
15
main.cpp
|
@ -116,12 +116,21 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!moneroAccountsRootDir.empty()) {
|
if (!moneroAccountsRootDir.empty()) {
|
||||||
QString moneroAccountsDir = moneroAccountsRootDir.at(0) + "/Monero Accounts";
|
QString moneroAccountsDir = moneroAccountsRootDir.at(0) + "/Monero/wallets";
|
||||||
QDir tempDir;
|
|
||||||
tempDir.mkpath(moneroAccountsDir);
|
|
||||||
engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir);
|
engine.rootContext()->setContextProperty("moneroAccountsDir", moneroAccountsDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get default account name
|
||||||
|
QString accountName = qgetenv("USER"); // mac/linux
|
||||||
|
if (accountName.isEmpty()){
|
||||||
|
accountName = qgetenv("USERNAME"); // Windows
|
||||||
|
}
|
||||||
|
if (accountName.isEmpty()) {
|
||||||
|
accountName = "My monero Account";
|
||||||
|
}
|
||||||
|
|
||||||
|
engine.rootContext()->setContextProperty("defaultAccountName", accountName);
|
||||||
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath());
|
||||||
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
|
||||||
QObject *rootObject = engine.rootObjects().first();
|
QObject *rootObject = engine.rootObjects().first();
|
||||||
|
|
76
main.qml
76
main.qml
|
@ -130,6 +130,12 @@ ApplicationWindow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openWalletFromFile(){
|
||||||
|
persistentSettings.restore_height = 0
|
||||||
|
persistentSettings.is_recovering = false
|
||||||
|
appWindow.password = ""
|
||||||
|
fileDialog.open();
|
||||||
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
console.log("initializing..")
|
console.log("initializing..")
|
||||||
|
@ -148,6 +154,12 @@ ApplicationWindow {
|
||||||
if (currentWallet != undefined) {
|
if (currentWallet != undefined) {
|
||||||
console.log("closing currentWallet")
|
console.log("closing currentWallet")
|
||||||
walletManager.closeWallet(currentWallet);
|
walletManager.closeWallet(currentWallet);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// set page to transfer if not changing daemon
|
||||||
|
middlePanel.state = "Transfer";
|
||||||
|
leftPanel.selectItem(middlePanel.state)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// wallet already opened with wizard, we just need to initialize it
|
// wallet already opened with wizard, we just need to initialize it
|
||||||
|
@ -158,7 +170,6 @@ ApplicationWindow {
|
||||||
restoreHeight = persistentSettings.restore_height
|
restoreHeight = persistentSettings.restore_height
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("using wizard wallet")
|
|
||||||
connectWallet(wizard.settings['wallet'])
|
connectWallet(wizard.settings['wallet'])
|
||||||
|
|
||||||
isNewWallet = true
|
isNewWallet = true
|
||||||
|
@ -171,6 +182,7 @@ ApplicationWindow {
|
||||||
walletManager.openWalletAsync(wallet_path, appWindow.password,
|
walletManager.openWalletAsync(wallet_path, appWindow.password,
|
||||||
persistentSettings.testnet);
|
persistentSettings.testnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,8 +201,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function walletPath() {
|
function walletPath() {
|
||||||
var wallet_path = persistentSettings.wallet_path + "/" + persistentSettings.account_name + "/"
|
var wallet_path = persistentSettings.wallet_path
|
||||||
+ persistentSettings.account_name;
|
|
||||||
return wallet_path;
|
return wallet_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,12 +316,19 @@ ApplicationWindow {
|
||||||
|
|
||||||
|
|
||||||
function walletsFound() {
|
function walletsFound() {
|
||||||
|
if (persistentSettings.wallet_path.length > 0) {
|
||||||
|
var lastOpenedExists = walletManager.walletExists(persistentSettings.wallet_path);
|
||||||
|
if (lastOpenedExists) {
|
||||||
|
console.log("Last opened wallet exists in:",persistentSettings.wallet_path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if wallets exists in default path
|
||||||
var wallets = walletManager.findWallets(moneroAccountsDir);
|
var wallets = walletManager.findWallets(moneroAccountsDir);
|
||||||
if (wallets.length === 0) {
|
if (wallets.length === 0) {
|
||||||
wallets = walletManager.findWallets(applicationDirectory);
|
wallets = walletManager.findWallets(applicationDirectory);
|
||||||
}
|
}
|
||||||
print(wallets);
|
return (wallets.length > 0 || lastOpenedExists);
|
||||||
return wallets.length > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,6 +441,17 @@ ApplicationWindow {
|
||||||
splash.close()
|
splash.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// close wallet and show wizard
|
||||||
|
function showWizard(){
|
||||||
|
walletInitialized = false;
|
||||||
|
splashCounter = 0;
|
||||||
|
// we can't close async here. Gui crashes if wallet is open
|
||||||
|
walletManager.closeWallet(currentWallet);
|
||||||
|
wizard.restart();
|
||||||
|
rootItem.state = "wizard"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
objectName: "appWindow"
|
objectName: "appWindow"
|
||||||
visible: true
|
visible: true
|
||||||
|
@ -440,10 +469,13 @@ ApplicationWindow {
|
||||||
walletManager.walletOpened.connect(onWalletOpened);
|
walletManager.walletOpened.connect(onWalletOpened);
|
||||||
walletManager.walletClosed.connect(onWalletClosed);
|
walletManager.walletClosed.connect(onWalletClosed);
|
||||||
|
|
||||||
rootItem.state = walletsFound() ? "normal" : "wizard";
|
if(!walletsFound()) {
|
||||||
if (rootItem.state === "normal") {
|
rootItem.state = "wizard"
|
||||||
initialize(persistentSettings)
|
} else {
|
||||||
|
rootItem.state = "normal"
|
||||||
|
initialize(persistentSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onRightPanelExpandedChanged: {
|
onRightPanelExpandedChanged: {
|
||||||
|
@ -493,6 +525,24 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Open Wallet from file
|
||||||
|
FileDialog {
|
||||||
|
id: fileDialog
|
||||||
|
title: "Please choose a file"
|
||||||
|
folder: "file://" +moneroAccountsDir
|
||||||
|
nameFilters: [ "Wallet files (*.keys)"]
|
||||||
|
|
||||||
|
onAccepted: {
|
||||||
|
persistentSettings.wallet_path = walletManager.urlToLocalPath(fileDialog.fileUrl)
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
onRejected: {
|
||||||
|
console.log("Canceled")
|
||||||
|
rootItem.state = "wizard";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PasswordDialog {
|
PasswordDialog {
|
||||||
id: passwordDialog
|
id: passwordDialog
|
||||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
||||||
|
@ -501,7 +551,8 @@ ApplicationWindow {
|
||||||
appWindow.initialize();
|
appWindow.initialize();
|
||||||
}
|
}
|
||||||
onRejected: {
|
onRejected: {
|
||||||
appWindow.enableUI(false)
|
//appWindow.enableUI(false)
|
||||||
|
rootItem.state = "wizard"
|
||||||
}
|
}
|
||||||
onDiscard: {
|
onDiscard: {
|
||||||
appWindow.enableUI(false)
|
appWindow.enableUI(false)
|
||||||
|
@ -729,6 +780,10 @@ ApplicationWindow {
|
||||||
rootItem.state = "normal" // TODO: listen for this state change in appWindow;
|
rootItem.state = "normal" // TODO: listen for this state change in appWindow;
|
||||||
appWindow.initialize();
|
appWindow.initialize();
|
||||||
}
|
}
|
||||||
|
onOpenWalletFromFileClicked: {
|
||||||
|
rootItem.state = "normal" // TODO: listen for this state change in appWindow;
|
||||||
|
appWindow.openWalletFromFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property int maxWidth: leftPanel.width + 655 + rightPanel.width
|
property int maxWidth: leftPanel.width + 655 + rightPanel.width
|
||||||
|
@ -810,7 +865,6 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClosing: {
|
onClosing: {
|
||||||
walletManager.closeWallet(currentWallet);
|
//walletManager.closeWallet(currentWallet);
|
||||||
console.log("onClosing called");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,15 +56,6 @@ Rectangle {
|
||||||
daemonAddress = persistentSettings.daemon_address.split(":");
|
daemonAddress = persistentSettings.daemon_address.split(":");
|
||||||
console.log("address: " + persistentSettings.daemon_address)
|
console.log("address: " + persistentSettings.daemon_address)
|
||||||
// try connecting to daemon
|
// try connecting to daemon
|
||||||
var connectedToDaemon = currentWallet.connectToDaemon();
|
|
||||||
|
|
||||||
if(!connectedToDaemon){
|
|
||||||
console.log("not connected");
|
|
||||||
//TODO: Print error?
|
|
||||||
//daemonStatusText.text = qsTr("Unable to connect to Daemon.")
|
|
||||||
//daemonStatusText.visible = true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,36 +232,46 @@ Rectangle {
|
||||||
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: daemonStatusRow
|
Label {
|
||||||
|
id: closeWalletLabel
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
color: "#4A4949"
|
||||||
|
text: qsTr("Manage wallet") + translationManager.emptyString
|
||||||
|
fontSize: 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RowLayout {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: daemonStatusText
|
id: closeWalletTip
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 18
|
font.pointSize: 12
|
||||||
wrapMode: Text.Wrap
|
color: "#4A4646"
|
||||||
textFormat: Text.RichText
|
Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignHCenter
|
wrapMode: Text.WordWrap
|
||||||
color: "#FF0000"
|
text: qsTr("Close current wallet and open wizard")
|
||||||
visible: true //!currentWallet.connected
|
+ translationManager.emptyString
|
||||||
}
|
}
|
||||||
|
|
||||||
// StandardButton {
|
|
||||||
// id: checkConnectionButton
|
StandardButton {
|
||||||
// anchors.left: daemonStatusText.right
|
id: closeWalletButton
|
||||||
// anchors.leftMargin: 30
|
|
||||||
// width: 90
|
// Layout.leftMargin: 30
|
||||||
// text: qsTr("Check again") + translationManager.emptyString
|
// Layout.minimumWidth: 100
|
||||||
// shadowReleasedColor: "#FF4304"
|
width: 100
|
||||||
// shadowPressedColor: "#B32D00"
|
text: qsTr("Close wallet") + translationManager.emptyString
|
||||||
// releasedColor: "#FF6C3C"
|
shadowReleasedColor: "#FF4304"
|
||||||
// pressedColor: "#FF4304"
|
shadowPressedColor: "#B32D00"
|
||||||
// visible: true
|
releasedColor: "#FF6C3C"
|
||||||
// onClicked: {
|
pressedColor: "#FF4304"
|
||||||
// checkDaemonConnection();
|
visible: true
|
||||||
// }
|
onClicked: {
|
||||||
// }
|
console.log("closing wallet button clicked")
|
||||||
|
appWindow.showWizard();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,5 +268,6 @@ Wallet::Wallet(Bitmonero::Wallet *w, QObject *parent)
|
||||||
|
|
||||||
Wallet::~Wallet()
|
Wallet::~Wallet()
|
||||||
{
|
{
|
||||||
|
qDebug("~Wallet: Closing wallet");
|
||||||
Bitmonero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
|
Bitmonero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ Item {
|
||||||
settingsObject['account_name'] = uiItem.accountNameText
|
settingsObject['account_name'] = uiItem.accountNameText
|
||||||
settingsObject['words'] = uiItem.wordsTexttext
|
settingsObject['words'] = uiItem.wordsTexttext
|
||||||
settingsObject['wallet_path'] = uiItem.walletPath
|
settingsObject['wallet_path'] = uiItem.walletPath
|
||||||
return true;
|
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
||||||
|
return !wizard.walletExists(walletFullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkNextButton() {
|
function checkNextButton() {
|
||||||
|
@ -70,25 +71,24 @@ Item {
|
||||||
// TODO: create wallet in temporary filename and a) move it to the path specified by user after the final
|
// TODO: create wallet in temporary filename and a) move it to the path specified by user after the final
|
||||||
// page submitted or b) delete it when program closed before reaching final page
|
// page submitted or b) delete it when program closed before reaching final page
|
||||||
|
|
||||||
var wallet_filename = oshelper.temporaryFilename();
|
// Always delete the wallet object before creating new - we could be stepping back from recovering wallet
|
||||||
if (typeof settingsObject.wallet === 'undefined') {
|
if (typeof settingsObject.wallet !== 'undefined') {
|
||||||
//var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.language)
|
settingsObject.wallet.destroy()
|
||||||
var testnet = appWindow.persistentSettings.testnet;
|
console.log("deleting wallet")
|
||||||
var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.wallet_language,
|
|
||||||
testnet)
|
|
||||||
uiItem.wordsTextItem.memoText = wallet.seed
|
|
||||||
// saving wallet in "global" settings object
|
|
||||||
// TODO: wallet should have a property pointing to the file where it stored or loaded from
|
|
||||||
settingsObject.wallet = wallet
|
|
||||||
} else {
|
|
||||||
print("wallet already created. we just stepping back");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var wallet_filename = oshelper.temporaryFilename();
|
||||||
|
//var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.language)
|
||||||
|
var testnet = appWindow.persistentSettings.testnet;
|
||||||
|
var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.wallet_language,
|
||||||
|
testnet)
|
||||||
|
uiItem.wordsTextItem.memoText = wallet.seed
|
||||||
|
// saving wallet in "global" settings object
|
||||||
|
// TODO: wallet should have a property pointing to the file where it stored or loaded from
|
||||||
|
settingsObject.wallet = wallet
|
||||||
settingsObject.wallet_filename = wallet_filename
|
settingsObject.wallet_filename = wallet_filename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WizardManageWalletUI {
|
WizardManageWalletUI {
|
||||||
id: uiItem
|
id: uiItem
|
||||||
titleText: qsTr("A new wallet has been created for you") + translationManager.emptyString
|
titleText: qsTr("A new wallet has been created for you") + translationManager.emptyString
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
|
@ -38,17 +39,37 @@ Rectangle {
|
||||||
property int currentPage: 0
|
property int currentPage: 0
|
||||||
|
|
||||||
property var paths: {
|
property var paths: {
|
||||||
"create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ],
|
// "create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, donationPage, finishPage ],
|
||||||
"recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ]
|
// "recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, donationPage, finishPage ],
|
||||||
|
// disable donation page
|
||||||
|
"create_wallet" : [welcomePage, optionsPage, createWalletPage, passwordPage, finishPage ],
|
||||||
|
"recovery_wallet" : [welcomePage, optionsPage, recoveryWalletPage, passwordPage, finishPage ],
|
||||||
|
|
||||||
}
|
}
|
||||||
property string currentPath: "create_wallet"
|
property string currentPath: "create_wallet"
|
||||||
property var pages: paths[currentPath]
|
property var pages: paths[currentPath]
|
||||||
|
|
||||||
signal useMoneroClicked()
|
signal useMoneroClicked()
|
||||||
|
signal openWalletFromFileClicked()
|
||||||
border.color: "#DBDBDB"
|
border.color: "#DBDBDB"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
|
|
||||||
|
function restart(){
|
||||||
|
wizard.currentPage = 0;
|
||||||
|
wizard.settings = ({})
|
||||||
|
wizard.currentPath = "create_wallet"
|
||||||
|
wizard.pages = paths[currentPath]
|
||||||
|
|
||||||
|
//hide all pages except first
|
||||||
|
for (var i = 1; i < wizard.pages.length; i++){
|
||||||
|
wizard.pages[i].opacity = 0;
|
||||||
|
}
|
||||||
|
//Show first pages
|
||||||
|
wizard.pages[0].opacity = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function switchPage(next) {
|
function switchPage(next) {
|
||||||
// save settings for current page;
|
// save settings for current page;
|
||||||
if (next && typeof pages[currentPage].onPageClosed !== 'undefined') {
|
if (next && typeof pages[currentPage].onPageClosed !== 'undefined') {
|
||||||
|
@ -58,7 +79,7 @@ Rectangle {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
print ("switchpage: currentPage: ", currentPage);
|
console.log("switchpage: currentPage: ", currentPage);
|
||||||
|
|
||||||
if (currentPage > 0 || currentPage < pages.length - 1) {
|
if (currentPage > 0 || currentPage < pages.length - 1) {
|
||||||
pages[currentPage].opacity = 0
|
pages[currentPage].opacity = 0
|
||||||
|
@ -103,24 +124,40 @@ Rectangle {
|
||||||
currentPage = pages.indexOf(recoveryWalletPage)
|
currentPage = pages.indexOf(recoveryWalletPage)
|
||||||
wizard.nextButton.visible = true
|
wizard.nextButton.visible = true
|
||||||
recoveryWalletPage.onPageOpened(settings);
|
recoveryWalletPage.onPageOpened(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
function openOpenWalletPage() {
|
||||||
|
console.log("open wallet from file page");
|
||||||
|
wizard.openWalletFromFileClicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWalletPath(folder_path,account_name){
|
||||||
|
|
||||||
|
// Remove trailing slash - (default on windows and mac)
|
||||||
|
if (folder_path.substring(folder_path.length -1) === "/"){
|
||||||
|
folder_path = folder_path.substring(0,folder_path.length -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return folder_path + "/" + account_name + "/" + account_name
|
||||||
|
}
|
||||||
|
|
||||||
|
function walletExists(path){
|
||||||
|
if(walletManager.walletExists(path)){
|
||||||
|
walletExistsErrorDialog.open();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! actually writes the wallet
|
//! actually writes the wallet
|
||||||
function applySettings() {
|
function applySettings() {
|
||||||
console.log("Here we apply the settings");
|
console.log("Here we apply the settings");
|
||||||
// here we need to actually move wallet to the new location
|
// here we need to actually move wallet to the new location
|
||||||
|
console.log(settings.wallet_full_path);
|
||||||
|
|
||||||
// Remove trailing slash - (default on windows and mac)
|
var new_wallet_filename = createWalletPath(settings.wallet_path,settings.account_name)
|
||||||
if (settings.wallet_path.substring(settings.wallet_path.length -1) === "/"){
|
|
||||||
settings.wallet_path = settings.wallet_path.substring(0,settings.wallet_path.length -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
var new_wallet_filename = settings.wallet_path + "/"
|
console.log("saving in wizard: "+ new_wallet_filename)
|
||||||
+ settings.account_name + "/"
|
|
||||||
+ settings.account_name;
|
|
||||||
|
|
||||||
console.log("saving to wizard: "+ new_wallet_filename)
|
|
||||||
// moving wallet files to the new destination, if user changed it
|
// moving wallet files to the new destination, if user changed it
|
||||||
if (new_wallet_filename !== settings.wallet_filename) {
|
if (new_wallet_filename !== settings.wallet_filename) {
|
||||||
// using previously saved wallet;
|
// using previously saved wallet;
|
||||||
|
@ -140,25 +177,32 @@ Rectangle {
|
||||||
appWindow.persistentSettings.language = settings.language
|
appWindow.persistentSettings.language = settings.language
|
||||||
appWindow.persistentSettings.locale = settings.locale
|
appWindow.persistentSettings.locale = settings.locale
|
||||||
appWindow.persistentSettings.account_name = settings.account_name
|
appWindow.persistentSettings.account_name = settings.account_name
|
||||||
appWindow.persistentSettings.wallet_path = settings.wallet_path
|
appWindow.persistentSettings.wallet_path = new_wallet_filename
|
||||||
appWindow.persistentSettings.allow_background_mining = settings.allow_background_mining
|
appWindow.persistentSettings.allow_background_mining = false //settings.allow_background_mining
|
||||||
appWindow.persistentSettings.auto_donations_enabled = settings.auto_donations_enabled
|
appWindow.persistentSettings.auto_donations_enabled = false //settings.auto_donations_enabled
|
||||||
appWindow.persistentSettings.auto_donations_amount = settings.auto_donations_amount
|
appWindow.persistentSettings.auto_donations_amount = false //settings.auto_donations_amount
|
||||||
appWindow.persistentSettings.daemon_address = settings.daemon_address
|
appWindow.persistentSettings.daemon_address = settings.daemon_address
|
||||||
appWindow.persistentSettings.testnet = settings.testnet
|
appWindow.persistentSettings.testnet = settings.testnet
|
||||||
appWindow.persistentSettings.restore_height = (isNaN(settings.restore_height))? 0 : settings.restore_height
|
appWindow.persistentSettings.restore_height = (isNaN(settings.restore_height))? 0 : settings.restore_height
|
||||||
appWindow.persistentSettings.is_recovering = (settings.is_recovering === undefined)? false : settings.is_recovering
|
appWindow.persistentSettings.is_recovering = (settings.is_recovering === undefined)? false : settings.is_recovering
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reading settings from persistent storage
|
// reading settings from persistent storage
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log("rootItem: ", appWindow);
|
|
||||||
settings['allow_background_mining'] = appWindow.persistentSettings.allow_background_mining
|
settings['allow_background_mining'] = appWindow.persistentSettings.allow_background_mining
|
||||||
settings['auto_donations_enabled'] = appWindow.persistentSettings.auto_donations_enabled
|
settings['auto_donations_enabled'] = appWindow.persistentSettings.auto_donations_enabled
|
||||||
settings['auto_donations_amount'] = appWindow.persistentSettings.auto_donations_amount
|
settings['auto_donations_amount'] = appWindow.persistentSettings.auto_donations_amount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: walletExistsErrorDialog
|
||||||
|
title: "Error"
|
||||||
|
text: qsTr("A wallet with same name already exists. Please change wallet name") + translationManager.emptyString
|
||||||
|
onAccepted: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: nextButton
|
id: nextButton
|
||||||
|
@ -206,6 +250,7 @@ Rectangle {
|
||||||
anchors.rightMargin: 50
|
anchors.rightMargin: 50
|
||||||
onCreateWalletClicked: wizard.openCreateWalletPage()
|
onCreateWalletClicked: wizard.openCreateWalletPage()
|
||||||
onRecoveryWalletClicked: wizard.openRecoveryWalletPage()
|
onRecoveryWalletClicked: wizard.openRecoveryWalletPage()
|
||||||
|
onOpenWalletClicked: wizard.openOpenWalletPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardCreateWallet {
|
WizardCreateWallet {
|
||||||
|
@ -228,8 +273,6 @@ Rectangle {
|
||||||
anchors.rightMargin: 50
|
anchors.rightMargin: 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WizardPassword {
|
WizardPassword {
|
||||||
id: passwordPage
|
id: passwordPage
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -299,7 +342,7 @@ Rectangle {
|
||||||
visible: parent.paths[currentPath][currentPage] === finishPage
|
visible: parent.paths[currentPath][currentPage] === finishPage
|
||||||
onClicked: {
|
onClicked: {
|
||||||
wizard.applySettings();
|
wizard.applySettings();
|
||||||
wizard.useMoneroClicked()
|
wizard.useMoneroClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,13 @@ Item {
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
color: "#FF6C3C"
|
color: "#FF6C3C"
|
||||||
focus: true
|
focus: true
|
||||||
text: qsTr("My account name") + translationManager.emptyString
|
text: defaultAccountName
|
||||||
|
|
||||||
|
|
||||||
|
Keys.onReleased: {
|
||||||
|
wizard.nextButton.enabled = (accountName.length > 0)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -35,8 +35,10 @@ Item {
|
||||||
id: page
|
id: page
|
||||||
signal createWalletClicked()
|
signal createWalletClicked()
|
||||||
signal recoveryWalletClicked()
|
signal recoveryWalletClicked()
|
||||||
|
signal openWalletClicked()
|
||||||
opacity: 0
|
opacity: 0
|
||||||
visible: false
|
visible: false
|
||||||
|
property var buttonSize: 190
|
||||||
|
|
||||||
function saveDaemonAddress() {
|
function saveDaemonAddress() {
|
||||||
wizard.settings["daemon_address"] = daemonAddress.text
|
wizard.settings["daemon_address"] = daemonAddress.text
|
||||||
|
@ -96,16 +98,23 @@ Item {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 40
|
spacing: 40
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 30
|
spacing: 30
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 202; height: 202
|
width: page.buttonSize; height: page.buttonSize
|
||||||
radius: 101
|
radius: page.buttonSize
|
||||||
color: createWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF"
|
color: createWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF"
|
||||||
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
width:page.buttonSize -30
|
||||||
|
height:page.buttonSize -30
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
horizontalAlignment: Image.AlignRight
|
||||||
|
verticalAlignment: Image.AlignTop
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
source: "qrc:///images/createWallet.png"
|
source: "qrc:///images/createWallet.png"
|
||||||
}
|
}
|
||||||
|
@ -126,7 +135,9 @@ Item {
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: "#4A4949"
|
color: "#4A4949"
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: qsTr("This is my first time, I want to<br/>create a new account") + translationManager.emptyString
|
width:page.buttonSize
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: qsTr("This is my first time, I want to create a new account") + translationManager.emptyString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,11 +146,14 @@ Item {
|
||||||
spacing: 30
|
spacing: 30
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 202; height: 202
|
width: page.buttonSize; height: page.buttonSize
|
||||||
radius: 101
|
radius: page.buttonSize
|
||||||
color: recoverWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF"
|
color: recoverWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
width:page.buttonSize -30
|
||||||
|
height:page.buttonSize -30
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
source: "qrc:///images/recoverWallet.png"
|
source: "qrc:///images/recoverWallet.png"
|
||||||
}
|
}
|
||||||
|
@ -160,9 +174,53 @@ Item {
|
||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: "#4A4949"
|
color: "#4A4949"
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: qsTr("I want to recover my account<br/>from my 25 word seed") + translationManager.emptyString
|
text: qsTr("I want to recover my account from my 25 word seed") + translationManager.emptyString
|
||||||
|
width:page.buttonSize
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 30
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: page.buttonSize; height: page.buttonSize
|
||||||
|
radius: page.buttonSize
|
||||||
|
color: openWalletArea.containsMouse ? "#DBDBDB" : "#FFFFFF"
|
||||||
|
|
||||||
|
Image {
|
||||||
|
width:page.buttonSize -30
|
||||||
|
height:page.buttonSize -30
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
anchors.centerIn: parent
|
||||||
|
source: "qrc:///images/openAccount.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: openWalletArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: {
|
||||||
|
page.saveDaemonAddress()
|
||||||
|
page.openWalletClicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 16
|
||||||
|
color: "#4A4949"
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: qsTr("I want to open a wallet from file") + translationManager.emptyString
|
||||||
|
width:page.buttonSize
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ Item {
|
||||||
|
|
||||||
function onPageOpened(settingsObject) {
|
function onPageOpened(settingsObject) {
|
||||||
wizard.nextButton.enabled = true
|
wizard.nextButton.enabled = true
|
||||||
|
handlePassword();
|
||||||
|
|
||||||
if (wizard.currentPath === "create_wallet") {
|
if (wizard.currentPath === "create_wallet") {
|
||||||
passwordPage.titleText = qsTr("Now that your wallet has been created, please set a password for the wallet") + translationManager.emptyString
|
passwordPage.titleText = qsTr("Now that your wallet has been created, please set a password for the wallet") + translationManager.emptyString
|
||||||
|
|
|
@ -43,6 +43,8 @@ Item {
|
||||||
|
|
||||||
function onPageOpened(settingsObject) {
|
function onPageOpened(settingsObject) {
|
||||||
checkNextButton();
|
checkNextButton();
|
||||||
|
// Empty seedText when restoring multiple times in one session
|
||||||
|
uiItem.wordsTextItem.memoText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkNextButton() {
|
function checkNextButton() {
|
||||||
|
@ -54,7 +56,12 @@ Item {
|
||||||
settingsObject['account_name'] = uiItem.accountNameText
|
settingsObject['account_name'] = uiItem.accountNameText
|
||||||
settingsObject['words'] = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText)
|
settingsObject['words'] = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText)
|
||||||
settingsObject['wallet_path'] = uiItem.walletPath
|
settingsObject['wallet_path'] = uiItem.walletPath
|
||||||
settingsObject['restore_height'] = parseInt(uiItem.restoreHeight)
|
var restoreHeight = parseInt(uiItem.restoreHeight);
|
||||||
|
settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight
|
||||||
|
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
||||||
|
if(wizard.walletExists(walletFullPath)){
|
||||||
|
return false
|
||||||
|
}
|
||||||
return recoveryWallet(settingsObject)
|
return recoveryWallet(settingsObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +83,7 @@ Item {
|
||||||
|
|
||||||
WizardManageWalletUI {
|
WizardManageWalletUI {
|
||||||
id: uiItem
|
id: uiItem
|
||||||
accountNameText: qsTr("My account name") + translationManager.emptyString
|
accountNameText: defaultAccountName
|
||||||
titleText: qsTr("We're ready to recover your account") + translationManager.emptyString
|
titleText: qsTr("We're ready to recover your account") + translationManager.emptyString
|
||||||
wordsTextTitle: qsTr("Please enter your 25 word private key") + translationManager.emptyString
|
wordsTextTitle: qsTr("Please enter your 25 word private key") + translationManager.emptyString
|
||||||
wordsTextItem.clipboardButtonVisible: false
|
wordsTextItem.clipboardButtonVisible: false
|
||||||
|
|
|
@ -45,13 +45,18 @@ Item {
|
||||||
|
|
||||||
onOpacityChanged: visible = opacity !== 0
|
onOpacityChanged: visible = opacity !== 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onPageClosed(settingsObject) {
|
function onPageClosed(settingsObject) {
|
||||||
|
|
||||||
|
// set default language to first item if none selected
|
||||||
|
if(gridView.currentIndex === -1) {
|
||||||
|
gridView.currentIndex = 0
|
||||||
|
}
|
||||||
|
|
||||||
var lang = languagesModel.get(gridView.currentIndex);
|
var lang = languagesModel.get(gridView.currentIndex);
|
||||||
settingsObject['language'] = lang.display_name;
|
settingsObject['language'] = lang.display_name;
|
||||||
settingsObject['wallet_language'] = lang.wallet_language;
|
settingsObject['wallet_language'] = lang.wallet_language;
|
||||||
settingsObject['locale'] = lang.locale;
|
settingsObject['locale'] = lang.locale;
|
||||||
|
console.log("Language chosen: ",lang.display_name)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +113,15 @@ Item {
|
||||||
// and set current language accordingly
|
// and set current language accordingly
|
||||||
XmlRole { name: "isCurrent"; query: "@enabled/string()" }
|
XmlRole { name: "isCurrent"; query: "@enabled/string()" }
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if(status === XmlListModel.Ready){
|
||||||
|
console.log("languages availible: ",count);
|
||||||
|
if(count === 1){
|
||||||
|
console.log("Skipping language page until more languages are availible")
|
||||||
|
wizard.switchPage(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flags view
|
// Flags view
|
||||||
|
|
Loading…
Reference in a new issue