mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-11 15:48:05 +00:00
ui: Add "Copy raw transaction data" to transaction list context menu
Add a way to quickly copy transaction hex. Primarily useful when manually submitting transactions, e.g. `-walletbroadcast=0` is set.
This commit is contained in:
parent
eac53ec992
commit
b4f3e9c09e
@ -13,6 +13,7 @@
|
|||||||
#include "transactionrecord.h"
|
#include "transactionrecord.h"
|
||||||
#include "walletmodel.h"
|
#include "walletmodel.h"
|
||||||
|
|
||||||
|
#include "core_io.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
@ -220,6 +221,18 @@ public:
|
|||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getTxHex(TransactionRecord *rec)
|
||||||
|
{
|
||||||
|
LOCK2(cs_main, wallet->cs_wallet);
|
||||||
|
std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash);
|
||||||
|
if(mi != wallet->mapWallet.end())
|
||||||
|
{
|
||||||
|
std::string strHex = EncodeHexTx(static_cast<CTransaction>(mi->second));
|
||||||
|
return QString::fromStdString(strHex);
|
||||||
|
}
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TransactionTableModel::TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent):
|
TransactionTableModel::TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent):
|
||||||
@ -594,6 +607,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|||||||
return rec->getTxID();
|
return rec->getTxID();
|
||||||
case TxHashRole:
|
case TxHashRole:
|
||||||
return QString::fromStdString(rec->hash.ToString());
|
return QString::fromStdString(rec->hash.ToString());
|
||||||
|
case TxHexRole:
|
||||||
|
return priv->getTxHex(rec);
|
||||||
case ConfirmedRole:
|
case ConfirmedRole:
|
||||||
return rec->status.countsForBalance;
|
return rec->status.countsForBalance;
|
||||||
case FormattedAmountRole:
|
case FormattedAmountRole:
|
||||||
|
@ -60,6 +60,8 @@ public:
|
|||||||
TxIDRole,
|
TxIDRole,
|
||||||
/** Transaction hash */
|
/** Transaction hash */
|
||||||
TxHashRole,
|
TxHashRole,
|
||||||
|
/** Transaction data, hex-encoded */
|
||||||
|
TxHexRole,
|
||||||
/** Is transaction confirmed? */
|
/** Is transaction confirmed? */
|
||||||
ConfirmedRole,
|
ConfirmedRole,
|
||||||
/** Formatted amount, without brackets when unconfirmed */
|
/** Formatted amount, without brackets when unconfirmed */
|
||||||
|
@ -141,6 +141,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
||||||
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
||||||
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
|
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
|
||||||
|
QAction *copyTxHexAction = new QAction(tr("Copy raw transaction"), this);
|
||||||
QAction *editLabelAction = new QAction(tr("Edit label"), this);
|
QAction *editLabelAction = new QAction(tr("Edit label"), this);
|
||||||
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
|
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
|
||||||
|
|
||||||
@ -149,6 +150,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
contextMenu->addAction(copyLabelAction);
|
contextMenu->addAction(copyLabelAction);
|
||||||
contextMenu->addAction(copyAmountAction);
|
contextMenu->addAction(copyAmountAction);
|
||||||
contextMenu->addAction(copyTxIDAction);
|
contextMenu->addAction(copyTxIDAction);
|
||||||
|
contextMenu->addAction(copyTxHexAction);
|
||||||
contextMenu->addAction(editLabelAction);
|
contextMenu->addAction(editLabelAction);
|
||||||
contextMenu->addAction(showDetailsAction);
|
contextMenu->addAction(showDetailsAction);
|
||||||
|
|
||||||
@ -170,6 +172,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
|
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
|
||||||
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
|
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
|
||||||
connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
|
connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
|
||||||
|
connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex()));
|
||||||
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
|
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
|
||||||
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
|
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
|
||||||
}
|
}
|
||||||
@ -380,6 +383,11 @@ void TransactionView::copyTxID()
|
|||||||
GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxIDRole);
|
GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxIDRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TransactionView::copyTxHex()
|
||||||
|
{
|
||||||
|
GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxHexRole);
|
||||||
|
}
|
||||||
|
|
||||||
void TransactionView::editLabel()
|
void TransactionView::editLabel()
|
||||||
{
|
{
|
||||||
if(!transactionView->selectionModel() ||!model)
|
if(!transactionView->selectionModel() ||!model)
|
||||||
|
@ -93,6 +93,7 @@ private Q_SLOTS:
|
|||||||
void copyLabel();
|
void copyLabel();
|
||||||
void copyAmount();
|
void copyAmount();
|
||||||
void copyTxID();
|
void copyTxID();
|
||||||
|
void copyTxHex();
|
||||||
void openThirdPartyTxUrl(QString url);
|
void openThirdPartyTxUrl(QString url);
|
||||||
void updateWatchOnlyColumn(bool fHaveWatchOnly);
|
void updateWatchOnlyColumn(bool fHaveWatchOnly);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user