23 #include <QDateTimeEdit> 24 #include <QDesktopServices> 25 #include <QDoubleValidator> 26 #include <QHBoxLayout> 27 #include <QHeaderView> 34 #include <QSignalMapper> 37 #include <QVBoxLayout> 43 QWidget(
parent), model(0), transactionProxyModel(0),
44 transactionView(0), abandonAction(0), columnResizingFixer(0)
48 setContentsMargins(0,0,0,0);
50 QHBoxLayout *hlayout =
new QHBoxLayout();
51 hlayout->setContentsMargins(0,0,0,0);
53 hlayout->setSpacing(0);
54 hlayout->addSpacing(6);
56 hlayout->setSpacing(1);
57 hlayout->addSpacing(5);
109 #if QT_VERSION >= 0x040700 110 addressWidget->setPlaceholderText(tr(
"Enter address or label to search"));
116 #if QT_VERSION >= 0x040700 124 amountWidget->setValidator(
new QDoubleValidator(0, 1e20, 8,
this));
128 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
129 vlayout->setContentsMargins(0,0,0,0);
130 vlayout->setSpacing(0);
132 QTableView *view =
new QTableView(
this);
133 vlayout->addLayout(hlayout);
135 vlayout->addWidget(view);
136 vlayout->setSpacing(0);
137 int width = view->verticalScrollBar()->sizeHint().width();
140 hlayout->addSpacing(width+2);
142 hlayout->addSpacing(width);
145 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
146 view->setTabKeyNavigation(
false);
147 view->setContextMenuPolicy(Qt::CustomContextMenu);
149 view->installEventFilter(
this);
154 abandonAction =
new QAction(tr(
"Abandon transaction"),
this);
155 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
156 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
157 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
158 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
159 QAction *copyTxHexAction =
new QAction(tr(
"Copy raw transaction"),
this);
160 QAction *
copyTxPlainText =
new QAction(tr(
"Copy full transaction details"),
this);
161 QAction *editLabelAction =
new QAction(tr(
"Edit label"),
this);
162 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
188 connect(view, SIGNAL(clicked(QModelIndex)),
this, SLOT(
computeSum()));
189 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
192 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
193 connect(copyLabelAction, SIGNAL(triggered()),
this, SLOT(
copyLabel()));
194 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
195 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
196 connect(copyTxHexAction, SIGNAL(triggered()),
this, SLOT(
copyTxHex()));
198 connect(editLabelAction, SIGNAL(triggered()),
this, SLOT(
editLabel()));
199 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
220 transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
232 connect(
transactionView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
this, SLOT(
computeSum()));
240 for (
int i = 0; i < listUrls.size(); ++i)
242 QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host();
245 QAction *thirdPartyTxUrlAction =
new QAction(host,
this);
273 QDate current = QDate::currentDate();
289 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
291 QDateTime(startOfWeek),
297 QDateTime(QDate(current.year(), current.month(), 1)),
302 QDateTime(QDate(current.year(), current.month(), 1).addMonths(-1)),
303 QDateTime(QDate(current.year(), current.month(), 1)));
307 QDateTime(QDate(current.year(), 1, 1)),
316 settings.setValue(
"transactionDate", idx);
331 settings.setValue(
"transactionType", idx);
356 QString newAmount = amount;
357 newAmount.replace(QString(
","), QString(
"."));
373 tr(
"Export Transaction History"), QString(),
374 tr(
"Comma separated file (*.csv)"), NULL);
376 if (filename.isNull())
393 if(!writer.
write()) {
394 Q_EMIT
message(tr(
"Exporting Failed"), tr(
"There was an error trying to save the transaction history to %1.").arg(filename),
398 Q_EMIT
message(tr(
"Exporting Successful"), tr(
"The transaction history was successfully saved to %1.").arg(filename),
406 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
423 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
428 hash.
SetHex(hashQStr.toStdString());
471 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
472 if(!selection.isEmpty())
478 if(address.isEmpty())
489 QModelIndex modelIdx = addressBook->
index(idx, 0, QModelIndex());
517 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
518 if(!selection.isEmpty())
532 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
534 Q_FOREACH (QModelIndex
index, selection){
538 if (amount < 0) strAmount =
"<span style='color:red;'>" + strAmount +
"</span>";
546 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
547 if(!selection.isEmpty())
562 layout->setContentsMargins(0,0,0,0);
563 layout->addSpacing(23);
564 layout->addWidget(
new QLabel(tr(
"Range:")));
573 layout->addWidget(
new QLabel(tr(
"to")));
575 dateTo =
new QDateTimeEdit(
this);
576 dateTo->setCalendarPopup(
true);
577 dateTo->setMinimumWidth(100);
581 layout->addWidget(
dateTo);
582 layout->addStretch();
606 QDateTime(
dateTo->date()));
625 QWidget::resizeEvent(event);
632 if (event->type() == QEvent::KeyPress)
634 QKeyEvent *ke =
static_cast<QKeyEvent *
>(event);
635 if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))
641 return QWidget::eventFilter(obj, event);
static const quint32 COMMON_TYPES
QWidget * createDateRangeWidget()
void updateWatchOnlyColumn(bool fHaveWatchOnly)
static const QString Receive
void setModel(AddressTableModel *model)
bool eventFilter(QObject *obj, QEvent *event)
void setAddressPrefix(const QString &addrPrefix)
TransactionView(const PlatformStyle *platformStyle, QWidget *parent=0)
void setModel(const QAbstractItemModel *model)
QTableView * transactionView
static const QDateTime MAX_DATE
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */...
static bool parse(int unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
void focusTransaction(const QModelIndex &)
void chooseWatchonly(int idx)
int lookupAddress(const QString &address) const
QComboBox * watchOnlyWidget
void setModel(WalletModel *model)
void changedAmount(const QString &amount)
static const QDateTime MIN_DATE
static const char * PERSISTENCE_DATE_FORMAT
void updateTransaction(const QString &hash, int status, bool showTransaction)
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
bool haveWatchOnly() const
void message(const QString &title, const QString &message, unsigned int style)
TransactionTableModel * getTransactionTableModel()
void copyEntryData(QAbstractItemView *view, int column, int role)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
TransactionFilterProxy * transactionProxyModel
QModelIndex index(int row, int column, const QModelIndex &parent) const
void changedPrefix(const QString &prefix)
void openThirdPartyTxUrl(QString url)
static quint32 TYPE(int type)
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
QString getThirdPartyTxUrls()
void setAddress(const QString &address)
void doubleClicked(const QModelIndex &)
void contextualMenu(const QPoint &)
OptionsModel * getOptionsModel()
static const quint32 ALL_TYPES
void stretchColumnWidth(int column)
TransactionTableModel * parent
QLineEdit * addressWidget
void setWatchOnlyFilter(WatchOnlyFilter filter)
QSignalMapper * mapperThirdPartyTxUrls
TransactionRecord * index(int idx)
virtual void resizeEvent(QResizeEvent *event)
void setDateRange(const QDateTime &from, const QDateTime &to)
void trxAmount(QString amount)
QVariant data(const QModelIndex &index, int role) const
bool abandonTransaction(uint256 hash) const
void setMinAmount(const CAmount &minimum)
void SetHex(const char *psz)
bool transactionCanBeAbandoned(uint256 hash) const
AddressTableModel * getAddressTableModel()
GUIUtil::TableViewLastColumnResizingFixer * columnResizingFixer
void setTypeFilter(quint32 modes)