7#include "draftstatus.h"
9#include <MessageCore/AutocryptUtils>
15 DraftEncryptionState(msg).removeState();
16 DraftSignatureState(msg).removeState();
17 DraftCryptoMessageFormatState(msg).removeState();
25void DraftEncryptionState::setState(
bool encrypt)
28 hdr->fromUnicodeString(encrypt ? QStringLiteral(
"true") : QStringLiteral(
"false"));
32void DraftEncryptionState::removeState()
34 mMsg->removeHeader(
"X-KMail-EncryptActionEnabled");
37bool DraftEncryptionState::encryptionState()
const
40 auto hdr = mMsg->headerByType(
"X-KMail-EncryptActionEnabled");
41 return hdr->as7BitString(
false).contains(
"true");
47bool DraftEncryptionState::isDefined()
const
49 return mMsg->hasHeader(
"X-KMail-EncryptActionEnabled");
57void DraftSignatureState::setState(
bool sign)
60 hdr->fromUnicodeString(sign ? QStringLiteral(
"true") : QStringLiteral(
"false"));
64void DraftSignatureState::removeState()
66 mMsg->removeHeader(
"X-KMail-SignatureActionEnabled");
69bool DraftSignatureState::signState()
const
72 auto hdr = mMsg->headerByType(
"X-KMail-SignatureActionEnabled");
73 return hdr->as7BitString(
false).contains(
"true");
79bool DraftSignatureState::isDefined()
const
81 return mMsg->hasHeader(
"X-KMail-SignatureActionEnabled");
89void DraftCryptoMessageFormatState::setState(Kleo::CryptoMessageFormat cryptoMessageFormat)
96void DraftCryptoMessageFormatState::removeState()
98 mMsg->removeHeader(
"X-KMail-CryptoMessageFormat");
101Kleo::CryptoMessageFormat DraftCryptoMessageFormatState::cryptoMessageFormatState()
const
104 auto hdr = mMsg->headerByType(
"X-KMail-CryptoMessageFormat");
105 return static_cast<Kleo::CryptoMessageFormat
>(hdr->asUnicodeString().toInt());
108 return Kleo::AutoFormat;
111bool DraftCryptoMessageFormatState::isDefined()
const
113 return mMsg->hasHeader(
"X-KMail-CryptoMessageFormat");
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
QString number(double n, char format, int precision)