Fix Transaction to string conversion and add shortcut for dogechain

There was literally no reason to add -000 to transaction string
conversion. The idx itself is used for sorting internally
Add a menu item to load up a transaction in Dogechain.info
This commit is contained in:
Alan Westbrook 2014-02-02 15:57:59 -08:00
parent 9dd5cdf841
commit 18ccdab281
4 changed files with 22 additions and 3 deletions

View File

@ -226,6 +226,6 @@ bool TransactionRecord::statusUpdateNeeded()
std::string TransactionRecord::getTxID()
{
return hash.ToString() + strprintf("-%03d", idx);
return hash.ToString(); // + strprintf("-%03d", idx);
}

View File

@ -90,8 +90,7 @@ public:
TransactionRecord(uint256 hash, int64 time,
Type type, const std::string &address,
int64 debit, int64 credit):
hash(hash), time(time), type(type), address(address), debit(debit), credit(credit),
idx(0)
hash(hash), time(time), type(type), address(address), debit(debit), credit(credit), idx(0)
{
}

View File

@ -25,6 +25,8 @@
#include <QMenu>
#include <QLabel>
#include <QDateTimeEdit>
#include <QDesktopServices>
#include <QUrl>
TransactionView::TransactionView(QWidget *parent) :
QWidget(parent), model(0), transactionProxyModel(0),
@ -126,14 +128,18 @@ TransactionView::TransactionView(QWidget *parent) :
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
QAction *editLabelAction = new QAction(tr("Edit label"), this);
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
QAction *viewOnDogechain = new QAction(tr("Show transaction on Dogechain"), this);
contextMenu = new QMenu();
contextMenu->addAction(copyAddressAction);
contextMenu->addAction(copyLabelAction);
contextMenu->addAction(copyAmountAction);
contextMenu->addAction(copyTxIDAction);
contextMenu->addSeparator();
contextMenu->addAction(editLabelAction);
contextMenu->addAction(showDetailsAction);
contextMenu->addSeparator();
contextMenu->addAction(viewOnDogechain);
// Connect actions
connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
@ -150,6 +156,7 @@ TransactionView::TransactionView(QWidget *parent) :
connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
connect(viewOnDogechain, SIGNAL(triggered()), this, SLOT(viewOnDogechain()));
}
void TransactionView::setModel(WalletModel *model)
@ -379,6 +386,18 @@ void TransactionView::showDetails()
}
}
void TransactionView::viewOnDogechain()
{
QModelIndexList selection = transactionView->selectionModel()->selectedRows();
if(!selection.isEmpty())
{
QString format("http://dogechain.info/tx/");
format += selection.at(0).data(TransactionTableModel::TxIDRole).toString();
QDesktopServices::openUrl(QUrl(format));
}
}
QWidget *TransactionView::createDateRangeWidget()
{
dateRangeWidget = new QFrame();

View File

@ -67,6 +67,7 @@ private slots:
void copyLabel();
void copyAmount();
void copyTxID();
void viewOnDogechain();
signals:
void doubleClicked(const QModelIndex&);