Commit 554349e7 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Add buttons for invoking actions on selected user ID or certification

This makes the actions more discoverable.

GnuPG-bug-id: 6102
parent 452adf99
Pipeline #211723 passed with stage
in 2 minutes and 31 seconds
......@@ -19,6 +19,7 @@
#include <Libkleo/KeyHelpers>
#include <QAction>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
......@@ -34,6 +35,22 @@
using namespace Kleo;
namespace
{
void addActionButton(QDialogButtonBox *buttonBox, QAction *action)
{
if (!action) {
return;
}
auto button = buttonBox->addButton(action->text(), QDialogButtonBox::ActionRole);
button->setEnabled(action->isEnabled());
QObject::connect(action, &QAction::changed, button, [action, button]() {
button->setEnabled(action->isEnabled());
});
QObject::connect(button, &QPushButton::clicked, action, &QAction::trigger);
}
}
WebOfTrustDialog::WebOfTrustDialog(QWidget *parent)
: QDialog(parent)
{
......@@ -53,6 +70,10 @@ WebOfTrustDialog::WebOfTrustDialog(QWidget *parent)
auto btn = bbox->addButton(QDialogButtonBox::Close);
connect(btn, &QPushButton::pressed, this, &QDialog::accept);
addActionButton(bbox, mWidget->detailsAction());
addActionButton(bbox, mWidget->certifyAction());
addActionButton(bbox, mWidget->revokeAction());
mFetchKeysBtn = bbox->addButton(i18nc("@action:button", "Fetch Missing Keys"),
QDialogButtonBox::ActionRole);
mFetchKeysBtn->setToolTip(i18nc("@info:tooltip", "Look up and import all keys that were used to certify the user IDs of this key"));
......
......@@ -291,6 +291,21 @@ WebOfTrustWidget::WebOfTrustWidget(QWidget *parent)
WebOfTrustWidget::~WebOfTrustWidget() = default;
QAction *WebOfTrustWidget::detailsAction() const
{
return d->detailsAction;
}
QAction *WebOfTrustWidget::certifyAction() const
{
return d->certifyAction;
}
QAction *WebOfTrustWidget::revokeAction() const
{
return d->revokeAction;
}
GpgME::Key WebOfTrustWidget::key() const
{
return d->key;
......
......@@ -24,6 +24,10 @@ public:
explicit WebOfTrustWidget(QWidget *parent = nullptr);
~WebOfTrustWidget() override;
QAction *detailsAction() const;
QAction *certifyAction() const;
QAction *revokeAction() const;
void setKey(const GpgME::Key &key);
GpgME::Key key() const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment