5 #if defined(HAVE_CONFIG_H)    10 #include <qt/forms/ui_addressbookpage.h>    21 #include <QMessageBox>    22 #include <QSortFilterProxyModel>    30         : QSortFilterProxyModel(parent)
    33         setDynamicSortFilter(
true);
    34         setFilterCaseSensitivity(Qt::CaseInsensitive);
    35         setSortCaseSensitivity(Qt::CaseInsensitive);
    41         auto model = sourceModel();
    50         if (filterRegExp().indexIn(model->data(address).toString()) < 0 &&
    51             filterRegExp().indexIn(model->data(label).toString()) < 0) {
    69         ui->newAddress->setIcon(QIcon());
    70         ui->copyAddress->setIcon(QIcon());
    71         ui->deleteAddress->setIcon(QIcon());
    72         ui->exportButton->setIcon(QIcon());
    85         case SendingTab: setWindowTitle(tr(
"Choose the address to send coins to")); 
break;
    86         case ReceivingTab: setWindowTitle(tr(
"Choose the address to receive coins with")); 
break;
    88         connect(
ui->tableView, &QTableView::doubleClicked, 
this, &QDialog::accept);
    89         ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    90         ui->tableView->setFocus();
    91         ui->closeButton->setText(tr(
"C&hoose"));
    92         ui->exportButton->hide();
    97         case SendingTab: setWindowTitle(tr(
"Sending addresses")); 
break;
    98         case ReceivingTab: setWindowTitle(tr(
"Receiving addresses")); 
break;
   105         ui->labelExplanation->setText(tr(
"These are your BSHA3 addresses for sending payments. Always check the amount and the receiving address before sending coins."));
   106         ui->deleteAddress->setVisible(
true);
   107         ui->newAddress->setVisible(
true);
   110         ui->labelExplanation->setText(tr(
"These are your BSHA3 addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
   111         ui->deleteAddress->setVisible(
false);
   112         ui->newAddress->setVisible(
false);
   117     QAction *copyAddressAction = 
new QAction(tr(
"&Copy Address"), 
this);
   118     QAction *copyLabelAction = 
new QAction(tr(
"Copy &Label"), 
this);
   119     QAction *editAction = 
new QAction(tr(
"&Edit"), 
this);
   139     connect(
ui->closeButton, &QPushButton::clicked, 
this, &QDialog::accept);
   149     this->
model = _model;
   157     connect(
ui->searchLineEdit, &QLineEdit::textChanged, 
proxyModel, &QSortFilterProxyModel::setFilterWildcard);
   160     ui->tableView->sortByColumn(0, Qt::AscendingOrder);
   166     connect(
ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
   190     if(!
ui->tableView->selectionModel())
   192     QModelIndexList indexes = 
ui->tableView->selectionModel()->selectedRows();
   193     if(indexes.isEmpty())
   201     QModelIndex origIndex = 
proxyModel->mapToSource(indexes.at(0));
   225     QTableView *table = 
ui->tableView;
   226     if(!table->selectionModel())
   229     QModelIndexList indexes = table->selectionModel()->selectedRows();
   230     if(!indexes.isEmpty())
   232         table->model()->removeRow(indexes.at(0).row());
   239     QTableView *table = 
ui->tableView;
   240     if(!table->selectionModel())
   243     if(table->selectionModel()->hasSelection())
   249             ui->deleteAddress->setEnabled(
true);
   250             ui->deleteAddress->setVisible(
true);
   255             ui->deleteAddress->setEnabled(
false);
   256             ui->deleteAddress->setVisible(
false);
   260         ui->copyAddress->setEnabled(
true);
   264         ui->deleteAddress->setEnabled(
false);
   265         ui->copyAddress->setEnabled(
false);
   271     QTableView *table = 
ui->tableView;
   272     if(!table->selectionModel() || !table->model())
   278     for (
const QModelIndex& index : indexes) {
   279         QVariant address = table->model()->data(index);
   289     QDialog::done(retval);
   296         tr(
"Export Address List"), QString(),
   297         tr(
"Comma separated file (*.csv)"), 
nullptr);
   299     if (filename.isNull())
   309     if(!writer.
write()) {
   310         QMessageBox::critical(
this, tr(
"Exporting Failed"),
   311             tr(
"There was an error trying to save the address list to %1. Please try again.").arg(filename));
   317     QModelIndex index = 
ui->tableView->indexAt(point);
   330         ui->tableView->setFocus();
   331         ui->tableView->selectRow(idx.row());
 void on_newAddress_clicked()
Create a new address for receiving coins and / or add a new address book entry. 
 
void onCopyLabelAction()
Copy label of currently selected address entry to clipboard (no button) 
 
void addColumn(const QString &title, int column, int role=Qt::EditRole)
 
QModelIndex index(int row, int column, const QModelIndex &parent) const
 
void setModel(AddressTableModel *model)
 
void onEditAction()
Edit currently selected address entry (no button) 
 
AddressTableModel * model
 
void on_exportButton_clicked()
Export button clicked. 
 
Open address book for editing. 
 
Open address book to pick address. 
 
Export a Qt table model to a CSV file. 
 
QString newAddressToSelect
 
static const QString Send
Specifies send address. 
 
AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent=0)
 
void selectNewAddress(const QModelIndex &parent, int begin, int)
New entry/entries were added to address table. 
 
void setModel(AddressTableModel *model)
 
AddressBookSortFilterProxyModel * proxyModel
 
AddressBookSortFilterProxyModel(const QString &type, QObject *parent)
 
void on_copyAddress_clicked()
Copy address of currently selected address entry to clipboard. 
 
Widget that shows a list of sending or receiving addresses. 
 
Qt model of the address book in the core. 
 
void selectionChanged()
Set button states based on selected tab and selection. 
 
void setModel(const QAbstractItemModel *model)
 
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. 
 
bool filterAcceptsRow(int row, const QModelIndex &parent) const
 
QString getAddress() const
 
void copyEntryData(QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard. 
 
void contextualMenu(const QPoint &point)
Spawn contextual menu (right mouse menu) for address book entry. 
 
void on_deleteAddress_clicked()
Delete currently selected address entry. 
 
bool write()
Perform export of the model to CSV. 
 
Type of address (Send or Receive)