diff --git a/src/wizard/PageSetRestoreHeight.cpp b/src/wizard/PageSetRestoreHeight.cpp index db399d2..5ec276f 100644 --- a/src/wizard/PageSetRestoreHeight.cpp +++ b/src/wizard/PageSetRestoreHeight.cpp @@ -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() { diff --git a/src/wizard/PageWalletRestoreSeed.cpp b/src/wizard/PageWalletRestoreSeed.cpp index 5ff08bf..9c123d3 100644 --- a/src/wizard/PageWalletRestoreSeed.cpp +++ b/src/wizard/PageWalletRestoreSeed.cpp @@ -57,8 +57,6 @@ PageWalletRestoreSeed::PageWalletRestoreSeed(WizardFields *fields, QWidget *pare connect(ui->seedBtnGroup, QOverload::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; } diff --git a/src/wizard/PageWalletRestoreSeed.ui b/src/wizard/PageWalletRestoreSeed.ui index 2c9b226..3a82f7f 100644 --- a/src/wizard/PageWalletRestoreSeed.ui +++ b/src/wizard/PageWalletRestoreSeed.ui @@ -111,6 +111,13 @@ + + + + Override embedded wallet creation date + + + diff --git a/src/wizard/WalletWizard.cpp b/src/wizard/WalletWizard.cpp index 1c9dd0f..250437c 100644 --- a/src/wizard/WalletWizard.cpp +++ b/src/wizard/WalletWizard.cpp @@ -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); } diff --git a/src/wizard/WalletWizard.h b/src/wizard/WalletWizard.h index e730053..5a88f08 100644 --- a/src/wizard/WalletWizard.h +++ b/src/wizard/WalletWizard.h @@ -32,6 +32,7 @@ struct WizardFields { QString walletDir; Seed seed; bool seedOffsetPassphraseEnabled = false; + bool seedCreationDateOverridden = false; QString seedOffsetPassphrase; QString seedLanguage = constants::seedLanguage; QString password;