20 #include <QMessageBox> 23 #include <QTextDocument> 28 platformStyle(_platformStyle)
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());
159 case AddressTableModel::EditStatus::OK: {
164 dialog->setAttribute(Qt::WA_DeleteOnClose);
165 dialog->setModel(
model);
166 dialog->setInfo(info);
173 case AddressTableModel::EditStatus::WALLET_UNLOCK_FAILURE:
174 QMessageBox::critical(
this, windowTitle(),
175 tr(
"Could not unlock wallet."),
176 QMessageBox::Ok, QMessageBox::Ok);
178 case AddressTableModel::EditStatus::KEY_GENERATION_FAILURE:
179 QMessageBox::critical(
this, windowTitle(),
180 tr(
"Could not generate new %1 address").arg(QString::fromStdString(
FormatOutputType(address_type))),
181 QMessageBox::Ok, QMessageBox::Ok);
184 case AddressTableModel::EditStatus::INVALID_ADDRESS:
185 case AddressTableModel::EditStatus::DUPLICATE_ADDRESS:
186 case AddressTableModel::EditStatus::NO_CHANGES:
197 dialog->
setInfo(submodel->
entry(index.row()).recipient);
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()) {
295 const QString address = submodel->
entry(sel.row()).recipient.address;
Model for list of recently generated payment requests / bitcoin: URIs.
void addNewRequest(const SendCoinsRecipient &recipient)
Dialog for requesting payment of bitcoins.
virtual bool canGetAddresses()=0
OptionsModel * getOptionsModel() const
interfaces::Wallet & wallet() const
Utility functions used by the Bitcoin Qt UI.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
void canGetAddressesChanged()
virtual OutputType getDefaultAddressType()=0
QPushButton * receiveButton
void recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
BitcoinAmountField * reqAmount
void setupUi(QDialog *ReceiveCoinsDialog)
BitcoinUnit getDisplayUnit() const
QAction * copyMessageAction
Ui::ReceiveCoinsDialog * ui
QString formatBitcoinURI(const SendCoinsRecipient &info)
QModelIndex selectedRow()
QString addRow(const QString &type, const QString &label, const QString &address, const OutputType address_type)
QPushButton * showRequestButton
constexpr auto dialog_flags
void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
void setModel(WalletModel *model)
QPushButton * clearButton
void copyColumnToClipboard(int column)
RecentRequestsTableModel * getRecentRequestsTableModel() const
void displayUnitChanged(BitcoinUnit unit)
QAction * copyLabelAction
void setClipboard(const QString &str)
void on_recentRequestsView_doubleClicked(const QModelIndex &index)
void setInfo(const SendCoinsRecipient &info)
SendCoinsRecipient recipient
const RecentRequestEntry & entry(int row) const
ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent=nullptr)
QTableView * recentRequestsView
const std::string & FormatOutputType(OutputType type)
void on_removeRequestButton_clicked()
virtual bool taprootEnabled()=0
void on_receiveButton_clicked()
Interface to Bitcoin wallet from Qt view code.
void clear()
Make field empty and ready for new input.
void on_showRequestButton_clicked()
static const QString Receive
Specifies receive address.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
QPushButton * removeRequestButton
void showMenu(const QPoint &point)
AddressTableModel * getAddressTableModel() const
EditStatus getEditStatus() const
void setDisplayUnit(BitcoinUnit new_unit)
Change unit used to display amount.
QAction * copyAmountAction
void setModel(WalletModel *model)