From 69b01e6f8b3aca781da7f049909ad75de73a804a Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Sat, 31 Mar 2018 16:02:58 -0400 Subject: Add cancel button to rescan progress dialog Adds a cancel button to the rescan progress dialog. When it is clicked, AbortRescan is called to abort a rescan --- src/qt/walletview.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/qt') diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 8b9b85c8c9..d529595dec 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -315,9 +315,9 @@ void WalletView::showProgress(const QString &title, int nProgress) progressDialog = new QProgressDialog(title, "", 0, 100); progressDialog->setWindowModality(Qt::ApplicationModal); progressDialog->setMinimumDuration(0); - progressDialog->setCancelButton(0); progressDialog->setAutoClose(false); progressDialog->setValue(0); + progressDialog->setCancelButtonText(tr("Cancel")); } else if (nProgress == 100) { @@ -327,8 +327,13 @@ void WalletView::showProgress(const QString &title, int nProgress) progressDialog->deleteLater(); } } - else if (progressDialog) - progressDialog->setValue(nProgress); + else if (progressDialog) { + if (progressDialog->wasCanceled()) { + getWalletModel()->wallet().abortRescan(); + } else { + progressDialog->setValue(nProgress); + } + } } void WalletView::requestedSyncWarningInfo() -- cgit v1.2.3