22 #include <QDateTimeEdit>
23 #include <QDesktopServices>
24 #include <QDoubleValidator>
25 #include <QHBoxLayout>
26 #include <QHeaderView>
32 #include <QSignalMapper>
35 #include <QVBoxLayout>
38 QWidget(parent), model(0), transactionProxyModel(0),
42 setContentsMargins(0,0,0,0);
44 QHBoxLayout *hlayout =
new QHBoxLayout();
45 hlayout->setContentsMargins(0,0,0,0);
47 hlayout->setSpacing(5);
48 hlayout->addSpacing(26);
50 hlayout->setSpacing(0);
51 hlayout->addSpacing(23);
88 #if QT_VERSION >= 0x040700
89 addressWidget->setPlaceholderText(tr(
"Enter address or label to search"));
94 #if QT_VERSION >= 0x040700
102 amountWidget->setValidator(
new QDoubleValidator(0, 1e20, 8,
this));
105 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
106 vlayout->setContentsMargins(0,0,0,0);
107 vlayout->setSpacing(0);
109 QTableView *view =
new QTableView(
this);
110 vlayout->addLayout(hlayout);
112 vlayout->addWidget(view);
113 vlayout->setSpacing(0);
114 int width = view->verticalScrollBar()->sizeHint().width();
117 hlayout->addSpacing(width+2);
119 hlayout->addSpacing(width);
122 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
123 view->setTabKeyNavigation(
false);
124 view->setContextMenuPolicy(Qt::CustomContextMenu);
129 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
130 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
131 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
132 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
133 QAction *editLabelAction =
new QAction(tr(
"Edit label"),
this);
134 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
155 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
157 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
158 connect(copyLabelAction, SIGNAL(triggered()),
this, SLOT(
copyLabel()));
159 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
160 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
161 connect(editLabelAction, SIGNAL(triggered()),
this, SLOT(
editLabel()));
162 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
182 transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
198 for (
int i = 0; i < listUrls.size(); ++i)
200 QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host();
203 QAction *thirdPartyTxUrlAction =
new QAction(host,
this);
219 QDate current = QDate::currentDate();
235 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
237 QDateTime(startOfWeek),
243 QDateTime(QDate(current.year(), current.month(), 1)),
248 QDateTime(QDate(current.year(), current.month()-1, 1)),
249 QDateTime(QDate(current.year(), current.month(), 1)));
253 QDateTime(QDate(current.year(), 1, 1)),
282 qint64 amount_parsed = 0;
297 tr(
"Export Transaction History"), QString(),
298 tr(
"Comma separated file (*.csv)"), NULL);
300 if (filename.isNull())
315 if(!writer.
write()) {
316 emit
message(tr(
"Exporting Failed"), tr(
"There was an error trying to save the transaction history to %1.").arg(filename),
320 emit
message(tr(
"Exporting Successful"), tr(
"The transaction history was successfully saved to %1.").arg(filename),
358 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
359 if(!selection.isEmpty())
365 if(address.isEmpty())
376 QModelIndex modelIdx = addressBook->
index(idx, 0, QModelIndex());
404 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
405 if(!selection.isEmpty())
416 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
417 if(!selection.isEmpty())
427 layout->setContentsMargins(0,0,0,0);
428 layout->addSpacing(23);
429 layout->addWidget(
new QLabel(tr(
"Range:")));
432 dateFrom->setDisplayFormat(
"dd/MM/yy");
435 dateFrom->setDate(QDate::currentDate().addDays(-7));
437 layout->addWidget(
new QLabel(tr(
"to")));
439 dateTo =
new QDateTimeEdit(
this);
440 dateTo->setDisplayFormat(
"dd/MM/yy");
441 dateTo->setCalendarPopup(
true);
442 dateTo->setMinimumWidth(100);
443 dateTo->setDate(QDate::currentDate());
444 layout->addWidget(
dateTo);
445 layout->addStretch();
463 QDateTime(
dateTo->date()).addDays(1));
480 QWidget::resizeEvent(event);
void stretchColumnWidth(int column)
void changedPrefix(const QString &prefix)
TransactionView(QWidget *parent=0)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
QModelIndex index(int row, int column, const QModelIndex &parent) const
void openThirdPartyTxUrl(QString url)
QWidget * createDateRangeWidget()
Dialog showing transaction details.
int lookupAddress(const QString &address) const
void focusTransaction(const QModelIndex &)
void setTypeFilter(quint32 modes)
QTableView * transactionView
AddressTableModel * getAddressTableModel()
Export a Qt table model to a CSV file.
void setAddressPrefix(const QString &addrPrefix)
static quint32 TYPE(int type)
void setModel(AddressTableModel *model)
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
virtual void resizeEvent(QResizeEvent *event)
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
QSignalMapper * mapperThirdPartyTxUrls
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.
Is transaction confirmed?
Makes a QTableView last column feel as if it was being resized from its left border.
void changedAmount(const QString &amount)
void setMinAmount(qint64 minimum)
Date and time this transaction was created.
TransactionTableModel * getTransactionTableModel()
Qt model of the address book in the core.
TransactionFilterProxy * transactionProxyModel
void setModel(const QAbstractItemModel *model)
void setModel(WalletModel *model)
QVariant data(const QModelIndex &index, int role) const
Filter the transaction list according to pre-specified rules.
void setAddress(const QString &address)
Interface to Bitcoin wallet from Qt view code.
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 ...
static const QString Receive
Specifies receive address.
Dialog for editing an address and associated information.
static bool parse(int unit, const QString &value, qint64 *val_out)
Parse string to coin amount.
Label of address related to transaction.
static const quint32 ALL_TYPES
Type filter bit field (all types)
QLineEdit * addressWidget
void contextualMenu(const QPoint &)
Formatted amount, without brackets when unconfirmed.
void copyEntryData(QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.
GUIUtil::TableViewLastColumnResizingFixer * columnResizingFixer
bool write()
Perform export of the model to CSV.
void doubleClicked(const QModelIndex &)
Type of address (Send or Receive)
OptionsModel * getOptionsModel()
Predefined combinations for certain default usage cases.
QString getThirdPartyTxUrls()