Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
508170af
Commit
508170af
authored
Nov 29, 2021
by
Ingo Klöcker
Browse files
Hide X.509 directory services configuration if CMS is disabled
GnuPG-bug-id: 5688
parent
24c417aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/conf/dirservconfigpage.cpp
View file @
508170af
...
...
@@ -11,6 +11,8 @@
#include "dirservconfigpage.h"
#include <settings.h>
#include <Libkleo/Compat>
#include <Libkleo/DirectoryServicesWidget>
#include <Libkleo/KeyserverConfig>
...
...
@@ -160,18 +162,18 @@ DirectoryServicesConfigurationPage::DirectoryServicesConfigurationPage(QWidget *
}
// X.509 servers
++
row
;
{
if
(
Settings
{}.
cmsEnabled
())
{
++
row
;
auto
groupBox
=
new
QGroupBox
{
i18n
(
"X.509 Directory Services"
),
this
};
auto
groupBoxLayout
=
new
QVBoxLayout
{
groupBox
};
if
(
gpgme_check_version
(
"1.16.0"
))
{
m
Widget
=
new
Kleo
::
DirectoryServicesWidget
(
this
);
if
(
QLayout
*
l
=
m
Widget
->
layout
())
{
m
DirectoryServices
=
new
Kleo
::
DirectoryServicesWidget
(
this
);
if
(
QLayout
*
l
=
m
DirectoryServices
->
layout
())
{
l
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
groupBoxLayout
->
addWidget
(
m
Widget
);
connect
(
m
Widget
,
SIGNAL
(
changed
()),
this
,
SLOT
(
changed
()));
groupBoxLayout
->
addWidget
(
m
DirectoryServices
);
connect
(
m
DirectoryServices
,
SIGNAL
(
changed
()),
this
,
SLOT
(
changed
()));
}
else
{
// QGpgME does not properly support keyserver flags for X.509 keyservers (added in GnuPG 2.2.28);
// disable the configuration to prevent the configuration from being corrupted
...
...
@@ -217,8 +219,8 @@ DirectoryServicesConfigurationPage::DirectoryServicesConfigurationPage(QWidget *
void
DirectoryServicesConfigurationPage
::
load
()
{
if
(
m
Widget
)
{
m
Widget
->
clear
();
if
(
m
DirectoryServices
)
{
m
DirectoryServices
->
clear
();
// gpgsm's keyserver option is not provided by very old gpgconf versions
mX509ServicesEntry
=
configEntry
(
s_x509services_componentName
,
s_x509services_entryName
,
...
...
@@ -232,10 +234,10 @@ void DirectoryServicesConfigurationPage::load()
const
auto
urls
=
mX509ServicesEntry
->
urlValueList
();
servers
.
reserve
(
urls
.
size
());
std
::
transform
(
std
::
begin
(
urls
),
std
::
end
(
urls
),
std
::
back_inserter
(
servers
),
[](
const
auto
&
url
)
{
return
KeyserverConfig
::
fromUrl
(
url
);
});
m
Widget
->
setKeyservers
(
servers
);
m
Widget
->
setReadOnly
(
mX509ServicesEntry
->
isReadOnly
());
m
DirectoryServices
->
setKeyservers
(
servers
);
m
DirectoryServices
->
setReadOnly
(
mX509ServicesEntry
->
isReadOnly
());
}
else
{
m
Widget
->
setDisabled
(
true
);
m
DirectoryServices
->
setDisabled
(
true
);
}
}
...
...
@@ -341,9 +343,9 @@ void updateIntegerConfigEntry(QGpgME::CryptoConfigEntry *configEntry, int value)
void
DirectoryServicesConfigurationPage
::
save
()
{
if
(
mX509ServicesEntry
&&
m
Widget
)
{
if
(
mX509ServicesEntry
&&
m
DirectoryServices
)
{
QList
<
QUrl
>
urls
;
const
auto
servers
=
m
Widget
->
keyservers
();
const
auto
servers
=
m
DirectoryServices
->
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
);
...
...
@@ -371,7 +373,7 @@ void DirectoryServicesConfigurationPage::save()
#if 0
// Also write the LDAP URLs to kabldaprc so that they are used by kaddressbook
KABSynchronizer sync;
const KUrl::List toAdd = m
Widget
->urlList();
const KUrl::List toAdd = m
DirectoryServices
->urlList();
KUrl::List currentList = sync.readCurrentList();
KUrl::List::const_iterator it = toAdd.begin();
...
...
src/conf/dirservconfigpage.h
View file @
508170af
...
...
@@ -56,7 +56,7 @@ private:
private:
QLineEdit
*
mOpenPGPKeyserverEdit
=
nullptr
;
Kleo
::
DirectoryServicesWidget
*
m
Widget
=
nullptr
;
Kleo
::
DirectoryServicesWidget
*
m
DirectoryServices
=
nullptr
;
QTimeEdit
*
mTimeout
=
nullptr
;
QSpinBox
*
mMaxItems
=
nullptr
;
QLabel
*
mMaxItemsLabel
=
nullptr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment