Commit 56eb8edb authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Remove OpenPGP keyserver from widget

GnuPG-bug-id: 5465
parent bf62c16e
......@@ -41,18 +41,6 @@ static QUrl defaultX509Service()
url.setHost(i18nc("default server name, keep it a valid domain name, ie. no spaces", "server"));
return url;
}
static QUrl defaultOpenPGPService()
{
QUrl url;
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.16") {
url.setScheme(QStringLiteral("hkp"));
url.setHost(QStringLiteral("keys.gnupg.net"));
} else {
url.setScheme(QStringLiteral("hkps"));
url.setHost(QStringLiteral("hkps.pool.sks-keyservers.net"));
}
return url;
}
static bool is_ldap_scheme(const QUrl &url)
{
......@@ -371,14 +359,11 @@ public:
ui.treeView->setModel(&model);
ui.treeView->setItemDelegate(&delegate);
ui.pgpKeyserver->setPlaceholderText(defaultOpenPGPService().toString());
connect(&model, &QAbstractItemModel::dataChanged, q, &DirectoryServicesWidget::changed);
connect(&model, &QAbstractItemModel::rowsInserted, q, &DirectoryServicesWidget::changed);
connect(&model, &QAbstractItemModel::rowsRemoved, q, &DirectoryServicesWidget::changed);
connect(ui.treeView->selectionModel(), &QItemSelectionModel::selectionChanged,
q, [this]() { slotSelectionChanged(); });
connect(ui.pgpKeyserver, &QLineEdit::textChanged, q, &DirectoryServicesWidget::changed);
slotShowUserAndPasswordToggled(false);
}
......@@ -426,9 +411,7 @@ private:
void enableDisableActions()
{
const bool x509 = (protocols & X509Protocol) && !(readOnlyProtocols & X509Protocol);
const bool pgp = (protocols & OpenPGPProtocol) && !(readOnlyProtocols & OpenPGPProtocol);
ui.newTB->setEnabled(x509);
ui.pgpKeyserver->setEnabled(pgp);
const int row = selectedRow();
ui.deleteTB->setEnabled(row >= 0 && !(readOnlyProtocols & X509Protocol));
}
......@@ -499,17 +482,6 @@ DirectoryServicesWidget::Protocols DirectoryServicesWidget::readOnlyProtocols()
return d->readOnlyProtocols;
}
void DirectoryServicesWidget::setOpenPGPService(const QString &url)
{
d->ui.pgpKeyserver->setText(url);
}
QString DirectoryServicesWidget::openPGPService() const
{
const auto pgpStr = d->ui.pgpKeyserver->text();
return pgpStr.contains(QLatin1String("://")) ? pgpStr : (QLatin1String("hkps://") + pgpStr);
}
void DirectoryServicesWidget::addX509Services(const QList<QUrl> &urls)
{
for (const QUrl &url : urls) {
......@@ -534,7 +506,6 @@ void DirectoryServicesWidget::clear()
return;
}
d->model.clear();
d->ui.pgpKeyserver->setText(QString());
Q_EMIT changed();
}
......
......@@ -37,9 +37,8 @@ public:
enum Protocol {
NoProtocol = 0,
X509Protocol = 1,
OpenPGPProtocol = 2,
AllProtocols = X509Protocol | OpenPGPProtocol
AllProtocols = X509Protocol
};
Q_DECLARE_FLAGS(Protocols, Protocol)
......@@ -50,17 +49,12 @@ public:
Protocols allowedProtocols() const;
void setX509Allowed(bool allowed);
void setOpenPGPAllowed(bool allowed);
void setReadOnlyProtocols(Protocols protocols);
Protocols readOnlyProtocols() const;
void setOpenPGPReadOnly(bool ro);
void setX509ReadOnly(bool ro);
void setOpenPGPService(const QString &url);
QString openPGPService() const;
void addX509Services(const QList<QUrl> &urls);
QList<QUrl> x509Services() const;
......@@ -81,15 +75,6 @@ private:
}
inline void Kleo::DirectoryServicesWidget::setOpenPGPAllowed(bool allowed)
{
if (allowed) {
setAllowedProtocols(allowedProtocols() | OpenPGPProtocol);
} else {
setAllowedProtocols(allowedProtocols() & ~OpenPGPProtocol);
}
}
inline void Kleo::DirectoryServicesWidget::setX509Allowed(bool allowed)
{
if (allowed) {
......@@ -99,15 +84,6 @@ inline void Kleo::DirectoryServicesWidget::setX509Allowed(bool allowed)
}
}
inline void Kleo::DirectoryServicesWidget::setOpenPGPReadOnly(bool ro)
{
if (ro) {
setReadOnlyProtocols(readOnlyProtocols() | OpenPGPProtocol);
} else {
setReadOnlyProtocols(readOnlyProtocols() & ~OpenPGPProtocol);
}
}
inline void Kleo::DirectoryServicesWidget::setX509ReadOnly(bool ro)
{
if (ro) {
......
......@@ -26,20 +26,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="pgpKSLabel">
<property name="text">
<string>OpenPGP Keyserver:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pgpKeyserver"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="x500LA">
<property name="title">
......
Markdown is supported
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