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

Adapt to changed interface of directory services widget

GnuPG-bug-id: 5465
parent df01e87b
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <Libkleo/Compat> #include <Libkleo/Compat>
#include <Libkleo/DirectoryServicesWidget> #include <Libkleo/DirectoryServicesWidget>
#include <Libkleo/KeyserverConfig>
#include <QGpgME/Protocol> #include <QGpgME/Protocol>
...@@ -223,12 +224,12 @@ void DirectoryServicesConfigurationPage::load() ...@@ -223,12 +224,12 @@ void DirectoryServicesConfigurationPage::load()
CryptoConfigEntry::ArgType_LDAPURL, ListValue, DoShowError); CryptoConfigEntry::ArgType_LDAPURL, ListValue, DoShowError);
} }
if (mX509ServicesEntry) { if (mX509ServicesEntry) {
mWidget->addX509Services(mX509ServicesEntry->urlValueList()); std::vector<KeyserverConfig> servers;
} const auto urls = mX509ServicesEntry->urlValueList();
mWidget->setX509ReadOnly(mX509ServicesEntry && mX509ServicesEntry->isReadOnly()); servers.reserve(urls.size());
std::transform(std::begin(urls), std::end(urls), std::back_inserter(servers), [](const auto &url) { return KeyserverConfig::fromUrl(url); });
if (mX509ServicesEntry) { mWidget->setKeyservers(servers);
mWidget->setAllowedProtocols(DirectoryServicesWidget::X509Protocol); mWidget->setReadOnly(mX509ServicesEntry->isReadOnly());
} else { } else {
mWidget->setDisabled(true); mWidget->setDisabled(true);
} }
...@@ -324,7 +325,11 @@ void updateIntegerConfigEntry(QGpgME::CryptoConfigEntry *configEntry, int value) ...@@ -324,7 +325,11 @@ void updateIntegerConfigEntry(QGpgME::CryptoConfigEntry *configEntry, int value)
void DirectoryServicesConfigurationPage::save() void DirectoryServicesConfigurationPage::save()
{ {
if (mX509ServicesEntry) { if (mX509ServicesEntry) {
mX509ServicesEntry->setURLValueList(mWidget->x509Services()); QList<QUrl> urls;
const auto servers = mWidget->keyservers();
urls.reserve(servers.size());
std::transform(std::begin(servers), std::end(servers), std::back_inserter(urls), [](const auto &server) { return server.toUrl(); });
mX509ServicesEntry->setURLValueList(urls);
} }
if (mOpenPGPServiceEntry) { if (mOpenPGPServiceEntry) {
......
...@@ -54,6 +54,7 @@ private: ...@@ -54,6 +54,7 @@ private:
EntryMultiplicity multiplicity, EntryMultiplicity multiplicity,
ShowError showError); ShowError showError);
private:
QLineEdit *mOpenPGPKeyserverEdit = nullptr; QLineEdit *mOpenPGPKeyserverEdit = nullptr;
Kleo::DirectoryServicesWidget *mWidget = nullptr; Kleo::DirectoryServicesWidget *mWidget = nullptr;
QTimeEdit *mTimeout = nullptr; QTimeEdit *mTimeout = nullptr;
...@@ -69,4 +70,3 @@ private: ...@@ -69,4 +70,3 @@ private:
QGpgME::CryptoConfig *mConfig = nullptr; QGpgME::CryptoConfig *mConfig = nullptr;
}; };
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