Settings: fix create view only wallet button

This commit is contained in:
selsta 2019-02-26 23:53:22 +01:00
parent 42103432b7
commit 87e93e1b08
No known key found for this signature in database
GPG key ID: 2EA0A99A8B07AE5E
2 changed files with 12 additions and 49 deletions

View file

@ -24,22 +24,6 @@ function updateFromQrCode(address, payment_id, amount, tx_description, recipient
checkNextButton(); checkNextButton();
} }
function restart(){
wizard.currentPage = 0;
wizard.settings = ({})
wizard.currentPath = "create_wallet"
wizard.pages = paths[currentPath]
wizardRestarted();
//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) {
// Android focus workaround // Android focus workaround
releaseFocus(); releaseFocus();
@ -75,38 +59,6 @@ function switchPage(next) {
} }
} }
function openRecoveryWalletPage() {
wizardRestarted();
print ("show recovery wallet page");
currentPath = "recovery_wallet"
pages = paths[currentPath]
// Create temporary wallet
createWalletPage.createWallet(settings)
wizard.nextButton.visible = true
// goto next page
switchPage(true);
}
function openCreateViewOnlyWalletPage(){
pages[currentPage].opacity = 0
currentPath = "create_view_only_wallet"
pages = paths[currentPath]
currentPage = pages.indexOf(createViewOnlyWalletPage)
createViewOnlyWalletPage.opacity = 1
nextButton.visible = true
rootItem.state = "wizard";
}
function openCreateWalletFromDevicePage() {
wizardRestarted();
print ("show create wallet from device page");
currentPath = "create_wallet_from_device"
pages = paths[currentPath]
wizard.nextButton.visible = true
// goto next page
switchPage(true);
}
function createWalletPath(isIOS, folder_path,account_name){ function createWalletPath(isIOS, folder_path,account_name){
// Remove trailing slash - (default on windows and mac) // Remove trailing slash - (default on windows and mac)
if (folder_path.substring(folder_path.length -1) === "/"){ if (folder_path.substring(folder_path.length -1) === "/"){

View file

@ -177,7 +177,18 @@ Rectangle {
small: true small: true
text: qsTr("Create wallet") + translationManager.emptyString text: qsTr("Create wallet") + translationManager.emptyString
onClicked: { onClicked: {
wizard.openCreateViewOnlyWalletPage(); var newPath = currentWallet.path + "_viewonly";
if (currentWallet.createViewOnly(newPath, appWindow.walletPassword)) {
console.log("view only wallet created in " + newPath);
informationPopup.title = qsTr("Success") + translationManager.emptyString;
informationPopup.text = qsTr('The view only wallet has been created with the same password as the current wallet. You can open it by closing this current wallet, clicking the "Open wallet from file" option, and selecting the view wallet in: \n%1\nYou can change the password in the wallet settings.').arg(newPath);
informationPopup.open()
informationPopup.onCloseCallback = null
} else {
informationPopup.title = qsTr("Error") + translationManager.emptyString;
informationPopup.text = currentWallet.errorString;
informationPopup.open()
}
} }
width: 135 * scaleRatio width: 135 * scaleRatio
} }