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
KMail
Commits
4122ca73
Commit
4122ca73
authored
Oct 21, 2022
by
Sandro Knauß
🐝
Browse files
Calculate pgpAutoEncrypt/Sign state with default from messagecomposer.
parent
a4843596
Pipeline
#252712
failed with stage
in 1 minute and 7 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/editor/kmcomposerwin.cpp
View file @
4122ca73
...
...
@@ -1408,7 +1408,7 @@ void KMComposerWin::setupActions()
mLastIdentityHasEncryptionKey
=
!
ident
.
pgpEncryptionKey
().
isEmpty
()
||
!
ident
.
smimeEncryptionKey
().
isEmpty
();
mLastEncryptActionState
=
false
;
mLastSignActionState
=
ident
.
pgpAutoSign
();
mLastSignActionState
=
pgpAutoSign
();
changeCryptoAction
();
...
...
@@ -1584,7 +1584,7 @@ void KMComposerWin::changeCryptoAction()
const
bool
canSMIMESign
=
QGpgME
::
smime
()
&&
!
ident
.
smimeSigningKey
().
isEmpty
();
setEncryption
(
false
);
setSigning
((
canOpenPGPSign
||
canSMIMESign
)
&&
ident
.
pgpAutoSign
());
setSigning
((
canOpenPGPSign
||
canSMIMESign
)
&&
pgpAutoSign
());
}
}
...
...
@@ -2087,6 +2087,26 @@ const KIdentityManagement::Identity &KMComposerWin::identity() const
return
KMKernel
::
self
()
->
identityManager
()
->
identityForUoidOrDefault
(
currentIdentity
());
}
bool
KMComposerWin
::
pgpAutoEncrypt
()
const
{
const
auto
ident
=
identity
();
if
(
ident
.
encryptionOverride
())
{
return
ident
.
pgpAutoEncrypt
();
}
else
{
return
MessageComposer
::
MessageComposerSettings
::
self
()
->
cryptoAutoEncrypt
();
}
}
bool
KMComposerWin
::
pgpAutoSign
()
const
{
const
auto
ident
=
identity
();
if
(
ident
.
encryptionOverride
())
{
return
ident
.
pgpAutoSign
();
}
else
{
return
MessageComposer
::
MessageComposerSettings
::
self
()
->
cryptoAutoSign
();
}
}
Kleo
::
CryptoMessageFormat
KMComposerWin
::
cryptoMessageFormat
()
const
{
if
(
!
mCryptoModuleAction
)
{
...
...
@@ -3402,7 +3422,7 @@ void KMComposerWin::updateComposerAfterIdentityChanged(const KIdentityManagement
// Update encryption status of all recipients, if encryption state is not set by user
const
bool
setByUser
=
mEncryptAction
->
property
(
"setByUser"
).
toBool
();
if
(
!
setByUser
&&
ident
.
pgpAutoEncrypt
())
{
if
(
!
setByUser
&&
pgpAutoEncrypt
())
{
const
auto
lst
=
mComposerBase
->
recipientsEditor
()
->
lines
();
for
(
auto
line
:
lst
)
{
slotRecipientAdded
(
qobject_cast
<
MessageComposer
::
RecipientLineNG
*>
(
line
));
...
...
@@ -3733,7 +3753,7 @@ void KMComposerWin::slotRecipientAdded(MessageComposer::RecipientLineNG *line)
}
// Same if auto-encryption is not enabled in current identity settings
if
(
!
identity
().
pgpAutoEncrypt
()
||
identity
().
pgpEncryptionKey
().
isEmpty
())
{
if
(
!
pgpAutoEncrypt
()
||
identity
().
pgpEncryptionKey
().
isEmpty
())
{
return
;
}
...
...
@@ -3784,7 +3804,7 @@ void KMComposerWin::slotRecipientFocusLost(MessageComposer::RecipientLineNG *lin
}
// Same if auto-encryption is not enabled in current identity settings
if
(
!
identity
().
pgpAutoEncrypt
()
||
identity
().
pgpEncryptionKey
().
isEmpty
())
{
if
(
!
pgpAutoEncrypt
()
||
identity
().
pgpEncryptionKey
().
isEmpty
())
{
return
;
}
...
...
src/editor/kmcomposerwin.h
View file @
4122ca73
...
...
@@ -431,6 +431,8 @@ public: // kmcommand
void
addAttach
(
KMime
::
Content
*
msgPart
)
override
;
const
KIdentityManagement
::
Identity
&
identity
()
const
;
Q_REQUIRED_RESULT
bool
pgpAutoSign
()
const
;
Q_REQUIRED_RESULT
bool
pgpAutoEncrypt
()
const
;
/** Don't check for forgotten attachments for a mail, eg. when sending out invitations. */
void
disableForgottenAttachmentsCheck
()
override
;
...
...
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