7#include <qt/forms/ui_receivecoinsdialog.h>
21#include <QTextDocument>
26 columnResizingFixer(nullptr), model(nullptr),
27 platformStyle(_platformStyle) {
31 ui->clearButton->setIcon(QIcon());
32 ui->receiveButton->setIcon(QIcon());
33 ui->showRequestButton->setIcon(QIcon());
34 ui->removeRequestButton->setIcon(QIcon());
36 ui->clearButton->setIcon(
38 ui->receiveButton->setIcon(
40 ui->showRequestButton->setIcon(
42 ui->removeRequestButton->setIcon(
47 QAction *copyURIAction =
new QAction(tr(
"Copy URI"),
this);
48 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
49 QAction *copyMessageAction =
new QAction(tr(
"Copy message"),
this);
50 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
60 connect(
ui->recentRequestsView, &QWidget::customContextMenuRequested,
this,
62 connect(copyURIAction, &QAction::triggered,
this,
64 connect(copyLabelAction, &QAction::triggered,
this,
66 connect(copyMessageAction, &QAction::triggered,
this,
68 connect(copyAmountAction, &QAction::triggered,
this,
71 connect(
ui->clearButton, &QPushButton::clicked,
this,
85 QTableView *tableView =
ui->recentRequestsView;
87 tableView->verticalHeader()->hide();
88 tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
90 tableView->setAlternatingRowColors(
true);
91 tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
92 tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
100 connect(tableView->selectionModel(),
101 &QItemSelectionModel::selectionChanged,
this,
125 ui->reqAmount->clear();
126 ui->reqLabel->setText(
"");
127 ui->reqMessage->setText(
"");
141 ui->reqAmount->setDisplayUnit(
153 QString label =
ui->reqLabel->text();
157 label,
"", address_type);
160 case AddressTableModel::EditStatus::OK: {
163 ui->reqMessage->text());
165 dialog->setAttribute(Qt::WA_DeleteOnClose);
174 case AddressTableModel::EditStatus::WALLET_UNLOCK_FAILURE:
175 QMessageBox::critical(
this, windowTitle(),
176 tr(
"Could not unlock wallet."),
177 QMessageBox::Ok, QMessageBox::Ok);
179 case AddressTableModel::EditStatus::KEY_GENERATION_FAILURE:
180 QMessageBox::critical(
this, windowTitle(),
181 tr(
"Could not generate new %1 address")
182 .arg(QString::fromStdString(
184 QMessageBox::Ok, QMessageBox::Ok);
187 case AddressTableModel::EditStatus::INVALID_ADDRESS:
188 case AddressTableModel::EditStatus::DUPLICATE_ADDRESS:
189 case AddressTableModel::EditStatus::NO_CHANGES:
196 const QModelIndex &index) {
202 dialog->setAttribute(Qt::WA_DeleteOnClose);
207 const QItemSelection &selected,
const QItemSelection &deselected) {
210 !
ui->recentRequestsView->selectionModel()->selectedRows().isEmpty();
211 ui->showRequestButton->setEnabled(enable);
212 ui->removeRequestButton->setEnabled(enable);
217 !
ui->recentRequestsView->selectionModel()) {
220 QModelIndexList selection =
221 ui->recentRequestsView->selectionModel()->selectedRows();
223 for (
const QModelIndex &index : selection) {
230 !
ui->recentRequestsView->selectionModel()) {
233 QModelIndexList selection =
234 ui->recentRequestsView->selectionModel()->selectedRows();
235 if (selection.empty()) {
239 QModelIndex firstIndex = selection.at(0);
241 firstIndex.row(), selection.length(), firstIndex.parent());
247 QWidget::resizeEvent(event);
253 !
ui->recentRequestsView->selectionModel()) {
254 return QModelIndex();
256 QModelIndexList selection =
257 ui->recentRequestsView->selectionModel()->selectedRows();
258 if (selection.empty()) {
259 return QModelIndex();
262 QModelIndex firstIndex = selection.at(0);
269 if (!firstIndex.isValid()) {
273 ->
index(firstIndex.row(), column)
289 if (!sel.isValid()) {
EditStatus getEditStatus() const
QString addRow(const QString &type, const QString &label, const QString &address, const OutputType address_type)
static const QString Receive
Specifies receive address.
Makes a QTableView last column feel as if it was being resized from its left border.
void stretchColumnWidth(int column)
int getDisplayUnit() const
void displayUnitChanged(int unit)
Dialog for requesting payment of bitcoins.
Ui::ReceiveCoinsDialog * ui
void on_removeRequestButton_clicked()
@ AMOUNT_MINIMUM_COLUMN_WIDTH
void on_showRequestButton_clicked()
void on_recentRequestsView_doubleClicked(const QModelIndex &index)
GUIUtil::TableViewLastColumnResizingFixer * columnResizingFixer
void recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void setModel(WalletModel *model)
void showMenu(const QPoint &point)
void on_receiveButton_clicked()
ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent=nullptr)
virtual void resizeEvent(QResizeEvent *event) override
QModelIndex selectedRow()
void copyColumnToClipboard(int column)
void setModel(WalletModel *model)
void setInfo(const SendCoinsRecipient &info)
SendCoinsRecipient recipient
Model for list of recently generated payment requests / bitcoincash: URIs.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
const RecentRequestEntry & entry(int row) const
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
void addNewRequest(const SendCoinsRecipient &recipient)
Interface to Bitcoin wallet from Qt view code.
AddressTableModel * getAddressTableModel()
OptionsModel * getOptionsModel()
interfaces::Wallet & wallet() const
RecentRequestsTableModel * getRecentRequestsTableModel()
void canGetAddressesChanged()
virtual bool canGetAddresses() const =0
virtual OutputType getDefaultAddressType()=0
QString formatBitcoinURI(const SendCoinsRecipient &info)
void setClipboard(const QString &str)
const std::string & FormatOutputType(OutputType type)