forked from Public/monero-gui
new wallet wizard: wallet created in temporary directory and moved to
the destination at the final step
This commit is contained in:
@@ -40,18 +40,23 @@ Item {
|
||||
|
||||
onOpacityChanged: visible = opacity !== 0
|
||||
|
||||
function saveSettings(settingsObject) {
|
||||
//! function called each time we display this page
|
||||
|
||||
function onPageClosed(settingsObject) {
|
||||
settingsObject['account_name'] = uiItem.accountNameText
|
||||
settingsObject['words'] = uiItem.wordsTexttext
|
||||
settingsObject['wallet_path'] = uiItem.walletPath
|
||||
|
||||
// put wallet files to the subdirectory with the same name as
|
||||
// wallet name
|
||||
var new_wallet_filename = settingsObject.wallet_path + "/"
|
||||
+ settingsObject.account_name + "/"
|
||||
+ settingsObject.account_name;
|
||||
|
||||
// moving wallet files to the new destination, if user changed it
|
||||
if (new_wallet_filename !== settingsObject.wallet_filename) {
|
||||
// using previously saved wallet;
|
||||
settingsObject.wallet.rename(new_wallet_filename);
|
||||
settingsObject.wallet.store(new_wallet_filename);
|
||||
//walletManager.moveWallet(settingsObject.wallet_filename, new_wallet_filename);
|
||||
}
|
||||
|
||||
@@ -59,10 +64,18 @@ Item {
|
||||
settingsObject['wallet_filename'] = new_wallet_filename;
|
||||
}
|
||||
|
||||
//! function called each time we hide this page
|
||||
//
|
||||
|
||||
|
||||
function createWallet(settingsObject) {
|
||||
var wallet_filename = uiItem.walletPath + "/" + uiItem.accountNameText
|
||||
// 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
|
||||
|
||||
var wallet_filename = oshelper.temporaryFilename();
|
||||
if (typeof settingsObject.wallet === 'undefined') {
|
||||
var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.locale)
|
||||
//var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.language)
|
||||
var wallet = walletManager.createWallet(wallet_filename, "", settingsObject.wallet_language)
|
||||
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
|
||||
@@ -70,10 +83,12 @@ Item {
|
||||
} else {
|
||||
print("wallet already created. we just stepping back");
|
||||
}
|
||||
|
||||
settingsObject.wallet_filename = wallet_filename
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WizardManageWalletUI {
|
||||
id: uiItem
|
||||
titleText: qsTr("A new wallet has been created for you")
|
||||
|
||||
@@ -38,7 +38,7 @@ Item {
|
||||
|
||||
onOpacityChanged: visible = opacity !== 0
|
||||
|
||||
function saveSettings(settingsObject) {
|
||||
function onPageClosed(settingsObject) {
|
||||
settingsObject['auto_donations_enabled'] = enableAutoDonationCheckBox.checked;
|
||||
settingsObject['auto_donations_amount'] = autoDonationAmountText.text;
|
||||
settingsObject['allow_background_mining'] = allowBackgroundMiningCheckBox.checked;
|
||||
|
||||
@@ -49,8 +49,8 @@ Rectangle {
|
||||
|
||||
function switchPage(next) {
|
||||
// save settings for current page;
|
||||
if (typeof pages[currentPage].saveSettings !== 'undefined') {
|
||||
pages[currentPage].saveSettings(settings);
|
||||
if (typeof pages[currentPage].onPageClosed !== 'undefined') {
|
||||
pages[currentPage].onPageClosed(settings);
|
||||
}
|
||||
print ("switchpage: start: currentPage: ", currentPage);
|
||||
|
||||
@@ -61,7 +61,6 @@ Rectangle {
|
||||
pages[currentPage].opacity = 1;
|
||||
handlePageChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function handlePageChanged() {
|
||||
@@ -91,9 +90,9 @@ Rectangle {
|
||||
nextButton.enabled = true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function openCreateWalletPage() {
|
||||
print ("show create wallet page");
|
||||
pages[currentPage].opacity = 0;
|
||||
|
||||
@@ -206,7 +206,7 @@ Item {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
selectByMouse: true
|
||||
|
||||
text: moneroAccountsDir + "/My Wallet"
|
||||
text: moneroAccountsDir + "/"
|
||||
onFocusChanged: {
|
||||
if(focus) {
|
||||
fileDialog.folder = text
|
||||
|
||||
@@ -43,7 +43,7 @@ Item {
|
||||
|
||||
onOpacityChanged: visible = opacity !== 0
|
||||
|
||||
function saveSettings(settingsObject) {
|
||||
function onPageClosed(settingsObject) {
|
||||
settingsObject.wallet.setPassword(passwordItem.password)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ Item {
|
||||
|
||||
onOpacityChanged: visible = opacity !== 0
|
||||
|
||||
function saveSettings(settingsObject) {
|
||||
function onPageClosed(settingsObject) {
|
||||
settingsObject['account_name'] = uiItem.accountNameText
|
||||
settingsObject['words'] = uiItem.wordsTexttext
|
||||
settingsObject['wallet_path'] = uiItem.walletPath
|
||||
|
||||
@@ -36,8 +36,11 @@ Item {
|
||||
|
||||
onOpacityChanged: visible = opacity !== 0
|
||||
|
||||
function saveSettings(settingsObject) {
|
||||
settingsObject['language'] = languagesModel.get(gridView.currentIndex).name
|
||||
function onPageClosed(settingsObject) {
|
||||
var lang = languagesModel.get(gridView.currentIndex);
|
||||
settingsObject['language'] = lang.display_name;
|
||||
settingsObject['wallet_language'] = lang.wallet_name;
|
||||
settingsObject['locale'] = lang.locale;
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -78,7 +81,9 @@ Item {
|
||||
source: "/lang/languages.xml"
|
||||
query: "/languages/language"
|
||||
|
||||
XmlRole { name: "name"; query: "@name/string()" }
|
||||
XmlRole { name: "display_name"; query: "@display_name/string()" }
|
||||
XmlRole { name: "locale"; query: "@locale/string()" }
|
||||
XmlRole { name: "wallet_name"; query: "@wallet_name/string()" }
|
||||
XmlRole { name: "flag"; query: "@flag/string()" }
|
||||
// TODO: XmlListModel is read only, we should store current language somewhere else
|
||||
// and set current language accordingly
|
||||
@@ -126,7 +131,7 @@ Item {
|
||||
font.bold: gridView.currentIndex === index
|
||||
elide: Text.ElideRight
|
||||
color: "#3F3F3F"
|
||||
text: name
|
||||
text: display_name
|
||||
}
|
||||
MouseArea {
|
||||
id: delegateArea
|
||||
|
||||
Reference in New Issue
Block a user