mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-17 09:47:36 +00:00
wizard: restore: add option to hide seed
This commit is contained in:
parent
41e610c532
commit
4e99b53e87
2 changed files with 53 additions and 1 deletions
|
@ -65,6 +65,17 @@ PageWalletRestoreSeed::PageWalletRestoreSeed(WizardFields *fields, QWidget *pare
|
|||
dialog.exec();
|
||||
});
|
||||
|
||||
ui->seedObscured->hide();
|
||||
connect(ui->check_obscureSeed, &QPushButton::clicked, [this](bool checked){
|
||||
ui->seedEdit->setVisible(!checked);
|
||||
ui->seedObscured->setVisible(checked);
|
||||
if (checked) {
|
||||
ui->seedObscured->setText(ui->seedEdit->toPlainText());
|
||||
} else {
|
||||
ui->seedEdit->setText(ui->seedObscured->text());
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->seedBtnGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), this, &PageWalletRestoreSeed::onSeedTypeToggled);
|
||||
connect(ui->combo_seedLanguage, &QComboBox::currentTextChanged, this, &PageWalletRestoreSeed::onSeedLanguageChanged);
|
||||
connect(ui->btnOptions, &QPushButton::clicked, this, &PageWalletRestoreSeed::onOptionsClicked);
|
||||
|
@ -119,6 +130,7 @@ int PageWalletRestoreSeed::nextId() const {
|
|||
|
||||
void PageWalletRestoreSeed::initializePage() {
|
||||
this->setTitle(m_fields->modeText);
|
||||
ui->seedObscured->setText("");
|
||||
ui->seedEdit->setText("");
|
||||
ui->seedEdit->setStyleSheet("");
|
||||
ui->label_errorString->hide();
|
||||
|
@ -130,8 +142,17 @@ bool PageWalletRestoreSeed::validatePage() {
|
|||
ui->label_errorString->hide();
|
||||
ui->seedEdit->setStyleSheet("");
|
||||
|
||||
QString seed = [this]{
|
||||
if (ui->check_obscureSeed->isChecked()) {
|
||||
return ui->seedObscured->text();
|
||||
} else {
|
||||
return ui->seedEdit->toPlainText();
|
||||
}
|
||||
}();
|
||||
|
||||
seed = seed.replace("\n", " ").replace("\r", "").trimmed();
|
||||
|
||||
auto errStyle = "QTextEdit{border: 1px solid red;}";
|
||||
auto seed = ui->seedEdit->toPlainText().replace("\n", " ").replace("\r", "").trimmed();
|
||||
QStringList seedSplit = seed.split(" ", Qt::SkipEmptyParts);
|
||||
|
||||
if (seedSplit.length() != m_mode->length) {
|
||||
|
|
|
@ -78,6 +78,37 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="seedObscured">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="check_obscureSeed">
|
||||
<property name="text">
|
||||
<string>Hide seed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in a new issue