Files

94 lines
2.7 KiB
QML
Raw Permalink Normal View History

2025-11-12 13:54:22 +01:00
import QtQuick;
import QtQuick.Controls.Basic as QQC2
import Flowee.org.pay;
import "../Flowee" as Flowee;
import "../mobile" as Mobile;
Mobile.Page {
id: root
headerText: qsTr("Import From Seed")
menuItems: [showPasswordAction]
required property QtObject pageData;
property QtObject showPasswordAction: QQC2.Action {
checkable: true
checked: false
text: qsTr("Enter Password", "Toggle to show a password field")
onTriggered: passwordBox.visible = checked
}
Column {
width: parent.width
spacing: 10
Item {
width: parent.width
height: 100
Image {
id: theLogo
source: "qrc:/backup-sync/nfc-tag.svg"
smooth: true
width: 100
height: 100
}
Flowee.Label {
anchors.left: theLogo.right
anchors.leftMargin: 6
anchors.right: parent.right
anchors.verticalCenter: theLogo.verticalCenter
text: qsTr("Wallet seed found")
font.pixelSize: root.font.pixelSize * 1.4
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
}
Mobile.PageTitledBox {
title: qsTr("Name")
width: parent.width
Flowee.TextField {
id: nameField
text: pageData.backupName
width: parent.width
}
}
Mobile.PageTitledBox {
id: passwordBox
title: qsTr("Password")
width: parent.width
visible: false
Flowee.TextField {
id: passwordField
width: parent.width
placeholderText: qsTr("imported wallet password")
}
}
Flowee.Button {
text: qsTr("Import")
anchors.right: parent.right
onClicked: {
// For now we just assume the first one to import,
// A combobox with paths and their names should be added
// if there are more.
var path = pageData.derivationPath(0);
var startHeight = pageData.pathStartingHeight(0);
var options = Pay.createImportedHDWallet(pageData.seed,
showPasswordAction.checked ? passwordField.totalText : "",
path, nameField.totalText, startHeight);
for (let a of portfolio.accounts) {
if (a.id === options.accountId) {
portfolio.current = a;
break;
}
}
thePile.pop();
}
}
}
}