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
libkleo
Commits
c891fe0a
Commit
c891fe0a
authored
Oct 28, 2021
by
Ingo Klöcker
Browse files
Add convenience helper for getting url list crypto config entry
GnuPG-bug-id: 5672
parent
f9cc52bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/utils/cryptoconfig.cpp
View file @
c891fe0a
...
...
@@ -40,10 +40,10 @@ int Kleo::getCryptoConfigIntValue(const char *componentName, const char *entryNa
return
defaultValue
;
}
const
CryptoConfigEntry
*
const
entry
=
getCryptoConfigEntry
(
config
,
componentName
,
entryName
);
if
(
!
entry
||
entry
->
argType
()
!
=
CryptoConfigEntry
::
ArgType_Int
)
{
return
defaul
tValue
;
if
(
entry
&&
entry
->
argType
()
=
=
CryptoConfigEntry
::
ArgType_Int
)
{
return
entry
->
in
tValue
()
;
}
return
entry
->
in
tValue
()
;
return
defaul
tValue
;
}
QString
Kleo
::
getCryptoConfigStringValue
(
const
char
*
componentName
,
const
char
*
entryName
)
...
...
@@ -63,10 +63,25 @@ QString Kleo::getCryptoConfigStringValue(const char *componentName, const char *
return
{};
}
const
CryptoConfigEntry
*
const
entry
=
getCryptoConfigEntry
(
config
,
componentName
,
entryName
);
if
(
!
entry
||
entry
->
argType
()
!=
CryptoConfigEntry
::
ArgType_String
)
{
return
QString
();
if
(
entry
&&
entry
->
argType
()
==
CryptoConfigEntry
::
ArgType_String
)
{
return
entry
->
stringValue
();
}
return
{};
}
QList
<
QUrl
>
Kleo
::
getCryptoConfigUrlList
(
const
char
*
componentName
,
const
char
*
entryName
)
{
const
CryptoConfig
*
const
config
=
cryptoConfig
();
if
(
!
config
)
{
return
{};
}
const
CryptoConfigEntry
*
const
entry
=
getCryptoConfigEntry
(
config
,
componentName
,
entryName
);
if
(
entry
&&
entry
->
isList
()
&&
(
entry
->
argType
()
==
CryptoConfigEntry
::
ArgType_LDAPURL
||
entry
->
argType
()
==
CryptoConfigEntry
::
ArgType_Path
))
{
return
entry
->
urlValueList
();
}
return
entry
->
stringValue
()
;
return
{}
;
}
void
Kleo
::
Private
::
setFakeCryptoConfigIntValue
(
const
std
::
string
&
componentName
,
const
std
::
string
&
entryName
,
int
fakeValue
)
...
...
src/utils/cryptoconfig.h
View file @
c891fe0a
...
...
@@ -12,7 +12,10 @@
#include
"kleo_export.h"
#include
<QList>
class
QString
;
class
QUrl
;
namespace
Kleo
{
...
...
@@ -21,4 +24,6 @@ KLEO_EXPORT int getCryptoConfigIntValue(const char *componentName, const char *e
KLEO_EXPORT
QString
getCryptoConfigStringValue
(
const
char
*
componentName
,
const
char
*
entryName
);
KLEO_EXPORT
QList
<
QUrl
>
getCryptoConfigUrlList
(
const
char
*
componentName
,
const
char
*
entryName
);
}
Write
Preview
Supports
Markdown
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