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

Set/get the OpenPGP keyserver as simple string

Only a single keyserver can be configured (via gpgconf), so using a list
in the interface is just confusing. Moreover, LDAP keyserver "urls" are
not really proper URLs, so that using QUrl doesn't really work.

GnuPG-bug-id: 5404
parent 8f170d07
......@@ -498,28 +498,15 @@ DirectoryServicesWidget::Protocols DirectoryServicesWidget::readOnlyProtocols()
return d->readOnlyProtocols;
}
void DirectoryServicesWidget::addOpenPGPServices(const QList<QUrl> &urls)
void DirectoryServicesWidget::setOpenPGPService(const QString &url)
{
if (urls.size() > 1) {
qCWarning(KLEO_UI_LOG) << "More then one PGP Server, Ignoring all others.";
}
if (urls.size()) {
d->ui.pgpKeyserver->setText(urls[0].toString());
}
d->ui.pgpKeyserver->setText(url);
}
QList<QUrl> DirectoryServicesWidget::openPGPServices() const
QString DirectoryServicesWidget::openPGPService() const
{
QList<QUrl> result;
const QString pgpStr = d->ui.pgpKeyserver->text();
if (pgpStr.contains(QLatin1String("://"))) {
// Maybe validate here? Otoh maybe gnupg adds support for more schemes
// then we know about in the future.
result.push_back(QUrl::fromUserInput(pgpStr));
} else if (!pgpStr.isEmpty()) {
result.push_back(QUrl::fromUserInput(QStringLiteral("hkp://") + pgpStr));
}
return result;
const auto pgpStr = d->ui.pgpKeyserver->text();
return pgpStr.contains(QLatin1String("://")) ? pgpStr : (QLatin1String("hkp://") + pgpStr);
}
void DirectoryServicesWidget::addX509Services(const QList<QUrl> &urls)
......
......@@ -58,8 +58,8 @@ public:
void setOpenPGPReadOnly(bool ro);
void setX509ReadOnly(bool ro);
void addOpenPGPServices(const QList<QUrl> &urls);
QList<QUrl> openPGPServices() const;
void setOpenPGPService(const QString &url);
QString openPGPService() const;
void addX509Services(const QList<QUrl> &urls);
QList<QUrl> x509Services() const;
......
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