Bitcoin Core  22.0.0
P2P Digital Currency
transactionview.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2020 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <qt/transactionview.h>
6 
7 #include <qt/addresstablemodel.h>
8 #include <qt/bitcoinunits.h>
9 #include <qt/csvmodelwriter.h>
10 #include <qt/editaddressdialog.h>
11 #include <qt/guiutil.h>
12 #include <qt/optionsmodel.h>
13 #include <qt/platformstyle.h>
16 #include <qt/transactionrecord.h>
18 #include <qt/walletmodel.h>
19 
20 #include <node/ui_interface.h>
21 
22 #include <QApplication>
23 #include <QComboBox>
24 #include <QDateTimeEdit>
25 #include <QDesktopServices>
26 #include <QDoubleValidator>
27 #include <QHBoxLayout>
28 #include <QHeaderView>
29 #include <QLabel>
30 #include <QLineEdit>
31 #include <QMenu>
32 #include <QPoint>
33 #include <QScrollBar>
34 #include <QSettings>
35 #include <QTableView>
36 #include <QTimer>
37 #include <QUrl>
38 #include <QVBoxLayout>
39 
40 TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent)
41  : QWidget(parent), m_platform_style{platformStyle}
42 {
43  // Build filter row
44  setContentsMargins(0,0,0,0);
45 
46  QHBoxLayout *hlayout = new QHBoxLayout();
47  hlayout->setContentsMargins(0,0,0,0);
48 
49  if (platformStyle->getUseExtraSpacing()) {
50  hlayout->setSpacing(5);
51  hlayout->addSpacing(26);
52  } else {
53  hlayout->setSpacing(0);
54  hlayout->addSpacing(23);
55  }
56 
57  watchOnlyWidget = new QComboBox(this);
58  watchOnlyWidget->setFixedWidth(24);
59  watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
60  watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
61  watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
62  hlayout->addWidget(watchOnlyWidget);
63 
64  dateWidget = new QComboBox(this);
65  if (platformStyle->getUseExtraSpacing()) {
66  dateWidget->setFixedWidth(121);
67  } else {
68  dateWidget->setFixedWidth(120);
69  }
70  dateWidget->addItem(tr("All"), All);
71  dateWidget->addItem(tr("Today"), Today);
72  dateWidget->addItem(tr("This week"), ThisWeek);
73  dateWidget->addItem(tr("This month"), ThisMonth);
74  dateWidget->addItem(tr("Last month"), LastMonth);
75  dateWidget->addItem(tr("This year"), ThisYear);
76  dateWidget->addItem(tr("Range…"), Range);
77  hlayout->addWidget(dateWidget);
78 
79  typeWidget = new QComboBox(this);
80  if (platformStyle->getUseExtraSpacing()) {
81  typeWidget->setFixedWidth(121);
82  } else {
83  typeWidget->setFixedWidth(120);
84  }
85 
86  typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
87  typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
89  typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
91  typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
92  typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
93  typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));
94 
95  hlayout->addWidget(typeWidget);
96 
97  search_widget = new QLineEdit(this);
98  search_widget->setPlaceholderText(tr("Enter address, transaction id, or label to search"));
99  hlayout->addWidget(search_widget);
100 
101  amountWidget = new QLineEdit(this);
102  amountWidget->setPlaceholderText(tr("Min amount"));
103  if (platformStyle->getUseExtraSpacing()) {
104  amountWidget->setFixedWidth(97);
105  } else {
106  amountWidget->setFixedWidth(100);
107  }
108  QDoubleValidator *amountValidator = new QDoubleValidator(0, 1e20, 8, this);
109  QLocale amountLocale(QLocale::C);
110  amountLocale.setNumberOptions(QLocale::RejectGroupSeparator);
111  amountValidator->setLocale(amountLocale);
112  amountWidget->setValidator(amountValidator);
113  hlayout->addWidget(amountWidget);
114 
115  // Delay before filtering transactions in ms
116  static const int input_filter_delay = 200;
117 
118  QTimer* amount_typing_delay = new QTimer(this);
119  amount_typing_delay->setSingleShot(true);
120  amount_typing_delay->setInterval(input_filter_delay);
121 
122  QTimer* prefix_typing_delay = new QTimer(this);
123  prefix_typing_delay->setSingleShot(true);
124  prefix_typing_delay->setInterval(input_filter_delay);
125 
126  QVBoxLayout *vlayout = new QVBoxLayout(this);
127  vlayout->setContentsMargins(0,0,0,0);
128  vlayout->setSpacing(0);
129 
130  transactionView = new QTableView(this);
131  transactionView->setObjectName("transactionView");
132  vlayout->addLayout(hlayout);
133  vlayout->addWidget(createDateRangeWidget());
134  vlayout->addWidget(transactionView);
135  vlayout->setSpacing(0);
136  int width = transactionView->verticalScrollBar()->sizeHint().width();
137  // Cover scroll bar width with spacing
138  if (platformStyle->getUseExtraSpacing()) {
139  hlayout->addSpacing(width+2);
140  } else {
141  hlayout->addSpacing(width);
142  }
143  transactionView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
144  transactionView->setTabKeyNavigation(false);
145  transactionView->setContextMenuPolicy(Qt::CustomContextMenu);
146  transactionView->installEventFilter(this);
147  transactionView->setAlternatingRowColors(true);
148  transactionView->setSelectionBehavior(QAbstractItemView::SelectRows);
149  transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
150  transactionView->setSortingEnabled(true);
151  transactionView->verticalHeader()->hide();
152 
153  QSettings settings;
154  if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState").toByteArray())) {
155  transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
156  transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
157  transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
158  transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
159  transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
160  transactionView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
161  transactionView->horizontalHeader()->setStretchLastSection(true);
162  }
163 
164  contextMenu = new QMenu(this);
165  contextMenu->setObjectName("contextMenu");
166  copyAddressAction = contextMenu->addAction(tr("&Copy address"), this, &TransactionView::copyAddress);
167  copyLabelAction = contextMenu->addAction(tr("Copy &label"), this, &TransactionView::copyLabel);
168  contextMenu->addAction(tr("Copy &amount"), this, &TransactionView::copyAmount);
169  contextMenu->addAction(tr("Copy transaction &ID"), this, &TransactionView::copyTxID);
170  contextMenu->addAction(tr("Copy &raw transaction"), this, &TransactionView::copyTxHex);
171  contextMenu->addAction(tr("Copy full transaction &details"), this, &TransactionView::copyTxPlainText);
172  contextMenu->addAction(tr("&Show transaction details"), this, &TransactionView::showDetails);
173  contextMenu->addSeparator();
174  bumpFeeAction = contextMenu->addAction(tr("Increase transaction &fee"));
175  GUIUtil::ExceptionSafeConnect(bumpFeeAction, &QAction::triggered, this, &TransactionView::bumpFee);
176  bumpFeeAction->setObjectName("bumpFeeAction");
177  abandonAction = contextMenu->addAction(tr("A&bandon transaction"), this, &TransactionView::abandonTx);
178  contextMenu->addAction(tr("&Edit address label"), this, &TransactionView::editLabel);
179 
180  connect(dateWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseDate);
181  connect(typeWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseType);
182  connect(watchOnlyWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
183  connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, qOverload<>(&QTimer::start));
184  connect(amount_typing_delay, &QTimer::timeout, this, &TransactionView::changedAmount);
185  connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, qOverload<>(&QTimer::start));
186  connect(prefix_typing_delay, &QTimer::timeout, this, &TransactionView::changedSearch);
187 
188  connect(transactionView, &QTableView::doubleClicked, this, &TransactionView::doubleClicked);
189  connect(transactionView, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu);
190 
191  // Double-clicking on a transaction on the transaction history page shows details
193  // Highlight transaction after fee bump
194  connect(this, &TransactionView::bumpedFee, [this](const uint256& txid) {
195  focusTransaction(txid);
196  });
197 }
198 
200 {
201  QSettings settings;
202  settings.setValue("TransactionViewHeaderState", transactionView->horizontalHeader()->saveState());
203 }
204 
206 {
207  this->model = _model;
208  if(_model)
209  {
211  transactionProxyModel->setSourceModel(_model->getTransactionTableModel());
212  transactionProxyModel->setDynamicSortFilter(true);
213  transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
214  transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
215  transactionProxyModel->setSortRole(Qt::EditRole);
217  transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder);
218 
219  if (_model->getOptionsModel())
220  {
221  // Add third party transaction URLs to context menu
222  QStringList listUrls = GUIUtil::SplitSkipEmptyParts(_model->getOptionsModel()->getThirdPartyTxUrls(), "|");
223  for (int i = 0; i < listUrls.size(); ++i)
224  {
225  QString url = listUrls[i].trimmed();
226  QString host = QUrl(url, QUrl::StrictMode).host();
227  if (!host.isEmpty())
228  {
229  QAction *thirdPartyTxUrlAction = new QAction(host, this); // use host as menu item label
230  if (i == 0)
231  contextMenu->addSeparator();
232  contextMenu->addAction(thirdPartyTxUrlAction);
233  connect(thirdPartyTxUrlAction, &QAction::triggered, [this, url] { openThirdPartyTxUrl(url); });
234  }
235  }
236  }
237 
238  // show/hide column Watch-only
240 
241  // Watch-only signal
243  }
244 }
245 
247 {
248  if (e->type() == QEvent::PaletteChange) {
249  watchOnlyWidget->setItemIcon(
251  m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_plus")));
252  watchOnlyWidget->setItemIcon(
254  m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_minus")));
255  }
256 
257  QWidget::changeEvent(e);
258 }
259 
261 {
262  if (!transactionProxyModel) return;
263  QDate current = QDate::currentDate();
264  dateRangeWidget->setVisible(false);
265  switch(dateWidget->itemData(idx).toInt())
266  {
267  case All:
271  break;
272  case Today:
274  GUIUtil::StartOfDay(current),
276  break;
277  case ThisWeek: {
278  // Find last Monday
279  QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
281  GUIUtil::StartOfDay(startOfWeek),
283 
284  } break;
285  case ThisMonth:
287  GUIUtil::StartOfDay(QDate(current.year(), current.month(), 1)),
289  break;
290  case LastMonth:
292  GUIUtil::StartOfDay(QDate(current.year(), current.month(), 1).addMonths(-1)),
293  GUIUtil::StartOfDay(QDate(current.year(), current.month(), 1)));
294  break;
295  case ThisYear:
297  GUIUtil::StartOfDay(QDate(current.year(), 1, 1)),
299  break;
300  case Range:
301  dateRangeWidget->setVisible(true);
303  break;
304  }
305 }
306 
308 {
310  return;
312  typeWidget->itemData(idx).toInt());
313 }
314 
316 {
318  return;
320  static_cast<TransactionFilterProxy::WatchOnlyFilter>(watchOnlyWidget->itemData(idx).toInt()));
321 }
322 
324 {
326  return;
328 }
329 
331 {
333  return;
334  CAmount amount_parsed = 0;
335  if (BitcoinUnits::parse(model->getOptionsModel()->getDisplayUnit(), amountWidget->text(), &amount_parsed)) {
336  transactionProxyModel->setMinAmount(amount_parsed);
337  }
338  else
339  {
341  }
342 }
343 
345 {
346  if (!model || !model->getOptionsModel()) {
347  return;
348  }
349 
350  // CSV is currently the only supported format
351  QString filename = GUIUtil::getSaveFileName(this,
352  tr("Export Transaction History"), QString(),
353  /*: Expanded name of the CSV file format.
354  See https://en.wikipedia.org/wiki/Comma-separated_values */
355  tr("Comma separated file") + QLatin1String(" (*.csv)"), nullptr);
356 
357  if (filename.isNull())
358  return;
359 
360  CSVModelWriter writer(filename);
361 
362  // name, column, role
364  writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole);
365  if (model->wallet().haveWatchOnly())
366  writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly);
367  writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole);
368  writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole);
369  writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole);
370  writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole);
372  writer.addColumn(tr("ID"), 0, TransactionTableModel::TxHashRole);
373 
374  if(!writer.write()) {
375  Q_EMIT message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename),
377  }
378  else {
379  Q_EMIT message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename),
381  }
382 }
383 
384 void TransactionView::contextualMenu(const QPoint &point)
385 {
386  QModelIndex index = transactionView->indexAt(point);
387  QModelIndexList selection = transactionView->selectionModel()->selectedRows(0);
388  if (selection.empty())
389  return;
390 
391  // check if transaction can be abandoned, disable context menu action in case it doesn't
392  uint256 hash;
393  hash.SetHex(selection.at(0).data(TransactionTableModel::TxHashRole).toString().toStdString());
394  abandonAction->setEnabled(model->wallet().transactionCanBeAbandoned(hash));
395  bumpFeeAction->setEnabled(model->wallet().transactionCanBeBumped(hash));
398 
399  if (index.isValid()) {
400  GUIUtil::PopupMenu(contextMenu, transactionView->viewport()->mapToGlobal(point));
401  }
402 }
403 
405 {
406  if(!transactionView || !transactionView->selectionModel())
407  return;
408  QModelIndexList selection = transactionView->selectionModel()->selectedRows(0);
409 
410  // get the hash from the TxHashRole (QVariant / QString)
411  uint256 hash;
412  QString hashQStr = selection.at(0).data(TransactionTableModel::TxHashRole).toString();
413  hash.SetHex(hashQStr.toStdString());
414 
415  // Abandon the wallet transaction over the walletModel
417 
418  // Update the table
420 }
421 
422 void TransactionView::bumpFee([[maybe_unused]] bool checked)
423 {
424  if(!transactionView || !transactionView->selectionModel())
425  return;
426  QModelIndexList selection = transactionView->selectionModel()->selectedRows(0);
427 
428  // get the hash from the TxHashRole (QVariant / QString)
429  uint256 hash;
430  QString hashQStr = selection.at(0).data(TransactionTableModel::TxHashRole).toString();
431  hash.SetHex(hashQStr.toStdString());
432 
433  // Bump tx fee over the walletModel
434  uint256 newHash;
435  if (model->bumpFee(hash, newHash)) {
436  // Update the table
437  transactionView->selectionModel()->clearSelection();
439 
440  qApp->processEvents();
441  Q_EMIT bumpedFee(newHash);
442  }
443 }
444 
446 {
448 }
449 
451 {
453 }
454 
456 {
458 }
459 
461 {
463 }
464 
466 {
468 }
469 
471 {
473 }
474 
476 {
477  if(!transactionView->selectionModel() ||!model)
478  return;
479  QModelIndexList selection = transactionView->selectionModel()->selectedRows();
480  if(!selection.isEmpty())
481  {
482  AddressTableModel *addressBook = model->getAddressTableModel();
483  if(!addressBook)
484  return;
485  QString address = selection.at(0).data(TransactionTableModel::AddressRole).toString();
486  if(address.isEmpty())
487  {
488  // If this transaction has no associated address, exit
489  return;
490  }
491  // Is address in address book? Address book can miss address when a transaction is
492  // sent from outside the UI.
493  int idx = addressBook->lookupAddress(address);
494  if(idx != -1)
495  {
496  // Edit sending / receiving address
497  QModelIndex modelIdx = addressBook->index(idx, 0, QModelIndex());
498  // Determine type of address, launch appropriate editor dialog type
499  QString type = modelIdx.data(AddressTableModel::TypeRole).toString();
500 
501  EditAddressDialog dlg(
505  dlg.setModel(addressBook);
506  dlg.loadRow(idx);
507  dlg.exec();
508  }
509  else
510  {
511  // Add sending address
513  this);
514  dlg.setModel(addressBook);
515  dlg.setAddress(address);
516  dlg.exec();
517  }
518  }
519 }
520 
522 {
523  if(!transactionView->selectionModel())
524  return;
525  QModelIndexList selection = transactionView->selectionModel()->selectedRows();
526  if(!selection.isEmpty())
527  {
528  TransactionDescDialog *dlg = new TransactionDescDialog(selection.at(0));
529  dlg->setAttribute(Qt::WA_DeleteOnClose);
530  dlg->show();
531  }
532 }
533 
535 {
536  if(!transactionView || !transactionView->selectionModel())
537  return;
538  QModelIndexList selection = transactionView->selectionModel()->selectedRows(0);
539  if(!selection.isEmpty())
540  QDesktopServices::openUrl(QUrl::fromUserInput(url.replace("%s", selection.at(0).data(TransactionTableModel::TxHashRole).toString())));
541 }
542 
544 {
545  dateRangeWidget = new QFrame();
546  dateRangeWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
547  dateRangeWidget->setContentsMargins(1,1,1,1);
548  QHBoxLayout *layout = new QHBoxLayout(dateRangeWidget);
549  layout->setContentsMargins(0,0,0,0);
550  layout->addSpacing(23);
551  layout->addWidget(new QLabel(tr("Range:")));
552 
553  dateFrom = new QDateTimeEdit(this);
554  dateFrom->setDisplayFormat("dd/MM/yy");
555  dateFrom->setCalendarPopup(true);
556  dateFrom->setMinimumWidth(100);
557  dateFrom->setDate(QDate::currentDate().addDays(-7));
558  layout->addWidget(dateFrom);
559  layout->addWidget(new QLabel(tr("to")));
560 
561  dateTo = new QDateTimeEdit(this);
562  dateTo->setDisplayFormat("dd/MM/yy");
563  dateTo->setCalendarPopup(true);
564  dateTo->setMinimumWidth(100);
565  dateTo->setDate(QDate::currentDate());
566  layout->addWidget(dateTo);
567  layout->addStretch();
568 
569  // Hide by default
570  dateRangeWidget->setVisible(false);
571 
572  // Notify on change
573  connect(dateFrom, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged);
574  connect(dateTo, &QDateTimeEdit::dateChanged, this, &TransactionView::dateRangeChanged);
575 
576  return dateRangeWidget;
577 }
578 
580 {
582  return;
584  GUIUtil::StartOfDay(dateFrom->date()),
585  GUIUtil::StartOfDay(dateTo->date()).addDays(1));
586 }
587 
588 void TransactionView::focusTransaction(const QModelIndex &idx)
589 {
591  return;
592  QModelIndex targetIdx = transactionProxyModel->mapFromSource(idx);
593  transactionView->scrollTo(targetIdx);
594  transactionView->setCurrentIndex(targetIdx);
595  transactionView->setFocus();
596 }
597 
599 {
601  return;
602 
603  const QModelIndexList results = this->model->getTransactionTableModel()->match(
604  this->model->getTransactionTableModel()->index(0,0),
606  QString::fromStdString(txid.ToString()), -1);
607 
608  transactionView->setFocus();
609  transactionView->selectionModel()->clearSelection();
610  for (const QModelIndex& index : results) {
611  const QModelIndex targetIndex = transactionProxyModel->mapFromSource(index);
612  transactionView->selectionModel()->select(
613  targetIndex,
614  QItemSelectionModel::Rows | QItemSelectionModel::Select);
615  // Called once per destination to ensure all results are in view, unless
616  // transactions are not ordered by (ascending or descending) date.
617  transactionView->scrollTo(targetIndex);
618  // scrollTo() does not scroll far enough the first time when transactions
619  // are ordered by ascending date.
620  if (index == results[0]) transactionView->scrollTo(targetIndex);
621  }
622 }
623 
624 // Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text
625 bool TransactionView::eventFilter(QObject *obj, QEvent *event)
626 {
627  if (event->type() == QEvent::KeyPress)
628  {
629  QKeyEvent *ke = static_cast<QKeyEvent *>(event);
630  if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))
631  {
633  return true;
634  }
635  }
636  return QWidget::eventFilter(obj, event);
637 }
638 
639 // show/hide column Watch-only
640 void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
641 {
642  watchOnlyWidget->setVisible(fHaveWatchOnly);
643  transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
644 }
QVariant data(const QModelIndex &index, int role) const override
void addColumn(const QString &title, int column, int role=Qt::EditRole)
QDateTime StartOfDay(const QDate &date)
Returns the start-moment of the day in local time.
Definition: guiutil.cpp:912
TransactionRecord * index(interfaces::Wallet &wallet, const uint256 &cur_block_hash, const int idx)
void openThirdPartyTxUrl(QString url)
interfaces::Wallet & wallet() const
Definition: walletmodel.h:144
QWidget * createDateRangeWidget()
int lookupAddress(const QString &address) const
Dialog showing transaction details.
const PlatformStyle * m_platform_style
void PopupMenu(QMenu *menu, const QPoint &point, QAction *at_action)
Call QMenu::popup() only on supported QT_QPA_PLATFORM.
Definition: guiutil.cpp:905
QAction * abandonAction
void updateTransaction(const QString &hash, int status, bool showTransaction)
void bumpFee(bool checked)
void focusTransaction(const QModelIndex &)
void setTypeFilter(quint32 modes)
QIcon SingleColorIcon(const QString &filename) const
Colorize an icon (given filename) with the icon color.
QTableView * transactionView
const unsigned char * data() const
Definition: uint256.h:55
AddressTableModel * getAddressTableModel()
Export a Qt table model to a CSV file.
Transaction data, hex-encoded.
TransactionTableModel * parent
static bool parse(int unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
void chooseWatchonly(int idx)
int getDisplayUnit() const
Definition: optionsmodel.h:87
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */...
bool bumpFee(uint256 hash, uint256 &new_hash)
static quint32 TYPE(int type)
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
QDateTimeEdit * dateTo
const char * url
Definition: rpcconsole.cpp:62
void setModel(AddressTableModel *model)
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
Whole transaction as plain text.
void setDateRange(const QDateTime &from, const QDateTime &to)
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
virtual bool transactionCanBeAbandoned(const uint256 &txid)=0
Return whether transaction can be abandoned.
auto ExceptionSafeConnect(Sender sender, Signal signal, Receiver receiver, Slot method, Qt::ConnectionType type=Qt::AutoConnection)
A drop-in replacement of QObject::connect function (see: https://doc.qt.io/qt-5/qobject.html#connect-3), that guaranties that all exceptions are handled within the slot.
Definition: guiutil.h:386
bool hasEntryData(const QAbstractItemView *view, int column, int role)
Returns true if the specified field of the currently selected view entry is not empty.
Definition: guiutil.cpp:267
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Date and time this transaction was created.
std::string ToString() const
Definition: uint256.cpp:64
void updateWatchOnlyColumn(bool fHaveWatchOnly)
TransactionTableModel * getTransactionTableModel()
bool eventFilter(QObject *obj, QEvent *event) override
virtual bool transactionCanBeBumped(const uint256 &txid)=0
Return whether transaction can be bumped.
void copyEntryData(const QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.
Definition: guiutil.cpp:247
void setWatchOnlyFilter(WatchOnlyFilter filter)
Qt model of the address book in the core.
void setMinAmount(const CAmount &minimum)
void bumpedFee(const uint256 &txid)
TransactionFilterProxy * transactionProxyModel
QString getThirdPartyTxUrls() const
Definition: optionsmodel.h:88
QAction * copyLabelAction
QComboBox * watchOnlyWidget
QStringList SplitSkipEmptyParts(const QString &string, const SeparatorType &separator)
Splits the string into substrings wherever separator occurs, and returns the list of those strings...
Definition: guiutil.h:346
256-bit opaque blob.
Definition: uint256.h:124
void chooseDate(int idx)
void setModel(const QAbstractItemModel *model)
void setModel(WalletModel *model)
QLineEdit * amountWidget
QComboBox * typeWidget
Filter the transaction list according to pre-specified rules.
void setAddress(const QString &address)
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:51
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
Definition: guiutil.cpp:279
static const QString Receive
Specifies receive address.
Dialog for editing an address and associated information.
virtual bool haveWatchOnly()=0
Return whether wallet has watch only keys.
QFrame * dateRangeWidget
void notifyWatchonlyChanged(bool fHaveWatchonly)
Label of address related to transaction.
static const quint32 ALL_TYPES
Type filter bit field (all types)
void setSearchString(const QString &)
TransactionView(const PlatformStyle *platformStyle, QWidget *parent=nullptr)
QAction * copyAddressAction
void contextualMenu(const QPoint &)
void changeEvent(QEvent *e) override
Formatted amount, without brackets when unconfirmed.
void chooseType(int idx)
QAction * bumpFeeAction
QDateTimeEdit * dateFrom
void SetHex(const char *psz)
Definition: uint256.cpp:30
QModelIndex index(int row, int column, const QModelIndex &parent) const override
bool write()
Perform export of the model to CSV.
void doubleClicked(const QModelIndex &)
Type of address (Send or Receive)
WalletModel * model
OptionsModel * getOptionsModel()
virtual bool abandonTransaction(const uint256 &txid)=0
Abandon transaction.
Predefined combinations for certain default usage cases.
Definition: ui_interface.h:66
QComboBox * dateWidget
QLineEdit * search_widget