11#include "settings/messageviewersettings.h"
13#include <MessageCore/ColorUtil>
14#include <MessageCore/MessageCoreSettings>
16#include <KColorScheme>
18#include <KConfigGroup>
19#include <QApplication>
24using namespace MessageViewer;
27 CSSHelperBase::InlineMessageType type;
39 mLinkColor = MessageCore::ColorUtil::self()->linkColor();
40 for (
const auto &msgColor : inlineMessageColors) {
44 cPgpEncrH = MessageCore::ColorUtil::self()->pgpEncryptedMessageColor();
45 cPgpEncrHT = MessageCore::ColorUtil::self()->pgpEncryptedTextColor();
46 cPgpOk1H = MessageCore::ColorUtil::self()->pgpSignedTrustedMessageColor();
47 cPgpOk1HT = MessageCore::ColorUtil::self()->pgpSignedTrustedTextColor();
48 cPgpOk0H = MessageCore::ColorUtil::self()->pgpSignedUntrustedMessageColor();
49 cPgpOk0HT = MessageCore::ColorUtil::self()->pgpSignedUntrustedTextColor();
50 cPgpWarnH = MessageCore::ColorUtil::self()->pgpSignedUntrustedMessageColor();
51 cPgpWarnHT = MessageCore::ColorUtil::self()->pgpSignedUntrustedTextColor();
52 cPgpErrH = MessageCore::ColorUtil::self()->pgpSignedBadMessageColor();
53 cPgpErrHT = MessageCore::ColorUtil::self()->pgpSignedBadTextColor();
55 mRecycleQuoteColors =
false;
59 mBodyFont = MessageCore::MessageCoreSettings::self()->useDefaultFonts() ? defaultFont : MessageViewer ::MessageViewerSettings::self()->bodyFont();
60 mPrintFont = MessageCore::MessageCoreSettings::self()->useDefaultFonts() ? defaultFont : MessageViewer ::MessageViewerSettings::self()->printFont();
61 mFixedFont = mFixedPrintFont = defaultFixedFont;
63 mQuoteFont = defaultFont;
65 KConfig *config = MessageViewer::MessageViewerSettings::self()->config();
70 mRecycleQuoteColors = reader.readEntry(
"RecycleQuoteColors",
false);
73 if (MessageCore::MessageCoreSettings::self()->useDefaultColors()) {
74 mQuoteColor[0] = MessageCore::ColorUtil::self()->quoteLevel1DefaultTextColor();
75 mQuoteColor[1] = MessageCore::ColorUtil::self()->quoteLevel2DefaultTextColor();
76 mQuoteColor[2] = MessageCore::ColorUtil::self()->quoteLevel3DefaultTextColor();
78 mLinkColor = reader.readEntry(
"LinkColor", mLinkColor);
79 cPgpEncrH = reader.readEntry(
"PGPMessageEncr", cPgpEncrH);
80 cPgpOk1H = reader.readEntry(
"PGPMessageOkKeyOk", cPgpOk1H);
81 cPgpOk0H = reader.readEntry(
"PGPMessageOkKeyBad", cPgpOk0H);
82 cPgpWarnH = reader.readEntry(
"PGPMessageWarn", cPgpWarnH);
83 cPgpErrH = reader.readEntry(
"PGPMessageErr", cPgpErrH);
84 mQuoteColor[0] = MessageCore::MessageCoreSettings::self()->quotedText1();
85 mQuoteColor[1] = MessageCore::MessageCoreSettings::self()->quotedText2();
86 mQuoteColor[2] = MessageCore::MessageCoreSettings::self()->quotedText3();
89 if (!MessageCore::MessageCoreSettings::self()->useDefaultFonts()) {
90 mBodyFont = fonts.readEntry(
"body-font", mBodyFont);
91 mPrintFont = fonts.readEntry(
"print-font", mPrintFont);
92 mFixedFont = fonts.readEntry(
"fixed-font", mFixedFont);
93 mFixedPrintFont = mFixedFont;
96 mShrinkQuotes = MessageViewer::MessageViewerSettings::self()->shrinkQuotes();
98 mUseBrowserColor = MessageCore::MessageCoreSettings::self()->useRealHtmlMailColor();
99 recalculatePGPColors();
102CSSHelper::~CSSHelper() =
default;
104void CSSHelper::updateColor()
115 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
116 "<html><head><title></title><style>\n")
123QString CSSHelper::endBodyHtml()
const
125 return QStringLiteral(
"</body></html>");
QBrush background(BackgroundRole=NormalBackground) const
QBrush foreground(ForegroundRole=NormalText) const
QString cssDefinitions(const HtmlHeadSettings &) const
QString htmlHead(const HtmlHeadSettings &htmlHeadSettings) const override
const QColor & color() const const
void setItalic(bool enable)
QFont systemFont(SystemFont type)