mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-13 11:56:32 +02:00
commit
43d5bd3e2d
@ -106,7 +106,6 @@ Window {
|
|||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
pressedColor: "#FF4304"
|
||||||
text: qsTr("Close")
|
text: qsTr("Close")
|
||||||
KeyNavigation.tab: cancelButton
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.close()
|
root.close()
|
||||||
root.accepted()
|
root.accepted()
|
||||||
|
@ -39,6 +39,7 @@ Item {
|
|||||||
property bool error: false
|
property bool error: false
|
||||||
signal editingFinished()
|
signal editingFinished()
|
||||||
signal accepted();
|
signal accepted();
|
||||||
|
signal textUpdated();
|
||||||
|
|
||||||
height: 37
|
height: 37
|
||||||
|
|
||||||
@ -71,5 +72,6 @@ Item {
|
|||||||
font.pixelSize: parent.fontSize
|
font.pixelSize: parent.fontSize
|
||||||
onEditingFinished: item.editingFinished()
|
onEditingFinished: item.editingFinished()
|
||||||
onAccepted: item.accepted();
|
onAccepted: item.accepted();
|
||||||
|
onTextChanged: item.textUpdated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,22 @@ Wallet *WalletManager::recoveryWallet(const QString &path, const QString &memo,
|
|||||||
return m_currentWallet;
|
return m_currentWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wallet *WalletManager::createWalletFromKeys(const QString &path, const QString &language, bool testnet,
|
||||||
|
const QString &address, const QString &viewkey, const QString &spendkey,
|
||||||
|
quint64 restoreHeight)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&m_mutex);
|
||||||
|
if (m_currentWallet) {
|
||||||
|
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||||
|
delete m_currentWallet;
|
||||||
|
m_currentWallet = NULL;
|
||||||
|
}
|
||||||
|
Monero::Wallet * w = m_pimpl->createWalletFromKeys(path.toStdString(), language.toStdString(), testnet, restoreHeight,
|
||||||
|
address.toStdString(), viewkey.toStdString(), spendkey.toStdString());
|
||||||
|
m_currentWallet = new Wallet(w);
|
||||||
|
return m_currentWallet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString WalletManager::closeWallet()
|
QString WalletManager::closeWallet()
|
||||||
{
|
{
|
||||||
@ -183,6 +199,16 @@ bool WalletManager::addressValid(const QString &address, bool testnet) const
|
|||||||
return Monero::Wallet::addressValid(address.toStdString(), testnet);
|
return Monero::Wallet::addressValid(address.toStdString(), testnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WalletManager::keyValid(const QString &key, const QString &address, bool isViewKey, bool testnet) const
|
||||||
|
{
|
||||||
|
std::string error;
|
||||||
|
if(!Monero::Wallet::keyValid(key.toStdString(), address.toStdString(), isViewKey, testnet, error)){
|
||||||
|
qDebug() << QString::fromStdString(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QString WalletManager::paymentIdFromAddress(const QString &address, bool testnet) const
|
QString WalletManager::paymentIdFromAddress(const QString &address, bool testnet) const
|
||||||
{
|
{
|
||||||
return QString::fromStdString(Monero::Wallet::paymentIdFromAddress(address.toStdString(), testnet));
|
return QString::fromStdString(Monero::Wallet::paymentIdFromAddress(address.toStdString(), testnet));
|
||||||
|
@ -53,6 +53,14 @@ public:
|
|||||||
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
||||||
bool testnet = false, quint64 restoreHeight = 0);
|
bool testnet = false, quint64 restoreHeight = 0);
|
||||||
|
|
||||||
|
Q_INVOKABLE Wallet * createWalletFromKeys(const QString &path,
|
||||||
|
const QString &language,
|
||||||
|
bool testnet,
|
||||||
|
const QString &address,
|
||||||
|
const QString &viewkey,
|
||||||
|
const QString &spendkey = "",
|
||||||
|
quint64 restoreHeight = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief closeWallet - closes current open wallet and frees memory
|
* \brief closeWallet - closes current open wallet and frees memory
|
||||||
* \return wallet address
|
* \return wallet address
|
||||||
@ -92,6 +100,8 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE bool paymentIdValid(const QString &payment_id) const;
|
Q_INVOKABLE bool paymentIdValid(const QString &payment_id) const;
|
||||||
Q_INVOKABLE bool addressValid(const QString &address, bool testnet) const;
|
Q_INVOKABLE bool addressValid(const QString &address, bool testnet) const;
|
||||||
|
Q_INVOKABLE bool keyValid(const QString &key, const QString &address, bool isViewKey, bool testnet) const;
|
||||||
|
|
||||||
Q_INVOKABLE QString paymentIdFromAddress(const QString &address, bool testnet) const;
|
Q_INVOKABLE QString paymentIdFromAddress(const QString &address, bool testnet) const;
|
||||||
|
|
||||||
Q_INVOKABLE QString checkPayment(const QString &address, const QString &txid, const QString &txkey, const QString &daemon_address) const;
|
Q_INVOKABLE QString checkPayment(const QString &address, const QString &txid, const QString &txkey, const QString &daemon_address) const;
|
||||||
|
@ -80,11 +80,12 @@ Item {
|
|||||||
|
|
||||||
WizardManageWalletUI {
|
WizardManageWalletUI {
|
||||||
id: uiItem
|
id: uiItem
|
||||||
titleText: qsTr("Give your view only wallet a name") + translationManager.emptyString
|
titleText: qsTr("Create view only wallet") + translationManager.emptyString
|
||||||
wordsTextItem.visible: false
|
wordsTextItem.visible: false
|
||||||
restoreHeightVisible:false
|
restoreHeightVisible:false
|
||||||
walletName: appWindow.walletName + "-viewonly"
|
walletName: appWindow.walletName + "-viewonly"
|
||||||
progressDotsModel: dotsModel
|
progressDotsModel: dotsModel
|
||||||
|
recoverMode: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,12 +96,13 @@ Item {
|
|||||||
|
|
||||||
WizardManageWalletUI {
|
WizardManageWalletUI {
|
||||||
id: uiItem
|
id: uiItem
|
||||||
titleText: qsTr("Give your new wallet a name") + translationManager.emptyString
|
titleText: qsTr("Create a new wallet") + translationManager.emptyString
|
||||||
wordsTextTitle: qsTr("Here is your wallet's 25 word mnemonic seed") + translationManager.emptyString
|
wordsTextTitle: qsTr("Here is your wallet's 25 word mnemonic seed") + translationManager.emptyString
|
||||||
wordsTextItem.clipboardButtonVisible: true
|
wordsTextItem.clipboardButtonVisible: true
|
||||||
wordsTextItem.tipTextVisible: true
|
wordsTextItem.tipTextVisible: true
|
||||||
wordsTextItem.memoTextReadOnly: true
|
wordsTextItem.memoTextReadOnly: true
|
||||||
restoreHeightVisible:false
|
restoreHeightVisible:false
|
||||||
|
recoverMode: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -29,10 +29,12 @@
|
|||||||
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 QtQuick.Dialogs 1.2
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
|
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
Rectangle {
|
GridLayout {
|
||||||
|
anchors.fill: parent
|
||||||
id: wizard
|
id: wizard
|
||||||
property alias nextButton : nextButton
|
property alias nextButton : nextButton
|
||||||
property var settings : ({})
|
property var settings : ({})
|
||||||
@ -53,9 +55,9 @@ Rectangle {
|
|||||||
signal wizardRestarted();
|
signal wizardRestarted();
|
||||||
signal useMoneroClicked()
|
signal useMoneroClicked()
|
||||||
signal openWalletFromFileClicked()
|
signal openWalletFromFileClicked()
|
||||||
border.color: "#DBDBDB"
|
// border.color: "#DBDBDB"
|
||||||
border.width: 1
|
// border.width: 1
|
||||||
color: "#FFFFFF"
|
// color: "#FFFFFF"
|
||||||
|
|
||||||
function restart(){
|
function restart(){
|
||||||
wizard.currentPage = 0;
|
wizard.currentPage = 0;
|
||||||
|
@ -29,12 +29,16 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import moneroComponents.TranslationManager 1.0
|
import moneroComponents.TranslationManager 1.0
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.2
|
||||||
import "../components"
|
import "../components"
|
||||||
|
import 'utils.js' as Utils
|
||||||
|
|
||||||
// Reusable component for managing wallet (account name, path, private key)
|
// Reusable component for managing wallet (account name, path, private key)
|
||||||
|
|
||||||
Item {
|
ColumnLayout {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
property alias titleText: titleText.text
|
property alias titleText: titleText.text
|
||||||
property alias accountNameText: accountName.text
|
property alias accountNameText: accountName.text
|
||||||
@ -45,15 +49,49 @@ Item {
|
|||||||
property alias restoreHeightVisible: restoreHeightItem.visible
|
property alias restoreHeightVisible: restoreHeightItem.visible
|
||||||
property alias walletName : accountName.text
|
property alias walletName : accountName.text
|
||||||
property alias progressDotsModel : progressDots.model
|
property alias progressDotsModel : progressDots.model
|
||||||
|
property alias recoverFromKeysAddress: addressLine.text;
|
||||||
|
property alias recoverFromKeysViewKey: viewKeyLine.text;
|
||||||
|
property alias recoverFromKeysSpendKey: spendKeyLine.text;
|
||||||
|
// recover mode or create new wallet
|
||||||
|
property bool recoverMode: false
|
||||||
|
// Recover form seed or keys
|
||||||
|
property bool recoverFromSeedMode: true
|
||||||
|
|
||||||
// TODO extend properties if needed
|
function checkFields(){
|
||||||
|
var addressOK = walletManager.addressValid(addressLine.text, wizard.settings.testnet)
|
||||||
|
var viewKeyOK = walletManager.keyValid(viewKeyLine.text, addressLine.text, true, wizard.settings.testnet)
|
||||||
|
// Spendkey is optional
|
||||||
|
var spendKeyOK = (spendKeyLine.text.length > 0)? walletManager.keyValid(spendKeyLine.text, addressLine.text, false, wizard.settings.testnet) : true
|
||||||
|
|
||||||
anchors.fill: parent
|
addressLine.error = !addressOK && addressLine.text.length != 0
|
||||||
Row {
|
viewKeyLine.error = !viewKeyOK && viewKeyLine.text.length != 0
|
||||||
|
spendKeyLine.error = !spendKeyOK && spendKeyLine.text.length != 0
|
||||||
|
|
||||||
|
return addressOK && viewKeyOK && spendKeyOK
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkNextButton(){
|
||||||
|
wizard.nextButton.enabled = false
|
||||||
|
console.log("check next", recoverFromSeed.visible)
|
||||||
|
if(recoverMode && !recoverFromSeedMode) {
|
||||||
|
console.log("checking key fields")
|
||||||
|
wizard.nextButton.enabled = checkFields();
|
||||||
|
} else if (recoverMode && recoverFromSeedMode) {
|
||||||
|
wizard.nextButton.enabled = checkSeed()
|
||||||
|
} else
|
||||||
|
wizard.nextButton.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkSeed() {
|
||||||
|
console.log("Checking seed")
|
||||||
|
var wordsArray = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText).split(" ");
|
||||||
|
return wordsArray.length === 25
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
id: dotsRow
|
id: dotsRow
|
||||||
anchors.top: parent.top
|
Layout.topMargin: 85
|
||||||
anchors.right: parent.right
|
Layout.alignment: Qt.AlignRight
|
||||||
anchors.topMargin: 85
|
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
@ -75,134 +113,161 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
RowLayout {
|
||||||
id: headerColumn
|
id: headerColumn
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.leftMargin: 16
|
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: 74
|
|
||||||
spacing: 24
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
id: titleText
|
id: titleText
|
||||||
anchors.left: parent.left
|
|
||||||
width: headerColumn.width - dotsRow.width - 16
|
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 28
|
font.pixelSize: 28
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
//renderType: Text.NativeRendering
|
|
||||||
color: "#3F3F3F"
|
color: "#3F3F3F"
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
font.family: "Arial"
|
|
||||||
font.pixelSize: 18
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
//renderType: Text.NativeRendering
|
|
||||||
color: "#4A4646"
|
|
||||||
text: qsTr("or use the name suggested below:") + translationManager.emptyString
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
ColumnLayout {
|
||||||
id: walletNameItem
|
|
||||||
anchors.top: headerColumn.bottom
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.topMargin: 24
|
|
||||||
width: 300
|
|
||||||
height: 62
|
|
||||||
|
|
||||||
TextInput {
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
fontSize: 14
|
||||||
|
text: qsTr("Wallet name")
|
||||||
|
+ translationManager.emptyString
|
||||||
|
}
|
||||||
|
|
||||||
|
LineEdit {
|
||||||
id: accountName
|
id: accountName
|
||||||
anchors.fill: parent
|
Layout.fillWidth: true
|
||||||
horizontalAlignment: TextInput.AlignHCenter
|
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
|
||||||
font.family: "Arial"
|
|
||||||
font.pixelSize: 32
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
color: "#FF6C3C"
|
|
||||||
focus: true
|
|
||||||
text: defaultAccountName
|
text: defaultAccountName
|
||||||
selectByMouse: true
|
onTextUpdated: checkNextButton()
|
||||||
|
|
||||||
Keys.onReleased: {
|
|
||||||
wizard.nextButton.enabled = (accountName.length > 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
height: 1
|
|
||||||
color: "#DBDBDB"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout{
|
||||||
|
visible: recoverMode
|
||||||
|
StandardButton {
|
||||||
|
id: recoverFromSeedButton
|
||||||
|
text: qsTr("Restore from seed") + translationManager.emptyString
|
||||||
|
shadowReleasedColor: "#FF4304"
|
||||||
|
shadowPressedColor: "#B32D00"
|
||||||
|
releasedColor: "#FF6C3C"
|
||||||
|
pressedColor: "#FF4304"
|
||||||
|
enabled: recoverFromKeys.visible
|
||||||
|
onClicked: {
|
||||||
|
recoverFromSeedMode = true;
|
||||||
|
checkNextButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StandardButton {
|
||||||
|
id: recoverFromKeysButton
|
||||||
|
text: qsTr("Restore from keys") + translationManager.emptyString
|
||||||
|
shadowReleasedColor: "#FF4304"
|
||||||
|
shadowPressedColor: "#B32D00"
|
||||||
|
releasedColor: "#FF6C3C"
|
||||||
|
pressedColor: "#FF4304"
|
||||||
|
enabled: recoverFromSeed.visible
|
||||||
|
onClicked: {
|
||||||
|
recoverFromSeedMode = false;
|
||||||
|
checkNextButton();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover from seed
|
||||||
|
RowLayout {
|
||||||
|
id: recoverFromSeed
|
||||||
|
visible: !recoverMode || ( recoverMode && recoverFromSeedMode)
|
||||||
|
WizardMemoTextInput {
|
||||||
|
id : memoTextItem
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredWidth: 600
|
||||||
|
Layout.minimumWidth: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recover from keys
|
||||||
|
GridLayout {
|
||||||
|
id: recoverFromKeys
|
||||||
|
visible: recoverMode && !recoverFromSeedMode
|
||||||
|
columns: 1
|
||||||
|
LineEdit {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
id: addressLine
|
||||||
|
placeholderText: qsTr("Account address (public)")
|
||||||
|
onTextUpdated: checkNextButton()
|
||||||
|
}
|
||||||
|
LineEdit {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
id: viewKeyLine
|
||||||
|
placeholderText: qsTr("View key (private)")
|
||||||
|
onTextUpdated: checkNextButton()
|
||||||
|
|
||||||
|
}
|
||||||
|
LineEdit {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
id: spendKeyLine
|
||||||
|
placeholderText: qsTr("Spend key (private)")
|
||||||
|
onTextUpdated: checkNextButton()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
Text {
|
Text {
|
||||||
|
visible: false
|
||||||
|
Layout.fillWidth: true
|
||||||
id: frameHeader
|
id: frameHeader
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.leftMargin: 16
|
|
||||||
anchors.rightMargin: 16
|
|
||||||
anchors.top: walletNameItem.bottom
|
|
||||||
anchors.topMargin: 24
|
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 24
|
font.pixelSize: 24
|
||||||
font.bold: true
|
font.bold: true
|
||||||
//renderType: Text.NativeRendering
|
wrapMode: Text.Wrap
|
||||||
color: "#4A4646"
|
color: "#4A4646"
|
||||||
elide: Text.ElideRight
|
}
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WizardMemoTextInput {
|
|
||||||
id : memoTextItem
|
|
||||||
width: parent.width
|
|
||||||
anchors.top : frameHeader.bottom
|
|
||||||
anchors.topMargin: 16
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
// Restore Height
|
// Restore Height
|
||||||
LineEdit {
|
LineEdit {
|
||||||
id: restoreHeightItem
|
id: restoreHeightItem
|
||||||
anchors.top: memoTextItem.bottom
|
Layout.preferredWidth: 250
|
||||||
width: 250
|
|
||||||
anchors.topMargin: 20
|
|
||||||
placeholderText: qsTr("Restore height (optional)")
|
placeholderText: qsTr("Restore height (optional)")
|
||||||
Layout.alignment: Qt.AlignCenter
|
|
||||||
validator: IntValidator {
|
validator: IntValidator {
|
||||||
bottom:0
|
bottom:0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: (restoreHeightItem.visible)? restoreHeightItem.bottom : (memoTextItem.visible)? memoTextItem.bottom : frameHeader.bottom
|
|
||||||
anchors.topMargin: 24
|
|
||||||
spacing: 16
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
font.family: "Arial"
|
|
||||||
font.pixelSize: 18
|
|
||||||
//renderType: Text.NativeRendering
|
|
||||||
color: "#4A4646"
|
|
||||||
text: qsTr("Your wallet is stored in") + translationManager.emptyString
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
ColumnLayout {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: parent.width - x
|
Label {
|
||||||
height: 34
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 20
|
||||||
|
fontSize: 14
|
||||||
|
text: qsTr("Your wallet is stored in") + translationManager.emptyString
|
||||||
|
+ translationManager.emptyString
|
||||||
|
}
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
id: fileUrlInput
|
||||||
|
clip: true
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 18
|
||||||
|
color: "#6B0072"
|
||||||
|
selectByMouse: true
|
||||||
|
text: moneroAccountsDir + "/"
|
||||||
|
// workaround for the bug "filechooser only opens once"
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
mouse.accepted = false
|
||||||
|
fileDialog.folder = walletManager.localPathToUrl(fileUrlInput.text)
|
||||||
|
fileDialog.open()
|
||||||
|
fileUrlInput.focus = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
@ -217,40 +282,6 @@ Item {
|
|||||||
fileDialog.visible = false
|
fileDialog.visible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextInput {
|
|
||||||
id: fileUrlInput
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: 5
|
|
||||||
anchors.rightMargin: 5
|
|
||||||
clip: true
|
|
||||||
font.family: "Arial"
|
|
||||||
font.pixelSize: 18
|
|
||||||
color: "#6B0072"
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
selectByMouse: true
|
|
||||||
|
|
||||||
text: moneroAccountsDir + "/"
|
|
||||||
// workaround for the bug "filechooser only opens once"
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: {
|
|
||||||
mouse.accepted = false
|
|
||||||
fileDialog.folder = walletManager.localPathToUrl(fileUrlInput.text)
|
|
||||||
fileDialog.open()
|
|
||||||
fileUrlInput.focus = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
height: 1
|
|
||||||
color: "#DBDBDB"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,27 @@ Column {
|
|||||||
|
|
||||||
TextEdit {
|
TextEdit {
|
||||||
id: memoTextInput
|
id: memoTextInput
|
||||||
|
property alias placeholderText: memoTextPlaceholder.text
|
||||||
textMargin: 8
|
textMargin: 8
|
||||||
text: ""
|
text: ""
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pointSize: 16
|
font.pixelSize: 16
|
||||||
wrapMode: TextInput.Wrap
|
wrapMode: TextInput.Wrap
|
||||||
width: parent.width
|
width: parent.width
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
property int minimumHeight: 100
|
property int minimumHeight: 100
|
||||||
height: contentHeight > minimumHeight ? contentHeight : minimumHeight
|
height: contentHeight > minimumHeight ? contentHeight : minimumHeight
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: memoTextPlaceholder
|
||||||
|
anchors.fill:parent
|
||||||
|
font.pixelSize: 16
|
||||||
|
anchors.margins: 8
|
||||||
|
font.bold:true
|
||||||
|
text: qsTr("Enter your 25 word mnemonic seed")
|
||||||
|
color: "#BABABA"
|
||||||
|
visible: !memoTextInput.text/* && !parent.focus*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Image {
|
Image {
|
||||||
id : clipboardButton
|
id : clipboardButton
|
||||||
|
@ -185,7 +185,7 @@ Item {
|
|||||||
font.pixelSize: 16
|
font.pixelSize: 16
|
||||||
color: "#4A4949"
|
color: "#4A4949"
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: qsTr("Restore wallet from 25 word mnemonic seed") + translationManager.emptyString
|
text: qsTr("Restore wallet from keys or mnemonic seed") + translationManager.emptyString
|
||||||
width:page.buttonSize
|
width:page.buttonSize
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
@ -49,39 +49,52 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onPageOpened(settingsObject) {
|
function onPageOpened(settingsObject) {
|
||||||
checkNextButton();
|
console.log("on page opened")
|
||||||
}
|
uiItem.checkNextButton();
|
||||||
|
|
||||||
function checkNextButton() {
|
|
||||||
var wordsArray = Utils.lineBreaksToSpaces(uiItem.wordsTextItem.memoText).split(" ");
|
|
||||||
wizard.nextButton.enabled = wordsArray.length === 25;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPageClosed(settingsObject) {
|
function onPageClosed(settingsObject) {
|
||||||
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['recover_address'] = uiItem.recoverFromKeysAddress
|
||||||
|
settingsObject['recover_viewkey'] = uiItem.recoverFromKeysViewKey
|
||||||
|
settingsObject['recover_spendkey'] = uiItem.recoverFromKeysSpendKey
|
||||||
|
|
||||||
|
|
||||||
var restoreHeight = parseInt(uiItem.restoreHeight);
|
var restoreHeight = parseInt(uiItem.restoreHeight);
|
||||||
settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight
|
settingsObject['restore_height'] = isNaN(restoreHeight)? 0 : restoreHeight
|
||||||
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
var walletFullPath = wizard.createWalletPath(uiItem.walletPath,uiItem.accountNameText);
|
||||||
if(!wizard.walletPathValid(walletFullPath)){
|
if(!wizard.walletPathValid(walletFullPath)){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return recoveryWallet(settingsObject)
|
return recoveryWallet(settingsObject, uiItem.recoverFromSeedMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
function recoveryWallet(settingsObject) {
|
function recoveryWallet(settingsObject, fromSeed) {
|
||||||
var testnet = appWindow.persistentSettings.testnet;
|
var testnet = appWindow.persistentSettings.testnet;
|
||||||
var restoreHeight = settingsObject.restore_height;
|
var restoreHeight = settingsObject.restore_height;
|
||||||
var tmp_wallet_filename = oshelper.temporaryFilename()
|
var tmp_wallet_filename = oshelper.temporaryFilename()
|
||||||
console.log("Creating temporary wallet", tmp_wallet_filename)
|
console.log("Creating temporary wallet", tmp_wallet_filename)
|
||||||
var wallet = walletManager.recoveryWallet(tmp_wallet_filename, settingsObject.words, testnet, restoreHeight);
|
|
||||||
|
// From seed or keys
|
||||||
|
if(fromSeed)
|
||||||
|
var wallet = walletManager.recoveryWallet(tmp_wallet_filename, settingsObject.words, testnet, restoreHeight)
|
||||||
|
else
|
||||||
|
var wallet = walletManager.createWalletFromKeys(tmp_wallet_filename, settingsObject.language, testnet,
|
||||||
|
settingsObject.recover_address, settingsObject.recover_viewkey,
|
||||||
|
settingsObject.recover_spendkey, restoreHeight)
|
||||||
|
|
||||||
|
|
||||||
var success = wallet.status === Wallet.Status_Ok;
|
var success = wallet.status === Wallet.Status_Ok;
|
||||||
if (success) {
|
if (success) {
|
||||||
settingsObject['wallet'] = wallet;
|
settingsObject['wallet'] = wallet;
|
||||||
settingsObject['is_recovering'] = true;
|
settingsObject['is_recovering'] = true;
|
||||||
settingsObject['tmp_wallet_filename'] = tmp_wallet_filename
|
settingsObject['tmp_wallet_filename'] = tmp_wallet_filename
|
||||||
} else {
|
} else {
|
||||||
|
console.log(wallet.errorString)
|
||||||
|
walletErrorDialog.text = wallet.errorString;
|
||||||
|
walletErrorDialog.open();
|
||||||
walletManager.closeWallet();
|
walletManager.closeWallet();
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
@ -92,13 +105,15 @@ Item {
|
|||||||
WizardManageWalletUI {
|
WizardManageWalletUI {
|
||||||
id: uiItem
|
id: uiItem
|
||||||
accountNameText: defaultAccountName
|
accountNameText: defaultAccountName
|
||||||
titleText: qsTr("Give your restored wallet a name") + translationManager.emptyString
|
titleText: qsTr("Restore wallet") + translationManager.emptyString
|
||||||
wordsTextTitle: qsTr("Enter your 25 word mnemonic seed:") + translationManager.emptyString
|
wordsTextTitle: qsTr("Enter your 25 word mnemonic seed:") + translationManager.emptyString
|
||||||
wordsTextItem.clipboardButtonVisible: false
|
wordsTextItem.clipboardButtonVisible: false
|
||||||
wordsTextItem.tipTextVisible: false
|
wordsTextItem.tipTextVisible: false
|
||||||
wordsTextItem.memoTextReadOnly: false
|
wordsTextItem.memoTextReadOnly: false
|
||||||
wordsTextItem.memoText: ""
|
wordsTextItem.memoText: ""
|
||||||
|
wordsTextItem.visible: true
|
||||||
restoreHeightVisible: true
|
restoreHeightVisible: true
|
||||||
|
recoverMode: true
|
||||||
wordsTextItem.onMemoTextChanged: {
|
wordsTextItem.onMemoTextChanged: {
|
||||||
checkNextButton();
|
checkNextButton();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user