From: tobtoht Date: Thu, 23 Jun 2022 10:53:52 +0000 (+0200) Subject: Menu: remove 'Change restore height' X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=08acac91f6387b36168fc0bab514c9dc00e4686f;p=gamesguru%2Ffeather.git Menu: remove 'Change restore height' Restoring the wallet from seed is the preferred UX here. Missing transactions should be imported using Tools -> Import transaction. --- diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ff8fbfc9..a477f388 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -253,7 +253,6 @@ void MainWindow::initMenu() { connect(ui->actionRefresh_tabs, &QAction::triggered, [this]{m_ctx->refreshModels();}); connect(ui->actionRescan_spent, &QAction::triggered, this, &MainWindow::rescanSpent); connect(ui->actionWallet_cache_debug, &QAction::triggered, this, &MainWindow::showWalletCacheDebugDialog); - connect(ui->actionChange_restore_height, &QAction::triggered, this, &MainWindow::showRestoreHeightDialog); // [Wallet] -> [Advanced] -> [Export] connect(ui->actionExportOutputs, &QAction::triggered, this, &MainWindow::exportOutputs); @@ -394,7 +393,6 @@ void MainWindow::initWalletContext() { connect(m_ctx.get(), &AppContext::deviceButtonPressed, this, &MainWindow::onDeviceButtonPressed); connect(m_ctx.get(), &AppContext::initiateTransaction, this, &MainWindow::onInitiateTransaction); connect(m_ctx.get(), &AppContext::endTransaction, this, &MainWindow::onEndTransaction); - connect(m_ctx.get(), &AppContext::customRestoreHeightSet, this, &MainWindow::onCustomRestoreHeightSet); connect(m_ctx.get(), &AppContext::keysCorrupted, this, &MainWindow::onKeysCorrupted); connect(m_ctx.get(), &AppContext::selectedInputsChanged, this, &MainWindow::onSelectedInputsChanged); @@ -787,22 +785,6 @@ void MainWindow::updatePasswordIcon() { m_statusBtnPassword->setIcon(icon); } -void MainWindow::showRestoreHeightDialog() { - // settings custom restore height is only available for 25 word seeds - auto seedLength = m_ctx->wallet->seedLength(); - if (seedLength == 14 || seedLength == 16) { // TODO: update this warning (import tx, delete cache, restore from seed) - const auto msg = "This wallet has a mnemonic seed with an embedded restore height."; - QMessageBox::warning(this, "Cannot set custom restore height", msg); - return; - } - - RestoreHeightDialog dialog{this, m_ctx->wallet->getWalletCreationHeight()}; - if (dialog.exec() == QDialog::Accepted) { - int restoreHeight = dialog.getHeight(); - m_ctx->onSetRestoreHeight(restoreHeight); - } -} - void MainWindow::showKeysDialog() { if (!this->verifyPassword()) { return; @@ -1445,13 +1427,6 @@ void MainWindow::onEndTransaction() { } } -void MainWindow::onCustomRestoreHeightSet(int height) { - auto msg = QString("The restore height for this wallet has been set to %1. " - "Please re-open the wallet. Feather will now quit.").arg(height); - QMessageBox::information(this, "Cannot set custom restore height", msg); - this->menuQuitClicked(); -} - void MainWindow::onKeysCorrupted() { if (!m_criticalWarningShown) { m_criticalWarningShown = true; diff --git a/src/MainWindow.h b/src/MainWindow.h index f704b593..cdfe795b 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -20,7 +20,6 @@ #include "dialog/PasswordChangeDialog.h" #include "dialog/KeysDialog.h" #include "dialog/AboutDialog.h" -#include "dialog/RestoreHeightDialog.h" #include "dialog/SplashDialog.h" #include "libwalletqt/Wallet.h" #include "model/SubaddressModel.h" @@ -138,7 +137,6 @@ private slots: void onSignedHashesReceived(QNetworkReply *reply, const QString &platformTag, const QString &version); void onInitiateTransaction(); void onEndTransaction(); - void onCustomRestoreHeightSet(int height); void onKeysCorrupted(); void onSelectedInputsChanged(const QStringList &selectedInputs); @@ -173,7 +171,6 @@ private slots: void onViewOnBlockExplorer(const QString &txid); void onResendTransaction(const QString &txid); void importContacts(); - void showRestoreHeightDialog(); void importTransaction(); void onDeviceError(const QString &error); void onDeviceButtonRequest(quint64 code); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index cbd3ecbc..035666ec 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -476,7 +476,6 @@ - diff --git a/src/appcontext.cpp b/src/appcontext.cpp index 4149dce3..52a5694f 100644 --- a/src/appcontext.cpp +++ b/src/appcontext.cpp @@ -199,24 +199,6 @@ void AppContext::onTorSettingsChanged() { qDebug() << "Changed privacyLevel to " << privacyLevel; } -void AppContext::onSetRestoreHeight(quint64 height){ - auto seedLength = this->wallet->seedLength(); - if (seedLength == 14 || seedLength == 16) { - const auto msg = "This wallet has a mnemonic seed with an embedded restore height."; - emit setRestoreHeightError(msg); - return; - } - - this->wallet->setWalletCreationHeight(height); - this->wallet->setPassword(this->wallet->getPassword()); // trigger .keys write - - // nuke wallet cache - const auto fn = this->wallet->cachePath(); - WalletManager::clearWalletCache(fn); - - emit customRestoreHeightSet(height); -} - void AppContext::stopTimers() { m_storeTimer.stop(); } diff --git a/src/appcontext.h b/src/appcontext.h index 2035a846..db831980 100644 --- a/src/appcontext.h +++ b/src/appcontext.h @@ -57,7 +57,6 @@ public slots: void onCancelTransaction(PendingTransaction *tx, const QVector &address); void onSweepOutputs(const QVector &keyImages, QString address, bool churn, int outputs); void onCreateTransactionError(const QString &msg); - void onSetRestoreHeight(quint64 height); void onMultiBroadcast(PendingTransaction *tx); void onDeviceButtonRequest(quint64 code); void onDeviceButtonPressed(); @@ -87,8 +86,6 @@ signals: void createTransactionError(QString message); void createTransactionCancelled(const QVector &address, quint64 amount); void createTransactionSuccess(PendingTransaction *tx, const QVector &address); - void setRestoreHeightError(const QString &msg); - void customRestoreHeightSet(int height); void initiateTransaction(); void endTransaction(); void deviceButtonRequest(quint64 code); diff --git a/src/dialog/RestoreHeightDialog.cpp b/src/dialog/RestoreHeightDialog.cpp deleted file mode 100644 index 8c1e176a..00000000 --- a/src/dialog/RestoreHeightDialog.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2022 The Monero Project - -#include "RestoreHeightDialog.h" - -#include -#include -#include - -RestoreHeightDialog::RestoreHeightDialog(QWidget *parent, quint64 currentRestoreHeight) - : WindowModalDialog(parent) - , m_restoreHeightWidget(new RestoreHeightWidget(this)) -{ - auto *layout = new QVBoxLayout(this); - - auto *label = new QLabel(this); - label->setText("Enter a wallet creation date or restore height."); - - auto *buttonBox = new QDialogButtonBox(this); - buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); - - layout->addWidget(label); - layout->addWidget(m_restoreHeightWidget); - layout->addWidget(buttonBox); - - this->setLayout(layout); - - if (currentRestoreHeight) { - m_restoreHeightWidget->setHeight(currentRestoreHeight); - } - - connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); - - this->adjustSize(); -} - -int RestoreHeightDialog::getHeight() { - return m_restoreHeightWidget->getHeight(); -} \ No newline at end of file diff --git a/src/dialog/RestoreHeightDialog.h b/src/dialog/RestoreHeightDialog.h deleted file mode 100644 index 4a6c7503..00000000 --- a/src/dialog/RestoreHeightDialog.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2022 The Monero Project - -#ifndef FEATHER_RESTOREHEIGHTDIALOG_H -#define FEATHER_RESTOREHEIGHTDIALOG_H - -#include - -#include "components.h" -#include "widgets/RestoreHeightWidget.h" - -class RestoreHeightDialog : public WindowModalDialog -{ -Q_OBJECT - -public: - explicit RestoreHeightDialog(QWidget *parent = nullptr, quint64 currentRestoreHeight = 0); - int getHeight(); - -private: - RestoreHeightWidget *m_restoreHeightWidget; -}; - - -#endif //FEATHER_RESTOREHEIGHTDIALOG_H