| 56 | }; |
| 57 | |
| 58 | AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, Tabs _tab, QWidget *parent) : |
| 59 | QDialog(parent, GUIUtil::dialog_flags), |
| 60 | ui(new Ui::AddressBookPage), |
| 61 | model(nullptr), |
| 62 | mode(_mode), |
| 63 | tab(_tab) |
| 64 | { |
| 65 | ui->setupUi(this); |
| 66 | |
| 67 | if (!platformStyle->getImagesOnButtons()) { |
| 68 | ui->newAddress->setIcon(QIcon()); |
| 69 | ui->copyAddress->setIcon(QIcon()); |
| 70 | ui->deleteAddress->setIcon(QIcon()); |
| 71 | ui->exportButton->setIcon(QIcon()); |
| 72 | } else { |
| 73 | ui->newAddress->setIcon(platformStyle->SingleColorIcon(":/icons/add")); |
| 74 | ui->copyAddress->setIcon(platformStyle->SingleColorIcon(":/icons/editcopy")); |
| 75 | ui->deleteAddress->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); |
| 76 | ui->exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export")); |
| 77 | } |
| 78 | |
| 79 | switch(mode) |
| 80 | { |
| 81 | case ForSelection: |
| 82 | switch(tab) |
| 83 | { |
| 84 | case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break; |
| 85 | case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break; |
| 86 | } |
| 87 | connect(ui->tableView, &QTableView::doubleClicked, this, &QDialog::accept); |
| 88 | ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); |
| 89 | ui->tableView->setFocus(); |
| 90 | ui->closeButton->setText(tr("C&hoose")); |
| 91 | ui->exportButton->hide(); |
| 92 | break; |
| 93 | case ForEditing: |
| 94 | switch(tab) |
| 95 | { |
| 96 | case SendingTab: setWindowTitle(tr("Sending addresses")); break; |
| 97 | case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break; |
| 98 | } |
| 99 | break; |
| 100 | } |
| 101 | switch(tab) |
| 102 | { |
| 103 | case SendingTab: |
| 104 | ui->labelExplanation->setText(tr("These are your %1 addresses for sending payments. Always check the amount and the receiving address before sending coins.").arg("Liquid")); |
| 105 | ui->deleteAddress->setVisible(true); |
| 106 | ui->newAddress->setVisible(true); |
| 107 | break; |
| 108 | case ReceivingTab: |
| 109 | ui->labelExplanation->setText(tr("These are your %1 addresses for receiving payments. Use the 'Create new receiving address' button in the receive tab to create new addresses.\nSigning is only possible with addresses of the type 'legacy'.").arg("Liquid")); |
| 110 | ui->deleteAddress->setVisible(false); |
| 111 | ui->newAddress->setVisible(false); |
| 112 | break; |
| 113 | } |
| 114 | |
| 115 | // Build context menu |
nothing calls this directly
no test coverage detected