m_wizard = this->createWizard(startPage);
}
+ m_wizard->resetFields();
m_wizard->setStartId(startPage);
m_wizard->restart();
m_wizard->setEnabled(true);
this->time = seed.birthday();
this->setRestoreHeight();
+
+ this->encrypted = seed.encrypted();
}
catch (const std::exception &e) {
this->errorString = e.what();
QString errorString;
+ bool encrypted = false;
+
explicit Seed();
explicit Seed(Type type, NetworkType::Type networkType = NetworkType::MAINNET, QString language = "English");
explicit Seed(Type type, QStringList mnemonic, NetworkType::Type networkType = NetworkType::MAINNET);
--- /dev/null
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2020-2022 The Monero Project
+
+#include "PageSetSeedPassphrase.h"
+#include "ui_PageSetSeedPassphrase.h"
+#include "WalletWizard.h"
+
+PageSetSeedPassphrase::PageSetSeedPassphrase(WizardFields *fields, QWidget *parent)
+ : QWizardPage(parent)
+ , ui(new Ui::PageSetSeedPassphrase)
+ , m_fields(fields)
+{
+ ui->setupUi(this);
+
+ this->setTitle("Seed Passphrase");
+}
+
+void PageSetSeedPassphrase::initializePage() {
+ ui->linePassphrase->setText("");
+}
+
+bool PageSetSeedPassphrase::validatePage() {
+ m_fields->seedOffsetPassphrase = ui->linePassphrase->text();
+ return true;
+}
+
+int PageSetSeedPassphrase::nextId() const {
+ return WalletWizard::Page_WalletFile;
+}
\ No newline at end of file
--- /dev/null
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2020-2022 The Monero Project
+
+#ifndef FEATHER_PAGESETSEEDPASSPHRASE_H
+#define FEATHER_PAGESETSEEDPASSPHRASE_H
+
+#include <QWizardPage>
+#include <QWidget>
+
+#include "appcontext.h"
+#include "WalletWizard.h"
+
+namespace Ui {
+ class PageSetSeedPassphrase;
+}
+
+class PageSetSeedPassphrase : public QWizardPage
+{
+Q_OBJECT
+
+public:
+ explicit PageSetSeedPassphrase(WizardFields *fields, QWidget *parent = nullptr);
+ void initializePage() override;
+ bool validatePage() override;
+ int nextId() const override;
+
+private:
+ Ui::PageSetSeedPassphrase *ui;
+
+ WizardFields *m_fields;
+};
+
+
+#endif //FEATHER_PAGESETSEEDPASSPHRASE_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PageSetSeedPassphrase</class>
+ <widget class="QWizardPage" name="PageSetSeedPassphrase">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>710</width>
+ <height>524</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>WizardPage</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>You may extend your seed with a passphrase.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>This is referred to as the "seed offset passphrase", or simply seed passphrase.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Your seed and seed passphrase are both required to restore your wallet.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="linePassphrase"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Note that this is NOT your wallet password.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>If you do not know what this is, leave this field empty.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
this->onSeedTypeToggled();
}
+
void PageWalletRestoreSeed::onSeedTypeToggled() {
if (ui->radio16->isChecked()) {
m_mode = &m_polyseed;
Seed _seed = Seed(m_fields->seedType, seedSplit, constants::networkType);
+ if (_seed.encrypted) {
+ QMessageBox::warning(this, "Encrypted seed", QString("This seed is encrypted. Encrypted seeds are not supported"));
+ return false;
+ }
+
if (!_seed.errorString.isEmpty()) {
QMessageBox::warning(this, "Invalid seed", QString("Invalid seed:\n\n%1").arg(_seed.errorString));
ui->seedEdit->setStyleSheet(errStyle);
#include "Seed.h"
#include <QMessageBox>
+#include <QLineEdit>
+#include <QCheckBox>
+#include <QDialogButtonBox>
PageWalletSeed::PageWalletSeed(WizardFields *fields, QWidget *parent)
: QWizardPage(parent)
connect(ui->btnCopy, &QPushButton::clicked, [this]{
Utils::copyToClipboard(m_seed.mnemonic.join(" "));
});
+ connect(ui->btnOptions, &QPushButton::clicked, this, &PageWalletSeed::onOptionsClicked);
}
void PageWalletSeed::initializePage() {
ui->seedWord16->setText(seedSplit[15]);
}
+void PageWalletSeed::onOptionsClicked() {
+ QDialog dialog(this);
+ QVBoxLayout layout;
+ QCheckBox checkbox("Extend this seed with a passphrase");
+ checkbox.setChecked(m_fields->seedOffsetPassphraseEnabled);
+ layout.addWidget(&checkbox);
+ QDialogButtonBox buttons(QDialogButtonBox::Ok);
+ layout.addWidget(&buttons);
+ dialog.setLayout(&layout);
+ connect(&buttons, &QDialogButtonBox::accepted, [&dialog]{
+ dialog.close();
+ });
+ dialog.exec();
+ m_fields->seedOffsetPassphraseEnabled = checkbox.isChecked();
+}
+
int PageWalletSeed::nextId() const {
+ if (m_fields->seedOffsetPassphraseEnabled) {
+ return WalletWizard::Page_SetSeedPassphrase;
+ }
return WalletWizard::Page_WalletFile;
}
private:
void seedRoulette(int count);
void generateSeed();
+ void onOptionsClicked();
signals:
void createWallet();
<rect>
<x>0</x>
<y>0</y>
- <width>654</width>
- <height>594</height>
+ <width>777</width>
+ <height>658</height>
</rect>
</property>
<property name="windowTitle">
</property>
</widget>
</item>
- <item>
- <widget class="QLabel" name="label_16">
- <property name="text">
- <string>Please take note that mnemonic seeds now consist of 16 words instead of 14.</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
</layout>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_21"/>
+ </item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="btnOptions">
+ <property name="text">
+ <string>Options</string>
+ </property>
+ </widget>
+ </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
#include "PageWalletRestoreKeys.h"
#include "PageSetPassword.h"
#include "PageSetRestoreHeight.h"
+#include "PageSetSeedPassphrase.h"
#include "PageHardwareDevice.h"
#include "PageNetworkTor.h"
#include "constants.h"
auto createWallet = new PageWalletFile(&m_wizardFields , this);
auto createWalletSeed = new PageWalletSeed(&m_wizardFields, this);
auto walletSetPasswordPage = new PageSetPassword(&m_wizardFields, this);
+ auto walletSetSeedPassphrasePage = new PageSetSeedPassphrase(&m_wizardFields, this);
setPage(Page_Menu, menuPage);
setPage(Page_WalletFile, createWallet);
setPage(Page_OpenWallet, openWalletPage);
setPage(Page_WalletRestoreKeys, new PageWalletRestoreKeys(&m_wizardFields, this));
setPage(Page_SetRestoreHeight, new PageSetRestoreHeight(&m_wizardFields, this));
setPage(Page_HardwareDevice, new PageHardwareDevice(&m_wizardFields, this));
+ setPage(Page_SetSeedPassphrase, walletSetSeedPassphrasePage);
setStartId(Page_Menu);
});
}
+void WalletWizard::resetFields() {
+ m_wizardFields = {};
+}
+
void WalletWizard::onCreateWallet() {
auto walletPath = QString("%1/%2").arg(m_wizardFields.walletDir, m_wizardFields.walletName);
}
emit createWallet(m_wizardFields.seed, walletPath, m_wizardFields.password, m_wizardFields.seedLanguage, m_wizardFields.seedOffsetPassphrase);
-}
+}
\ No newline at end of file
QString walletName;
QString walletDir;
Seed seed;
+ bool seedOffsetPassphraseEnabled = false;
QString seedOffsetPassphrase;
QString seedLanguage = constants::seedLanguage;
QString password;
int restoreHeight = 0;
Seed::Type seedType;
DeviceType deviceType;
+
+ WizardFields(): deviceType(DeviceType::LEDGER), mode(WizardMode::CreateWallet),
+ seedType(Seed::POLYSEED), seedOffsetPassphraseEnabled(false), restoreHeight(0) {}
};
class WalletWizard : public QWizard
Page_Menu,
Page_WalletFile,
Page_CreateWalletSeed,
+ Page_SetSeedPassphrase,
Page_SetPasswordPage,
Page_OpenWallet,
Page_Network,
};
explicit WalletWizard(QWidget *parent = nullptr);
+ void resetFields();
signals:
void initialNetworkConfigured();