23#include <QTextDocument>
26 QDialog(parent,
GUIUtil::dialog_flags),
28 platformStyle(_platformStyle)
33 ui->clearButton->setIcon(QIcon());
34 ui->receiveButton->setIcon(QIcon());
35 ui->showRequestButton->setIcon(QIcon());
36 ui->removeRequestButton->setIcon(QIcon());
38 ui->clearButton->setIcon(_platformStyle->SingleColorIcon(
":/icons/remove"));
39 ui->receiveButton->setIcon(_platformStyle->SingleColorIcon(
":/icons/receiving_addresses"));
40 ui->showRequestButton->setIcon(_platformStyle->SingleColorIcon(
":/icons/eye"));
41 ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(
":/icons/remove"));
56 tableView->verticalHeader()->hide();
57 tableView->setAlternatingRowColors(
true);
58 tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
59 tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
62 if (!tableView->horizontalHeader()->restoreState(settings.value(
"RecentRequestsViewHeaderState").toByteArray())) {
67 tableView->horizontalHeader()->setStretchLastSection(
true);
85 connect(tableView->selectionModel(),
86 &QItemSelectionModel::selectionChanged,
this,
90 auto add_address_type = [&](
OutputType type,
const QString& text,
const QString& tooltip) {
93 ui->
addressType->setItemData(index, tooltip, Qt::ToolTipRole);
96 add_address_type(
OutputType::LEGACY, tr(
"Base58 (Legacy)"), tr(
"Not recommended due to higher fees and less protection against typos."));
97 add_address_type(
OutputType::P2SH_SEGWIT, tr(
"Base58 (P2SH-SegWit)"), tr(
"Generates an address compatible with older wallets."));
98 add_address_type(
OutputType::BECH32, tr(
"Bech32 (SegWit)"), tr(
"Generates a native segwit address (BIP-173). Some old wallets don't support it."));
100 add_address_type(
OutputType::BECH32M, tr(
"Bech32m (Taproot)"), tr(
"Bech32m (BIP-350) is an upgrade to Bech32, wallet support is still limited."));
116 settings.setValue(
"RecentRequestsViewHeaderState",
ui->
recentRequestsView->horizontalHeader()->saveState());
164 dialog->setAttribute(Qt::WA_DeleteOnClose);
174 QMessageBox::critical(
this, windowTitle(),
175 tr(
"Could not unlock wallet."),
176 QMessageBox::Ok, QMessageBox::Ok);
179 QMessageBox::critical(
this, windowTitle(),
180 tr(
"Could not generate new %1 address").arg(QString::fromStdString(
FormatOutputType(address_type))),
181 QMessageBox::Ok, QMessageBox::Ok);
198 dialog->setAttribute(Qt::WA_DeleteOnClose);
216 for (
const QModelIndex& index : selection) {
226 if(selection.empty())
229 QModelIndex firstIndex = selection.at(0);
236 return QModelIndex();
238 if(selection.empty())
239 return QModelIndex();
241 QModelIndex firstIndex = selection.at(0);
249 if (!firstIndex.isValid()) {
259 if (!sel.isValid()) {
277 if (!sel.isValid()) {
290 if (!sel.isValid()) {
EditStatus getEditStatus() const
@ WALLET_UNLOCK_FAILURE
Wallet could not be unlocked to create new receiving address.
@ NO_CHANGES
No changes were made during edit operation.
@ INVALID_ADDRESS
Unparseable address.
@ KEY_GENERATION_FAILURE
Generating a new public key for a receiving address failed.
@ DUPLICATE_ADDRESS
Address already in address book.
QString addRow(const QString &type, const QString &label, const QString &address, const OutputType address_type)
static const QString Receive
Specifies receive address.
void setDisplayUnit(BitcoinUnit new_unit)
Change unit used to display amount.
void clear()
Make field empty and ready for new input.
void displayUnitChanged(BitcoinUnit unit)
BitcoinUnit getDisplayUnit() const
Dialog for requesting payment of bitcoins.
Ui::ReceiveCoinsDialog * ui
void on_removeRequestButton_clicked()
@ AMOUNT_MINIMUM_COLUMN_WIDTH
QAction * copyMessageAction
void on_showRequestButton_clicked()
void on_recentRequestsView_doubleClicked(const QModelIndex &index)
QAction * copyLabelAction
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)
QAction * copyAmountAction
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 / bitcoin: 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)
BitcoinAmountField * reqAmount
void setupUi(QDialog *ReceiveCoinsDialog)
QPushButton * removeRequestButton
QPushButton * receiveButton
QPushButton * showRequestButton
QTableView * recentRequestsView
QPushButton * clearButton
Interface to Bitcoin wallet from Qt view code.
RecentRequestsTableModel * getRecentRequestsTableModel() const
AddressTableModel * getAddressTableModel() const
interfaces::Wallet & wallet() const
OptionsModel * getOptionsModel() const
void canGetAddressesChanged()
virtual OutputType getDefaultAddressType()=0
virtual bool taprootEnabled()=0
virtual bool canGetAddresses()=0
Utility functions used by the Bitcoin Qt UI.
QString formatBitcoinURI(const SendCoinsRecipient &info)
void setClipboard(const QString &str)
const std::string & FormatOutputType(OutputType type)