Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard shortcuts to context menus #362

Merged
merged 3 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,

// Build context menu
contextMenu = new QMenu(this);
contextMenu->addAction(tr("Copy Address"), this, &AddressBookPage::on_copyAddress_clicked);
contextMenu->addAction(tr("Copy Label"), this, &AddressBookPage::onCopyLabelAction);
contextMenu->addAction(tr("Edit"), this, &AddressBookPage::onEditAction);
contextMenu->addAction(tr("&Copy Address"), this, &AddressBookPage::on_copyAddress_clicked);
contextMenu->addAction(tr("Copy &Label"), this, &AddressBookPage::onCopyLabelAction);
contextMenu->addAction(tr("&Edit"), this, &AddressBookPage::onEditAction);

if (tab == SendingTab) {
contextMenu->addAction(tr("Delete"), this, &AddressBookPage::on_deleteAddress_clicked);
contextMenu->addAction(tr("&Delete"), this, &AddressBookPage::on_deleteAddress_clicked);
}

connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu);
Expand Down
12 changes: 6 additions & 6 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m

// context menu
contextMenu = new QMenu(this);
contextMenu->addAction(tr("Copy address"), this, &CoinControlDialog::copyAddress);
contextMenu->addAction(tr("Copy label"), this, &CoinControlDialog::copyLabel);
contextMenu->addAction(tr("Copy amount"), this, &CoinControlDialog::copyAmount);
copyTransactionHashAction = contextMenu->addAction(tr("Copy transaction ID"), this, &CoinControlDialog::copyTransactionHash);
contextMenu->addAction(tr("&Copy address"), this, &CoinControlDialog::copyAddress);
contextMenu->addAction(tr("Copy &label"), this, &CoinControlDialog::copyLabel);
contextMenu->addAction(tr("Copy &amount"), this, &CoinControlDialog::copyAmount);
copyTransactionHashAction = contextMenu->addAction(tr("Copy transaction &ID"), this, &CoinControlDialog::copyTransactionHash);
contextMenu->addSeparator();
lockAction = contextMenu->addAction(tr("Lock unspent"), this, &CoinControlDialog::lockCoin);
unlockAction = contextMenu->addAction(tr("Unlock unspent"), this, &CoinControlDialog::unlockCoin);
lockAction = contextMenu->addAction(tr("L&ock unspent"), this, &CoinControlDialog::lockCoin);
unlockAction = contextMenu->addAction(tr("&Unlock unspent"), this, &CoinControlDialog::unlockCoin);
connect(ui->treeWidget, &QWidget::customContextMenuRequested, this, &CoinControlDialog::showMenu);

// clipboard actions
Expand Down
4 changes: 2 additions & 2 deletions src/qt/qrimagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ QRImageWidget::QRImageWidget(QWidget *parent):
QLabel(parent), contextMenu(nullptr)
{
contextMenu = new QMenu(this);
contextMenu->addAction(tr("Save Image…"), this, &QRImageWidget::saveImage);
contextMenu->addAction(tr("Copy Image"), this, &QRImageWidget::copyImage);
contextMenu->addAction(tr("&Save Image…"), this, &QRImageWidget::saveImage);
contextMenu->addAction(tr("&Copy Image"), this, &QRImageWidget::copyImage);
}

bool QRImageWidget::setQR(const QString& data, const QString& text)
Expand Down
10 changes: 5 additions & 5 deletions src/qt/receivecoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid

// context menu
contextMenu = new QMenu(this);
contextMenu->addAction(tr("Copy URI"), this, &ReceiveCoinsDialog::copyURI);
contextMenu->addAction(tr("Copy address"), this, &ReceiveCoinsDialog::copyAddress);
copyLabelAction = contextMenu->addAction(tr("Copy label"), this, &ReceiveCoinsDialog::copyLabel);
copyMessageAction = contextMenu->addAction(tr("Copy message"), this, &ReceiveCoinsDialog::copyMessage);
copyAmountAction = contextMenu->addAction(tr("Copy amount"), this, &ReceiveCoinsDialog::copyAmount);
contextMenu->addAction(tr("Copy &URI"), this, &ReceiveCoinsDialog::copyURI);
contextMenu->addAction(tr("&Copy address"), this, &ReceiveCoinsDialog::copyAddress);
copyLabelAction = contextMenu->addAction(tr("Copy &label"), this, &ReceiveCoinsDialog::copyLabel);
copyMessageAction = contextMenu->addAction(tr("Copy &message"), this, &ReceiveCoinsDialog::copyMessage);
copyAmountAction = contextMenu->addAction(tr("Copy &amount"), this, &ReceiveCoinsDialog::copyAmount);
connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu);

connect(ui->clearButton, &QPushButton::clicked, this, &ReceiveCoinsDialog::clear);
Expand Down
12 changes: 6 additions & 6 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,11 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_

// create peer table context menu
peersTableContextMenu = new QMenu(this);
peersTableContextMenu->addAction(tr("Disconnect"), this, &RPCConsole::disconnectSelectedNode);
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 hour"), [this] { banSelectedNode(60 * 60); });
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 day"), [this] { banSelectedNode(60 * 60 * 24); });
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 week"), [this] { banSelectedNode(60 * 60 * 24 * 7); });
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 year"), [this] { banSelectedNode(60 * 60 * 24 * 365); });
peersTableContextMenu->addAction(tr("&Disconnect"), this, &RPCConsole::disconnectSelectedNode);
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 &hour"), [this] { banSelectedNode(60 * 60); });
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 d&ay"), [this] { banSelectedNode(60 * 60 * 24); });
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 &week"), [this] { banSelectedNode(60 * 60 * 24 * 7); });
peersTableContextMenu->addAction(ts.ban_for + " " + tr("1 &year"), [this] { banSelectedNode(60 * 60 * 24 * 365); });
connect(ui->peerWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showPeersTableContextMenu);

// peer table signal handling - update peer details when selecting new node
Expand All @@ -701,7 +701,7 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_

// create ban table context menu
banTableContextMenu = new QMenu(this);
banTableContextMenu->addAction(tr("Unban"), this, &RPCConsole::unbanSelectedNode);
banTableContextMenu->addAction(tr("&Unban"), this, &RPCConsole::unbanSelectedNode);
connect(ui->banlistWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showBanTableContextMenu);

// ban table signal handling - clear peer details when clicking a peer in the ban table
Expand Down
20 changes: 10 additions & 10 deletions src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,19 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa

contextMenu = new QMenu(this);
contextMenu->setObjectName("contextMenu");
copyAddressAction = contextMenu->addAction(tr("Copy address"), this, &TransactionView::copyAddress);
copyLabelAction = contextMenu->addAction(tr("Copy label"), this, &TransactionView::copyLabel);
contextMenu->addAction(tr("Copy amount"), this, &TransactionView::copyAmount);
contextMenu->addAction(tr("Copy transaction ID"), this, &TransactionView::copyTxID);
contextMenu->addAction(tr("Copy raw transaction"), this, &TransactionView::copyTxHex);
contextMenu->addAction(tr("Copy full transaction details"), this, &TransactionView::copyTxPlainText);
contextMenu->addAction(tr("Show transaction details"), this, &TransactionView::showDetails);
copyAddressAction = contextMenu->addAction(tr("&Copy address"), this, &TransactionView::copyAddress);
copyLabelAction = contextMenu->addAction(tr("Copy &label"), this, &TransactionView::copyLabel);
contextMenu->addAction(tr("Copy &amount"), this, &TransactionView::copyAmount);
contextMenu->addAction(tr("Copy transaction &ID"), this, &TransactionView::copyTxID);
contextMenu->addAction(tr("Copy &raw transaction"), this, &TransactionView::copyTxHex);
contextMenu->addAction(tr("Copy full transaction &details"), this, &TransactionView::copyTxPlainText);
contextMenu->addAction(tr("&Show transaction details"), this, &TransactionView::showDetails);
contextMenu->addSeparator();
bumpFeeAction = contextMenu->addAction(tr("Increase transaction fee"));
bumpFeeAction = contextMenu->addAction(tr("Increase transaction &fee"));
GUIUtil::ExceptionSafeConnect(bumpFeeAction, &QAction::triggered, this, &TransactionView::bumpFee);
bumpFeeAction->setObjectName("bumpFeeAction");
abandonAction = contextMenu->addAction(tr("Abandon transaction"), this, &TransactionView::abandonTx);
contextMenu->addAction(tr("Edit address label"), this, &TransactionView::editLabel);
abandonAction = contextMenu->addAction(tr("A&bandon transaction"), this, &TransactionView::abandonTx);
contextMenu->addAction(tr("&Edit address label"), this, &TransactionView::editLabel);

connect(dateWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseDate);
connect(typeWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseType);
Expand Down