mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 15:21:30 +02:00
history: add option to remove failed tx
This commit is contained in:
@@ -90,6 +90,10 @@ void HistoryWidget::showContextMenu(const QPoint &point) {
|
||||
menu.addAction("Resend transaction", this, &HistoryWidget::onResendTransaction);
|
||||
}
|
||||
|
||||
if (tx->isFailed()) {
|
||||
menu.addAction("Remove from history", this, &HistoryWidget::onRemoveFromHistory);
|
||||
}
|
||||
|
||||
menu.addMenu(m_copyMenu);
|
||||
menu.addAction("Show details", this, &HistoryWidget::showTxDetails);
|
||||
menu.addAction("View on block explorer", this, &HistoryWidget::onViewOnBlockExplorer);
|
||||
@@ -106,6 +110,16 @@ void HistoryWidget::onResendTransaction() {
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::onRemoveFromHistory() {
|
||||
auto *tx = ui->history->currentEntry();
|
||||
if (!tx) return;
|
||||
|
||||
auto result = QMessageBox::question(this, "Remove transaction from history", "Are you sure you want to remove this transaction from the history?");
|
||||
if (result == QMessageBox::Yes) {
|
||||
m_wallet->removeFailedTx(tx->hash());
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::resetModel()
|
||||
{
|
||||
// Save view state
|
||||
|
||||
@@ -42,6 +42,7 @@ private slots:
|
||||
void onViewOnBlockExplorer();
|
||||
void setSearchFilter(const QString &filter);
|
||||
void onResendTransaction();
|
||||
void onRemoveFromHistory();
|
||||
void createTxProof();
|
||||
|
||||
private:
|
||||
|
||||
@@ -1032,6 +1032,20 @@ bool Wallet::submitTxFile(const QString &fileName) const
|
||||
return m_walletImpl->importKeyImages(fileName.toStdString() + "_keyImages");
|
||||
}
|
||||
|
||||
bool Wallet::removeFailedTx(const QString &txid)
|
||||
{
|
||||
crypto::hash txid_;
|
||||
if(!epee::string_tools::hex_to_pod(txid.toStdString(), txid_))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool r = m_wallet2->remove_failed_tx(txid_);
|
||||
m_history->refresh();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// #################### Models ####################
|
||||
|
||||
TransactionHistory *Wallet::history() const {
|
||||
|
||||
@@ -345,6 +345,8 @@ public:
|
||||
//! Submit a transfer from file
|
||||
bool submitTxFile(const QString &fileName) const;
|
||||
|
||||
bool removeFailedTx(const QString &txid);
|
||||
|
||||
// ##### Models #####
|
||||
TransactionHistory* history() const;
|
||||
TransactionHistoryProxyModel* historyModel();
|
||||
|
||||
Reference in New Issue
Block a user