Skip to content
GitLab
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
4c026aea
Commit
4c026aea
authored
Jan 20, 2022
by
Ingo Klöcker
Browse files
Use KConfigXT for getting/setting the default checksum definition
GnuPG-bug-id: 5791
parent
9b0d60eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/conf/cryptooperationsconfigwidget.cpp
View file @
4c026aea
...
...
@@ -17,6 +17,7 @@
#include
"emailoperationspreferences.h"
#include
"fileoperationspreferences.h"
#include
"settings.h"
#include
<Libkleo/ChecksumDefinition>
#include
<Libkleo/KeyFilterManager>
...
...
@@ -313,8 +314,6 @@ void CryptoOperationsConfigWidget::defaults()
}
}
Q_DECLARE_METATYPE
(
std
::
shared_ptr
<
Kleo
::
ChecksumDefinition
>
)
void
CryptoOperationsConfigWidget
::
load
()
{
...
...
@@ -329,15 +328,16 @@ void CryptoOperationsConfigWidget::load()
mTmpDirCB
->
setChecked
(
filePrefs
.
dontUseTmpDir
());
mSymmetricOnlyCB
->
setChecked
(
filePrefs
.
symmetricEncryptionOnly
());
const
std
::
vector
<
std
::
shared_ptr
<
ChecksumDefinition
>
>
cds
=
ChecksumDefinition
::
getChecksumDefinitions
();
const
std
::
shared_ptr
<
ChecksumDefinition
>
default_cd
=
ChecksumDefinition
::
getDefaultChecksumDefinition
(
cds
);
const
Settings
settings
;
const
auto
cds
=
ChecksumDefinition
::
getChecksumDefinitions
();
const
auto
defaultChecksumDefinitionId
=
settings
.
checksumDefinitionId
();
mChecksumDefinitionCB
->
clear
();
mArchiveDefinitionCB
->
clear
();
for
(
const
std
::
shared_ptr
<
ChecksumDefinition
>
&
cd
:
cds
)
{
mChecksumDefinitionCB
->
addItem
(
cd
->
label
(),
QVariant
::
fromValue
(
cd
)
);
if
(
cd
==
default
_c
d
)
{
mChecksumDefinitionCB
->
addItem
(
cd
->
label
(),
QVariant
{
cd
->
id
()}
);
if
(
cd
->
id
()
==
default
ChecksumDefinitionI
d
)
{
mChecksumDefinitionCB
->
setCurrentIndex
(
mChecksumDefinitionCB
->
count
()
-
1
);
}
}
...
...
@@ -377,11 +377,13 @@ void CryptoOperationsConfigWidget::save()
filePrefs
.
setDontUseTmpDir
(
mTmpDirCB
->
isChecked
());
filePrefs
.
setSymmetricEncryptionOnly
(
mSymmetricOnlyCB
->
isChecked
());
Settings
settings
;
const
int
idx
=
mChecksumDefinitionCB
->
currentIndex
();
if
(
idx
>=
0
)
{
const
auto
c
d
=
qvariant_cast
<
std
::
shared_ptr
<
ChecksumDefinition
>
>
(
mChecksumDefinitionCB
->
itemData
(
idx
));
ChecksumDefinition
::
setDefaul
tChecksumDefinition
(
c
d
);
const
auto
i
d
=
mChecksumDefinitionCB
->
itemData
(
idx
)
.
toString
(
);
settings
.
se
tChecksumDefinition
Id
(
i
d
);
}
settings
.
save
();
const
int
aidx
=
mArchiveDefinitionCB
->
currentIndex
();
if
(
aidx
>=
0
)
{
...
...
src/kcfg/settings.kcfg
View file @
4c026aea
...
...
@@ -50,6 +50,12 @@
<default>
false
</default>
</entry>
</group>
<group
name=
"ChecksumOperations"
>
<entry
key=
"checksum-definition-id"
name=
"ChecksumDefinitionId"
type=
"String"
>
<label>
Checksum program to use when creating checksum files
</label>
<default>
sha256sum
</default>
</entry>
</group>
<group
name=
"CMS"
>
<entry
key=
"Enabled"
name=
"cmsEnabled"
type=
"Bool"
>
<label>
Enable S/MIME
</label>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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