diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e5b9c8c..f5a4afe 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -6,6 +6,7 @@ #include "balancestablemodel.h" #include "settings.h" #include "utils.h" +#include "senttxstore.h" #include "precompiled.h" @@ -49,6 +50,14 @@ MainWindow::MainWindow(QWidget *parent) : aboutDialog.exec(); }); + // Set up delete sent history action + QObject::connect(ui->actionDelete_Sent_History, &QAction::triggered, [=] () { + bool confirm = QMessageBox::information(this, "Delete Sent History?", + "Shielded z-Address sent transactions are stored locally in your wallet. You may delete this saved information safely any time for your privacy.\nDo you want to delete this now?", + QMessageBox::Yes, QMessageBox::No); + if (confirm) SentTxStore::deleteHistory(); + }); + // Initialize to the balances tab ui->tabWidget->setCurrentIndex(0); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index f429a8f..c0e684b 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -720,6 +720,7 @@ File + @@ -769,6 +770,11 @@ Check github.com for Updates + + + Delete Sent History + + diff --git a/src/senttxstore.cpp b/src/senttxstore.cpp index 711b33b..8adb0ba 100644 --- a/src/senttxstore.cpp +++ b/src/senttxstore.cpp @@ -16,6 +16,12 @@ QString SentTxStore::writeableFile() { } } +// delete the sent history. +void SentTxStore::deleteHistory() { + QFile data(writeableFile()); + data.remove(); +} + QList SentTxStore::readSentTxFile() { QFile data(writeableFile()); if (!data.exists()) { diff --git a/src/senttxstore.h b/src/senttxstore.h index f41f014..a62fb67 100644 --- a/src/senttxstore.h +++ b/src/senttxstore.h @@ -7,6 +7,8 @@ class SentTxStore { public: + static void deleteHistory(); + static QList readSentTxFile(); static void addToSentTx(Tx tx, QString txid); diff --git a/src/ui_mainwindow.h b/src/ui_mainwindow.h index a0f8192..56fb1e8 100644 --- a/src/ui_mainwindow.h +++ b/src/ui_mainwindow.h @@ -47,6 +47,7 @@ public: QAction *actionDonate; QAction *actionImport_Private_Keys; QAction *actionCheck_for_Updates; + QAction *actionDelete_Sent_History; QWidget *centralWidget; QGridLayout *gridLayout_3; QTabWidget *tabWidget; @@ -159,6 +160,8 @@ public: actionImport_Private_Keys->setVisible(false); actionCheck_for_Updates = new QAction(MainWindow); actionCheck_for_Updates->setObjectName(QStringLiteral("actionCheck_for_Updates")); + actionDelete_Sent_History = new QAction(MainWindow); + actionDelete_Sent_History->setObjectName(QStringLiteral("actionDelete_Sent_History")); centralWidget = new QWidget(MainWindow); centralWidget->setObjectName(QStringLiteral("centralWidget")); gridLayout_3 = new QGridLayout(centralWidget); @@ -666,6 +669,7 @@ public: menuBar->addAction(menuBalance->menuAction()); menuBar->addAction(menuHelp->menuAction()); menuBalance->addAction(actionImport_Private_Keys); + menuBalance->addAction(actionDelete_Sent_History); menuBalance->addAction(actionSettings); menuBalance->addSeparator(); menuBalance->addAction(actionExit); @@ -690,6 +694,7 @@ public: actionDonate->setText(QApplication::translate("MainWindow", "Donate", nullptr)); actionImport_Private_Keys->setText(QApplication::translate("MainWindow", "Import Private Keys", nullptr)); actionCheck_for_Updates->setText(QApplication::translate("MainWindow", "Check github.com for Updates", nullptr)); + actionDelete_Sent_History->setText(QApplication::translate("MainWindow", "Delete Sent History", nullptr)); groupBox->setTitle(QApplication::translate("MainWindow", "Summary", nullptr)); label->setText(QApplication::translate("MainWindow", "Shielded", nullptr)); balSheilded->setText(QString());