mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-03 20:21:34 +02:00
qt, refactor: Make AddressBookPage::deleteAction a local variable
This commit is contained in:
@ -116,22 +116,23 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
|
||||
QAction *copyAddressAction = new QAction(tr("&Copy Address"), this);
|
||||
QAction *copyLabelAction = new QAction(tr("Copy &Label"), this);
|
||||
QAction *editAction = new QAction(tr("&Edit"), this);
|
||||
deleteAction = new QAction(ui->deleteAddress->text(), this);
|
||||
|
||||
// Build context menu
|
||||
contextMenu = new QMenu(this);
|
||||
contextMenu->addAction(copyAddressAction);
|
||||
contextMenu->addAction(copyLabelAction);
|
||||
contextMenu->addAction(editAction);
|
||||
if(tab == SendingTab)
|
||||
if (tab == SendingTab) {
|
||||
QAction* deleteAction = new QAction(ui->deleteAddress->text(), this);
|
||||
contextMenu->addAction(deleteAction);
|
||||
connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteAddress_clicked);
|
||||
}
|
||||
contextMenu->addSeparator();
|
||||
|
||||
// Connect signals for context menu actions
|
||||
connect(copyAddressAction, &QAction::triggered, this, &AddressBookPage::on_copyAddress_clicked);
|
||||
connect(copyLabelAction, &QAction::triggered, this, &AddressBookPage::onCopyLabelAction);
|
||||
connect(editAction, &QAction::triggered, this, &AddressBookPage::onEditAction);
|
||||
connect(deleteAction, &QAction::triggered, this, &AddressBookPage::on_deleteAddress_clicked);
|
||||
|
||||
connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu);
|
||||
|
||||
@ -249,13 +250,11 @@ void AddressBookPage::selectionChanged()
|
||||
// In sending tab, allow deletion of selection
|
||||
ui->deleteAddress->setEnabled(true);
|
||||
ui->deleteAddress->setVisible(true);
|
||||
deleteAction->setEnabled(true);
|
||||
break;
|
||||
case ReceivingTab:
|
||||
// Deleting receiving addresses, however, is not allowed
|
||||
ui->deleteAddress->setEnabled(false);
|
||||
ui->deleteAddress->setVisible(false);
|
||||
deleteAction->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
ui->copyAddress->setEnabled(true);
|
||||
|
@ -55,7 +55,6 @@ private:
|
||||
QString returnValue;
|
||||
AddressBookSortFilterProxyModel *proxyModel;
|
||||
QMenu *contextMenu;
|
||||
QAction *deleteAction; // to be able to explicitly disable it
|
||||
QString newAddressToSelect;
|
||||
|
||||
private Q_SLOTS:
|
||||
|
Reference in New Issue
Block a user