Cleaned up version of #424

This commit is contained in:
langerhans 2014-04-07 18:49:01 +02:00
parent a954d3f6bf
commit a4a8784ce8
2 changed files with 22 additions and 0 deletions

View file

@ -30,6 +30,8 @@
#include <QScrollBar>
#include <QTableView>
#include <QVBoxLayout>
#include <QDesktopServices>
#include <QUrl>
TransactionView::TransactionView(QWidget *parent) :
QWidget(parent), model(0), transactionProxyModel(0),
@ -129,14 +131,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)));
@ -153,6 +159,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)
@ -385,6 +392,20 @@ void TransactionView::showDetails()
}
}
void TransactionView::viewOnDogechain()
{
QModelIndexList selection = transactionView->selectionModel()->selectedRows();
if(!selection.isEmpty())
{
QString format("http://dogechain.info/tx/");
QString munged = selection.at(0).data(TransactionTableModel::TxIDRole).toString();
format += munged.left(munged.lastIndexOf("-"));
QDesktopServices::openUrl(QUrl(format));
}
}
QWidget *TransactionView::createDateRangeWidget()
{
dateRangeWidget = new QFrame();

View file

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