]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
Menu: remove 'Change restore height'
authortobtoht <thotbot@protonmail.com>
Thu, 23 Jun 2022 10:53:52 +0000 (12:53 +0200)
committertobtoht <thotbot@protonmail.com>
Thu, 23 Jun 2022 10:54:01 +0000 (12:54 +0200)
Restoring the wallet from seed is the preferred UX here. Missing
transactions should be imported using Tools -> Import transaction.

src/MainWindow.cpp
src/MainWindow.h
src/MainWindow.ui
src/appcontext.cpp
src/appcontext.h
src/dialog/RestoreHeightDialog.cpp [deleted file]
src/dialog/RestoreHeightDialog.h [deleted file]

index ff8fbfc9eab3175654779417c2e57f854873628c..a477f3887a1cf4f2d34793ec5e0baaf781753932 100644 (file)
@@ -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;
index f704b593729b988af58b7931d3875a2f7ec1ba50..cdfe795bcd5024a913d04db022611a8fa929fdf5 100644 (file)
@@ -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);
index cbd3ecbcbaf38815ca331f7097f54a1d140b44e0..035666ec394961c75dd76fb9790b0197108a470d 100644 (file)
      <addaction name="actionRescan_spent"/>
      <addaction name="actionWallet_cache_debug"/>
      <addaction name="separator"/>
-     <addaction name="actionChange_restore_height"/>
      <addaction name="menuExport"/>
      <addaction name="menuImport"/>
     </widget>
index 4149dce350255e91a2756631053bc6fbcff60dc0..52a5694fca2aa3f054e057f1155f0997a91ca2d5 100644 (file)
@@ -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();
 }
index 2035a84693e7906528401ffe4c99dddf9d11b25d..db831980b16b2eda3dbd2fa32ad48e14ac063e1c 100644 (file)
@@ -57,7 +57,6 @@ public slots:
     void onCancelTransaction(PendingTransaction *tx, const QVector<QString> &address);
     void onSweepOutputs(const QVector<QString> &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<QString> &address, quint64 amount);
     void createTransactionSuccess(PendingTransaction *tx, const QVector<QString> &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 (file)
index 8c1e176..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// SPDX-License-Identifier: BSD-3-Clause
-// SPDX-FileCopyrightText: 2020-2022 The Monero Project
-
-#include "RestoreHeightDialog.h"
-
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QDialogButtonBox>
-
-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 (file)
index 4a6c750..0000000
+++ /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 <QDialog>
-
-#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