mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-03 17:39:49 +00:00
wizard: added option to override embedded wallet creation date for 14/16-word seeds
This commit is contained in:
parent
b0cc17564d
commit
bace4fd0a8
5 changed files with 24 additions and 4 deletions
|
@ -45,6 +45,12 @@ void PageSetRestoreHeight::initializePage() {
|
|||
ui->line_restoreHeight->setText("");
|
||||
ui->frame_scanWarning->hide();
|
||||
ui->frame_walletAgeWarning->hide();
|
||||
|
||||
if (m_fields->seedCreationDateOverridden) {
|
||||
auto creationDate = QDateTime::fromSecsSinceEpoch(m_fields->seed.time);
|
||||
ui->line_creationDate->setText(creationDate.toString("yyyy-MM-dd"));
|
||||
this->onCreationDateEdited();
|
||||
}
|
||||
}
|
||||
|
||||
void PageSetRestoreHeight::onCreationDateEdited() {
|
||||
|
|
|
@ -57,8 +57,6 @@ PageWalletRestoreSeed::PageWalletRestoreSeed(WizardFields *fields, QWidget *pare
|
|||
|
||||
connect(ui->seedBtnGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked), this, &PageWalletRestoreSeed::onSeedTypeToggled);
|
||||
connect(ui->combo_seedLanguage, &QComboBox::currentTextChanged, this, &PageWalletRestoreSeed::onSeedLanguageChanged);
|
||||
|
||||
this->onSeedTypeToggled();
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,18 +66,21 @@ void PageWalletRestoreSeed::onSeedTypeToggled() {
|
|||
m_fields->seedType = Seed::Type::POLYSEED;
|
||||
ui->seedEdit->setPlaceholderText("Enter 16 word seed..");
|
||||
ui->group_seedLanguage->hide();
|
||||
ui->check_overrideCreationDate->setVisible(true);
|
||||
}
|
||||
if (ui->radio14->isChecked()) {
|
||||
m_mode = &m_tevador;
|
||||
m_fields->seedType = Seed::Type::TEVADOR;
|
||||
ui->seedEdit->setPlaceholderText("Enter 14 word seed..");
|
||||
ui->group_seedLanguage->hide();
|
||||
ui->check_overrideCreationDate->setVisible(true);
|
||||
}
|
||||
else if (ui->radio25->isChecked()) {
|
||||
m_mode = &m_legacy;
|
||||
m_fields->seedType = Seed::Type::MONERO;
|
||||
ui->seedEdit->setPlaceholderText("Enter 25 word seed..");
|
||||
ui->group_seedLanguage->show();
|
||||
ui->check_overrideCreationDate->setVisible(false);
|
||||
}
|
||||
|
||||
ui->label_errorString->hide();
|
||||
|
@ -94,7 +95,7 @@ void PageWalletRestoreSeed::onSeedLanguageChanged(const QString &language) {
|
|||
}
|
||||
|
||||
int PageWalletRestoreSeed::nextId() const {
|
||||
if (m_mode == &m_legacy) {
|
||||
if (m_mode == &m_legacy || ui->check_overrideCreationDate->isChecked()) {
|
||||
return WalletWizard::Page_SetRestoreHeight;
|
||||
}
|
||||
|
||||
|
@ -107,6 +108,10 @@ void PageWalletRestoreSeed::initializePage() {
|
|||
ui->seedEdit->setStyleSheet("");
|
||||
ui->label_errorString->hide();
|
||||
ui->line_seedOffset->setText("");
|
||||
ui->check_overrideCreationDate->setVisible(false);
|
||||
ui->check_overrideCreationDate->setChecked(false);
|
||||
ui->radio16->isChecked();
|
||||
this->onSeedTypeToggled();
|
||||
}
|
||||
|
||||
bool PageWalletRestoreSeed::validatePage() {
|
||||
|
@ -157,6 +162,7 @@ bool PageWalletRestoreSeed::validatePage() {
|
|||
|
||||
m_fields->seed = _seed;
|
||||
m_fields->seedOffsetPassphrase = ui->line_seedOffset->text();
|
||||
m_fields->seedCreationDateOverridden = ui->check_overrideCreationDate->isChecked();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -111,6 +111,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="check_overrideCreationDate">
|
||||
<property name="text">
|
||||
<string>Override embedded wallet creation date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_errorString">
|
||||
<property name="text">
|
||||
|
|
|
@ -132,7 +132,7 @@ void WalletWizard::onCreateWallet() {
|
|||
m_wizardFields.seed.restoreHeight = currentBlockHeight;
|
||||
}
|
||||
|
||||
if (m_wizardFields.mode == WizardMode::RestoreFromSeed && m_wizardFields.seedType == Seed::Type::MONERO) {
|
||||
if (m_wizardFields.mode == WizardMode::RestoreFromSeed && (m_wizardFields.seedType == Seed::Type::MONERO || m_wizardFields.seedCreationDateOverridden)) {
|
||||
m_wizardFields.seed.setRestoreHeight(m_wizardFields.restoreHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ struct WizardFields {
|
|||
QString walletDir;
|
||||
Seed seed;
|
||||
bool seedOffsetPassphraseEnabled = false;
|
||||
bool seedCreationDateOverridden = false;
|
||||
QString seedOffsetPassphrase;
|
||||
QString seedLanguage = constants::seedLanguage;
|
||||
QString password;
|
||||
|
|
Loading…
Reference in a new issue