diff --git a/messagecore/src/utils/stringutil.cpp b/messagecore/src/utils/stringutil.cpp index e0018d54..3305f7dc 100644 --- a/messagecore/src/utils/stringutil.cpp +++ b/messagecore/src/utils/stringutil.cpp @@ -1,734 +1,734 @@ /* Copyright (C) 2016-2018 Laurent Montel Copyright 2009 Thomas McGuire This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "stringutil.h" #include "config-enterprise.h" #include "MessageCore/MessageCoreSettings" #include #include #include #include #include #include "messagecore_debug.h" #include #include #include #include #include #include #include #include #include using namespace KMime; using namespace KMime::Types; using namespace KMime::HeaderParsing; namespace MessageCore { namespace StringUtil { // Removes trailing spaces and tabs at the end of the line static void removeTrailingSpace(QString &line) { int i = line.length() - 1; while ((i >= 0) && ((line[i] == QLatin1Char(' ')) || (line[i] == QLatin1Char('\t')))) { i--; } line.truncate(i + 1); } // Splits the line off in two parts: The quote prefixes and the actual text of the line. // For example, for the string "> > > Hello", it would be split up in "> > > " as the quote // prefix, and "Hello" as the actual text. // The actual text is written back to the "line" parameter, and the quote prefix is returned. static QString splitLine(QString &line) { removeTrailingSpace(line); int i = 0; int startOfActualText = -1; // TODO: Replace tabs with spaces first. // Loop through the chars in the line to find the place where the quote prefix stops const int lineLength(line.length()); while (i < lineLength) { const QChar c = line[i]; const bool isAllowedQuoteChar = (c == QLatin1Char('>')) || (c == QLatin1Char(':')) || (c == QLatin1Char('|')) || (c == QLatin1Char(' ')) || (c == QLatin1Char('\t')); if (isAllowedQuoteChar) { startOfActualText = i + 1; } else { break; } ++i; } // If the quote prefix only consists of whitespace, don't consider it as a quote prefix at all if (line.left(startOfActualText).trimmed().isEmpty()) { startOfActualText = 0; } // No quote prefix there -> nothing to do if (startOfActualText <= 0) { return QString(); } // Entire line consists of only the quote prefix if (i == line.length()) { const QString quotePrefix = line.left(startOfActualText); line.clear(); return quotePrefix; } // Line contains both the quote prefix and the actual text, really split it up now const QString quotePrefix = line.left(startOfActualText); line = line.mid(startOfActualText); return quotePrefix; } // Writes all lines/text parts contained in the "textParts" list to the output text, "msg". // Quote characters are added in front of each line, and no line is longer than // maxLength. // // Although the lines in textParts are considered separate lines, they can actually be run // together into a single line in some cases. This is basically the main difference to flowText(). // // Example: // textParts = "Hello World, this is a test.", "Really" // indent = ">" // maxLength = 20 // Result: "> Hello World, this\n // > is a test. Really" // Notice how in this example, the text line "Really" is no longer a separate line, it was run // together with a previously broken line. // // "textParts" is cleared upon return. static bool flushPart(QString &msg, QStringList &textParts, const QString &indent, int maxLength) { if (maxLength < 20) { maxLength = 20; } // Remove empty lines at end of quote while (!textParts.isEmpty() && textParts.last().isEmpty()) { textParts.removeLast(); } QString text; for (const QString &line : textParts) { // An empty line in the input means that an empty line should be in the output as well. // Therefore, we write all of our text so far to the msg. if (line.isEmpty()) { if (!text.isEmpty()) { msg += KPIMTextEdit::TextUtils::flowText(text, indent, maxLength) + QLatin1Char('\n'); } msg += indent + QLatin1Char('\n'); } else { if (text.isEmpty()) { text = line; } else { text += QLatin1Char(' ') + line.trimmed(); } // If the line doesn't need to be wrapped at all, just write it out as-is. // When a line exceeds the maximum length and therefore needs to be broken, this statement // if false, and therefore we keep adding lines to our text, so they get ran together in the // next flowText call, as "text" contains several text parts/lines then. if ((text.length() < maxLength) || (line.length() < (maxLength - 10))) { msg += KPIMTextEdit::TextUtils::flowText(text, indent, maxLength) + QLatin1Char('\n'); } } } // Write out pending text to the msg if (!text.isEmpty()) { msg += KPIMTextEdit::TextUtils::flowText(text, indent, maxLength); } const bool appendEmptyLine = !textParts.isEmpty(); textParts.clear(); return appendEmptyLine; } QMap parseMailtoUrl(const QUrl &url) { QMap values; if (url.scheme() != QLatin1String("mailto")) { return values; } QUrlQuery query(url); Q_FOREACH (const auto &queryItem, query.queryItems(QUrl::FullyDecoded)) { values.insertMulti(queryItem.first, queryItem.second); } QStringList to = {KEmailAddress::decodeMailtoUrl(url)}; const QString toStr = values.value(QStringLiteral("to")); if (!toStr.isEmpty()) { to << toStr; } values.insert(QStringLiteral("to"), to.join(QStringLiteral(", "))); return values; } QString stripSignature(const QString &msg) { // Following RFC 3676, only > before -- // I prefer to not delete a SB instead of delete good mail content. const QRegularExpression sbDelimiterSearch(QStringLiteral("(^|\n)[> ]*-- \n")); // The regular expression to look for prefix change const QRegularExpression commonReplySearch(QStringLiteral("^[ ]*>")); QString res = msg; int posDeletingStart = 1; // to start looking at 0 // While there are SB delimiters (start looking just before the deleted SB) while ((posDeletingStart = res.indexOf(sbDelimiterSearch, posDeletingStart - 1)) >= 0) { QString prefix; // the current prefix QString line; // the line to check if is part of the SB int posNewLine = -1; // Look for the SB beginning int posSignatureBlock = res.indexOf(QLatin1Char('-'), posDeletingStart); // The prefix before "-- "$ if (res.at(posDeletingStart) == QLatin1Char('\n')) { ++posDeletingStart; } prefix = res.mid(posDeletingStart, posSignatureBlock - posDeletingStart); posNewLine = res.indexOf(QLatin1Char('\n'), posSignatureBlock) + 1; // now go to the end of the SB while (posNewLine < res.size() && posNewLine > 0) { // handle the undefined case for mid ( x , -n ) where n>1 int nextPosNewLine = res.indexOf(QLatin1Char('\n'), posNewLine); if (nextPosNewLine < 0) { nextPosNewLine = posNewLine - 1; } line = res.mid(posNewLine, nextPosNewLine - posNewLine); // check when the SB ends: // * does not starts with prefix or // * starts with prefix+(any substring of prefix) if ((prefix.isEmpty() && line.indexOf(commonReplySearch) < 0) || (!prefix.isEmpty() && line.startsWith(prefix) && line.mid(prefix.size()).indexOf(commonReplySearch) < 0)) { posNewLine = res.indexOf(QLatin1Char('\n'), posNewLine) + 1; } else { break; // end of the SB } } // remove the SB or truncate when is the last SB if (posNewLine > 0) { res.remove(posDeletingStart, posNewLine - posDeletingStart); } else { res.truncate(posDeletingStart); } } return res; } AddressList splitAddressField(const QByteArray &text) { AddressList result; const char *begin = text.begin(); if (!begin) { return result; } const char *const end = text.begin() + text.length(); if (!parseAddressList(begin, end, result)) { qCDebug(MESSAGECORE_LOG) << "Error in address splitting: parseAddressList returned false!"; } return result; } QString generateMessageId(const QString &address, const QString &suffix) { const QDateTime dateTime = QDateTime::currentDateTime(); QString msgIdStr = QLatin1Char('<') + dateTime.toString(QStringLiteral("yyyyMMddhhmm.sszzz")); if (!suffix.isEmpty()) { msgIdStr += QLatin1Char('@') + suffix; } else { msgIdStr += QLatin1Char('.') + KEmailAddress::toIdn(address); } msgIdStr += QLatin1Char('>'); return msgIdStr; } QString quoteHtmlChars(const QString &str, bool removeLineBreaks) { QString result; int strLength(str.length()); result.reserve(6 * strLength); // maximal possible length for (int i = 0; i < strLength; ++i) { switch (str[i].toLatin1()) { case '<': result += QLatin1String("<"); break; case '>': result += QLatin1String(">"); break; case '&': result += QLatin1String("&"); break; case '"': result += QLatin1String("""); break; case '\n': if (!removeLineBreaks) { result += QLatin1String("
"); } break; case '\r': // ignore CR break; default: result += str[i]; } } result.squeeze(); return result; } void removePrivateHeaderFields(const KMime::Message::Ptr &message, bool cleanUpHeader) { message->removeHeader("Status"); message->removeHeader("X-Status"); message->removeHeader("X-KMail-EncryptionState"); message->removeHeader("X-KMail-SignatureState"); message->removeHeader("X-KMail-Transport"); message->removeHeader("X-KMail-Fcc"); message->removeHeader("X-KMail-Redirect-From"); message->removeHeader("X-KMail-Link-Message"); message->removeHeader("X-KMail-Link-Type"); message->removeHeader("X-KMail-QuotePrefix"); message->removeHeader("X-KMail-CursorPos"); message->removeHeader("X-KMail-Templates"); message->removeHeader("X-KMail-Drafts"); message->removeHeader("X-KMail-UnExpanded-To"); message->removeHeader("X-KMail-UnExpanded-CC"); message->removeHeader("X-KMail-UnExpanded-BCC"); message->removeHeader("X-KMail-FccDisabled"); if (cleanUpHeader) { message->removeHeader("X-KMail-Identity"); message->removeHeader("X-KMail-Dictionary"); } } QByteArray asSendableString(const KMime::Message::Ptr &originalMessage) { KMime::Message::Ptr message(new KMime::Message); message->setContent(originalMessage->encodedContent()); removePrivateHeaderFields(message); message->removeHeader(); return message->encodedContent(); } QByteArray headerAsSendableString(const KMime::Message::Ptr &originalMessage) { KMime::Message::Ptr message(new KMime::Message); message->setContent(originalMessage->encodedContent()); removePrivateHeaderFields(message); message->removeHeader(); return message->head(); } QString emailAddrAsAnchor(const KMime::Types::Mailbox::List &mailboxList, Display display, const QString &cssStyle, Link link, AddressMode expandable, const QString &fieldName, int collapseNumber) { QString result; int numberAddresses = 0; bool expandableInserted = false; KIdentityManagement::IdentityManager *im = KIdentityManagement::IdentityManager::self(); //TODO port code to css. Avoid js support https://siongui.github.io/2017/02/27/css-only-toggle-dom-element/ const QString visibility = QStringLiteral(" style=\"display:none;\""); const QString i18nMe = i18nc("signal that this email is defined in my identity", "Me"); const bool onlyOneIdentity = (im->identities().count() == 1); for (const KMime::Types::Mailbox &mailbox : mailboxList) { const QString prettyAddressStr = mailbox.prettyAddress(); if (!prettyAddressStr.isEmpty()) { numberAddresses++; if (expandable == ExpandableAddresses && !expandableInserted && numberAddresses > collapseNumber) { const QString actualListAddress = result; QString shortListAddress = actualListAddress; if (link == ShowLink) { shortListAddress.truncate(result.length() - 2); } result = QStringLiteral("").arg(fieldName) + shortListAddress; - result += QStringLiteral("").arg(fieldName); + result += QStringLiteral("").arg(fieldName); expandableInserted = true; result += QStringLiteral("").arg(fieldName) + actualListAddress; } if (link == ShowLink) { result += QLatin1String("'); } const bool foundMe = onlyOneIdentity && (im->identityForAddress(prettyAddressStr) != KIdentityManagement::Identity::null()); if (display == DisplayNameOnly) { if (!mailbox.name().isEmpty()) { // Fallback to the email address when the name is not set. result += foundMe ? i18nMe : quoteHtmlChars(mailbox.name(), true); } else { result += foundMe ? i18nMe : quoteHtmlChars(prettyAddressStr, true); } } else { result += foundMe ? i18nMe : quoteHtmlChars(mailbox.prettyAddress(KMime::Types::Mailbox::QuoteWhenNecessary), true); } if (link == ShowLink) { result += QLatin1String(", "); } } } if (link == ShowLink) { result.truncate(result.length() - 2); } if (expandableInserted) { - result += QStringLiteral("").arg(fieldName); + result += QStringLiteral("").arg(fieldName); } return result; } QString emailAddrAsAnchor(KMime::Headers::Generics::MailboxList *mailboxList, Display display, const QString &cssStyle, Link link, AddressMode expandable, const QString &fieldName, int collapseNumber) { Q_ASSERT(mailboxList); return emailAddrAsAnchor(mailboxList->mailboxes(), display, cssStyle, link, expandable, fieldName, collapseNumber); } QString emailAddrAsAnchor(KMime::Headers::Generics::AddressList *addressList, Display display, const QString &cssStyle, Link link, AddressMode expandable, const QString &fieldName, int collapseNumber) { Q_ASSERT(addressList); return emailAddrAsAnchor(addressList->mailboxes(), display, cssStyle, link, expandable, fieldName, collapseNumber); } bool addressIsInAddressList(const QString &address, const QStringList &addresses) { const QString addrSpec = KEmailAddress::extractEmailAddress(address); QStringList::ConstIterator end(addresses.constEnd()); for (QStringList::ConstIterator it = addresses.constBegin(); it != end; ++it) { if (qstricmp(addrSpec.toUtf8().data(), KEmailAddress::extractEmailAddress(*it).toUtf8().data()) == 0) { return true; } } return false; } QString guessEmailAddressFromLoginName(const QString &loginName) { if (loginName.isEmpty()) { return QString(); } QString address = loginName; address += QLatin1Char('@'); address += QHostInfo::localHostName(); // try to determine the real name const KUser user(loginName); if (user.isValid()) { const QString fullName = user.property(KUser::FullName).toString(); address = KEmailAddress::quoteNameIfNecessary(fullName) + QLatin1String(" <") + address + QLatin1Char('>'); } return address; } QString smartQuote(const QString &msg, int maxLineLength) { // The algorithm here is as follows: // We split up the incoming msg into lines, and then iterate over each line. // We keep adding lines with the same indent ( = quote prefix, e.g. "> " ) to a // "textParts" list. So the textParts list contains only lines with the same quote // prefix. // // When all lines with the same indent are collected in "textParts", we write those out // to the result by calling flushPart(), which does all the nice formatting for us. QStringList textParts; QString oldIndent; bool firstPart = true; QString result; int lineStart = 0; int lineEnd = msg.indexOf(QLatin1Char('\n')); bool needToContinue = true; for (; needToContinue; lineStart = lineEnd + 1, lineEnd = msg.indexOf(QLatin1Char('\n'), lineStart)) { QString line; if (lineEnd == -1) { if (lineStart == 0) { line = msg; needToContinue = false; } else if (lineStart != 0 && lineStart != msg.length()) { line = msg.mid(lineStart, msg.length() - lineStart); needToContinue = false; } else { needToContinue = false; } } else { line = msg.mid(lineStart, lineEnd - lineStart); } // Split off the indent from the line const QString indent = splitLine(line); if (line.isEmpty()) { if (!firstPart) { textParts.append(QString()); } continue; } if (firstPart) { oldIndent = indent; firstPart = false; } // The indent changed, that means we have to write everything contained in textParts to the // result, which we do by calling flushPart(). if (oldIndent != indent) { // Check if the last non-blank line is a "From" line. A from line is the line containing the // attribution to a quote, e.g. "Yesterday, you wrote:". We'll just check for the last colon // here, to simply things. // If there is a From line, remove it from the textParts to that flushPart won't break it. // We'll manually add it to the result afterwards. QString fromLine; if (!textParts.isEmpty()) { for (int i = textParts.count() - 1; i >= 0; i--) { // Check if we have found the From line const QString textPartElement(textParts[i]); if (textPartElement.endsWith(QLatin1Char(':'))) { fromLine = oldIndent + textPartElement + QLatin1Char('\n'); textParts.removeAt(i); break; } // Abort on first non-empty line if (!textPartElement.trimmed().isEmpty()) { break; } } } // Write out all lines with the same indent using flushPart(). The textParts list // is cleared for us. if (flushPart(result, textParts, oldIndent, maxLineLength)) { if (oldIndent.length() > indent.length()) { result += indent + QLatin1Char('\n'); } else { result += oldIndent + QLatin1Char('\n'); } } if (!fromLine.isEmpty()) { result += fromLine; } oldIndent = indent; } textParts.append(line); } // Write out anything still pending flushPart(result, textParts, oldIndent, maxLineLength); // Remove superfluous newline which was appended in flowText if (!result.isEmpty() && result.endsWith(QLatin1Char('\n'))) { result.chop(1); } return result; } QString formatQuotePrefix(const QString &wildString, const QString &fromDisplayString) { QString result; if (wildString.isEmpty()) { return wildString; } int strLength(wildString.length()); for (int i = 0; i < strLength;) { QChar ch = wildString[i++]; if (ch == QLatin1Char('%') && i < strLength) { ch = wildString[i++]; switch (ch.toLatin1()) { case 'f': { // sender's initals if (fromDisplayString.isEmpty()) { break; } int j = 0; const int strLength(fromDisplayString.length()); for (; j < strLength && fromDisplayString[j] > QLatin1Char(' '); ++j) { } for (; j < strLength && fromDisplayString[j] <= QLatin1Char(' '); ++j) { } result += fromDisplayString[0]; if (j < strLength && fromDisplayString[j] > QLatin1Char(' ')) { result += fromDisplayString[j]; } else if (strLength > 1) { if (fromDisplayString[1] > QLatin1Char(' ')) { result += fromDisplayString[1]; } } break; } case '_': result += QLatin1Char(' '); break; case '%': result += QLatin1Char('%'); break; default: result += QLatin1Char('%'); result += ch; break; } } else { result += ch; } } return result; } QString cleanFileName(const QString &name) { QString fileName = name.trimmed(); // We need to replace colons with underscores since those cause problems with // KFileDialog (bug in KFileDialog though) and also on Windows filesystems. // We also look at the special case of ": ", since converting that to "_ " // would look strange, simply "_" looks better. // https://issues.kolab.org/issue3805 fileName.replace(QLatin1String(": "), QStringLiteral("_")); // replace all ':' with '_' because ':' isn't allowed on FAT volumes fileName.replace(QLatin1Char(':'), QLatin1Char('_')); // better not use a dir-delimiter in a filename fileName.replace(QLatin1Char('/'), QLatin1Char('_')); fileName.replace(QLatin1Char('\\'), QLatin1Char('_')); #ifdef KDEPIM_ENTERPRISE_BUILD // replace all '.' with '_', not just at the start of the filename // but don't replace the last '.' before the file extension. int i = fileName.lastIndexOf(QLatin1Char('.')); if (i != -1) { i = fileName.lastIndexOf(QLatin1Char('.'), i - 1); } while (i != -1) { fileName.replace(i, 1, QLatin1Char('_')); i = fileName.lastIndexOf(QLatin1Char('.'), i - 1); } #endif // replace all '~' with '_', not just leading '~' either. fileName.replace(QLatin1Char('~'), QLatin1Char('_')); return fileName; } QString stripOffPrefixes(const QString &subject) { static QStringList defaultReplyPrefixes = QStringList() << QStringLiteral("Re\\s*:") << QStringLiteral("Re\\[\\d+\\]:") << QStringLiteral("Re\\d+:"); static QStringList defaultForwardPrefixes = QStringList() << QStringLiteral("Fwd:") << QStringLiteral("FW:"); QStringList replyPrefixes = MessageCoreSettings::self()->replyPrefixes(); if (replyPrefixes.isEmpty()) { replyPrefixes = defaultReplyPrefixes; } QStringList forwardPrefixes = MessageCoreSettings::self()->forwardPrefixes(); if (forwardPrefixes.isEmpty()) { forwardPrefixes = defaultForwardPrefixes; } const QStringList prefixRegExps = replyPrefixes + forwardPrefixes; // construct a big regexp that // 1. is anchored to the beginning of str (sans whitespace) // 2. matches at least one of the part regexps in prefixRegExps const QString bigRegExp = QStringLiteral("^(?:\\s+|(?:%1))+\\s*").arg(prefixRegExps.join(QStringLiteral(")|(?:"))); static QString regExpPattern; static QRegExp regExp; regExp.setCaseSensitivity(Qt::CaseInsensitive); if (regExpPattern != bigRegExp) { // the prefixes have changed, so update the regexp regExpPattern = bigRegExp; regExp.setPattern(regExpPattern); } if (regExp.isValid()) { QString tmp = subject; if (regExp.indexIn(tmp) == 0) { return tmp.remove(0, regExp.matchedLength()); } } else { qCWarning(MESSAGECORE_LOG) << "bigRegExp = \"" << bigRegExp << "\"\n" << "prefix regexp is invalid!"; } return subject; } void setEncodingFile(QUrl &url, const QString &encoding) { url.addQueryItem(QStringLiteral("charset"), encoding); } } } diff --git a/messageviewer/src/viewer/csshelperbase.cpp b/messageviewer/src/viewer/csshelperbase.cpp index 7bf15693..3048cd29 100644 --- a/messageviewer/src/viewer/csshelperbase.cpp +++ b/messageviewer/src/viewer/csshelperbase.cpp @@ -1,776 +1,776 @@ /* csshelper.cpp This file is part of KMail, the KDE mail client. Copyright (c) 2003 Marc Mutz KMail is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. KMail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #include "csshelperbase.h" #include "utils/iconnamecache.h" #include #include #include #include namespace MessageViewer { namespace { // some QColor manipulators that hide the ugly QColor API w.r.t. HSV: inline QColor darker(const QColor &c) { int h, s, v; c.getHsv(&h, &s, &v); return QColor::fromHsv(h, s, v * 4 / 5); } inline QColor desaturate(const QColor &c) { int h, s, v; c.getHsv(&h, &s, &v); return QColor::fromHsv(h, s / 8, v); } inline QColor fixValue(const QColor &c, int newV) { int h, s, v; c.getHsv(&h, &s, &v); return QColor::fromHsv(h, s, newV); } inline int getValueOf(const QColor &c) { int h, s, v; c.getHsv(&h, &s, &v); return v; } } CSSHelperBase::CSSHelperBase(const QPaintDevice *pd) : mRecycleQuoteColors(false) , mShrinkQuotes(false) , cHtmlWarning(QColor(0xFF, 0x40, 0x40)) , mPaintDevice(pd) { recalculatePGPColors(); const QString imgSrcShow = QStringLiteral("quicklistOpened.png"); const QString imgSrcHide = QStringLiteral("quicklistClosed.png"); imgShowUrl = QUrl::fromLocalFile(MessageViewer::IconNameCache::instance()->iconPathFromLocal(imgSrcShow)).url(); imgHideUrl = QUrl::fromLocalFile(MessageViewer::IconNameCache::instance()->iconPathFromLocal(imgSrcHide)).url(); } CSSHelperBase::~CSSHelperBase() { } void CSSHelperBase::recalculatePGPColors() { // determine the frame and body color for PGP messages from the header color // if the header color equals the background color then the other colors are // also set to the background color (-> old style PGP message viewing) // else // the brightness of the frame is set to 4/5 of the brightness of the header // and in case of a light background color // the saturation of the body is set to 1/8 of the saturation of the header // while in case of a dark background color // the value of the body is set to the value of the background color // Check whether the user uses a light color scheme const int vBG = getValueOf(mBackgroundColor); const bool lightBG = vBG >= 128; if (cPgpOk1H == mBackgroundColor) { cPgpOk1F = mBackgroundColor; cPgpOk1B = mBackgroundColor; } else { cPgpOk1F = darker(cPgpOk1H); cPgpOk1B = lightBG ? desaturate(cPgpOk1H) : fixValue(cPgpOk1H, vBG); } if (cPgpOk0H == mBackgroundColor) { cPgpOk0F = mBackgroundColor; cPgpOk0B = mBackgroundColor; } else { cPgpOk0F = darker(cPgpOk0H); cPgpOk0B = lightBG ? desaturate(cPgpOk0H) : fixValue(cPgpOk0H, vBG); } if (cPgpWarnH == mBackgroundColor) { cPgpWarnF = mBackgroundColor; cPgpWarnB = mBackgroundColor; } else { cPgpWarnF = darker(cPgpWarnH); cPgpWarnB = lightBG ? desaturate(cPgpWarnH) : fixValue(cPgpWarnH, vBG); } if (cPgpErrH == mBackgroundColor) { cPgpErrF = mBackgroundColor; cPgpErrB = mBackgroundColor; } else { cPgpErrF = darker(cPgpErrH); cPgpErrB = lightBG ? desaturate(cPgpErrH) : fixValue(cPgpErrH, vBG); } if (cPgpEncrH == mBackgroundColor) { cPgpEncrF = mBackgroundColor; cPgpEncrB = mBackgroundColor; } else { cPgpEncrF = darker(cPgpEncrH); cPgpEncrB = lightBG ? desaturate(cPgpEncrH) : fixValue(cPgpEncrH, vBG); } } QString CSSHelperBase::addEndBlockQuote(int numberBlock) const { QString blockQuote; for (int i = 0; i < numberBlock; ++i) { blockQuote += QLatin1String(""); } return blockQuote; } QString CSSHelperBase::addStartBlockQuote(int numberBlock) const { QString blockQuote; for (int i = 0; i < numberBlock; ++i) { blockQuote += QLatin1String("
"); } return blockQuote; } QString CSSHelperBase::cssDefinitions(bool fixed) const { return commonCssDefinitions() + QLatin1String("@media screen {\n\n") + screenCssDefinitions(this, fixed) + QLatin1String("}\n" "@media print {\n\n") + printCssDefinitions(fixed) + QLatin1String("}\n"); } QString CSSHelperBase::htmlHead(bool fixedFont) const { Q_UNUSED(fixedFont); return QStringLiteral("\n" "\n" "\n"); } QString CSSHelperBase::quoteFontTag(int level) const { if (level < 0) { level = 0; } static const int numQuoteLevels = 3; const int effectiveLevel = mRecycleQuoteColors ? level % numQuoteLevels + 1 : qMin(level + 1, numQuoteLevels); if (level >= numQuoteLevels) { return QStringLiteral("
").arg(effectiveLevel); } else { return QStringLiteral("
").arg(effectiveLevel); } } QString CSSHelperBase::fullAddressList() const { QString css = QStringLiteral("input[type=checkbox].addresslist_checkbox {display: none}\n" - ".addresslist_label_short {border: 1px; border-radius: 5px; padding: 0px 4px 0px 4px; white-space: nowrap}\n" - ".addresslist_label_full {border: 1px; border-radius: 5px; padding: 0px 6px 0px 6px; white-space: nowrap}\n"); + ".addresslist_label_short {border: 1px; border-radius: 5px; padding: 0px 10px 0px 10px; white-space: nowrap}\n" + ".addresslist_label_full {border: 1px; border-radius: 5px; padding: 0px 10px 0px 10px; white-space: nowrap}\n"); css += QStringLiteral(".addresslist_label_short {background-image:url(%1);\nbackground-repeat: no-repeat}\n").arg(imgShowUrl); css += QStringLiteral(".addresslist_label_full {background-image:url(%1);\nbackground-repeat: no-repeat}\n\n").arg(imgHideUrl); for (const QString &str : {QStringLiteral("Cc"), QStringLiteral("To"), QStringLiteral("Bcc")}) { css += QStringLiteral("input ~ span.fullFull%1AddressList {display: block}\n" "input ~ span.shortFull%1AddressList {display: none}\n" "input:checked ~ span.fullFull%1AddressList {display: none}\n" "input:checked ~ span.shortFull%1AddressList {display: block}\n\n").arg(str); } return css; } QString CSSHelperBase::nonQuotedFontTag() const { return QStringLiteral("
"); } QFont CSSHelperBase::bodyFont(bool fixed, bool print) const { return fixed ? (print ? mFixedPrintFont : mFixedFont) : (print ? mPrintFont : mBodyFont); } int CSSHelperBase::fontSize(bool fixed, bool print) const { return bodyFont(fixed, print).pointSize(); } namespace { int pointsToPixel(const QPaintDevice *pd, int pointSize) { return (pointSize * pd->logicalDpiY() + 36) / 72; } } static const char *const quoteFontSizes[] = { "85", "80", "75" }; QString CSSHelperBase::printCssDefinitions(bool fixed) const { const QString headerFont = QStringLiteral(" font-family: \"%1\" ! important;\n" " font-size: %2pt ! important;\n") .arg(mPrintFont.family()) .arg(mPrintFont.pointSize()); const QPalette &pal = QApplication::palette(); const QFont printFont = bodyFont(fixed, true /* print */); QString quoteCSS; if (printFont.italic()) { quoteCSS += QLatin1String(" font-style: italic ! important;\n"); } if (printFont.bold()) { quoteCSS += QLatin1String(" font-weight: bold ! important;\n"); } if (!quoteCSS.isEmpty()) { quoteCSS = QLatin1String("div.noquote {\n") + quoteCSS + QLatin1String("}\n\n"); } quoteCSS += quoteCssDefinition(); return QStringLiteral("body {\n" " font-family: \"%1\" ! important;\n" " font-size: %2pt ! important;\n" " color: #000000 ! important;\n" " background-color: #ffffff ! important\n" "}\n\n") .arg(printFont.family(), QString::number(printFont.pointSize())) + QStringLiteral("tr.textAtmH,\n" "tr.signInProgressH,\n" "tr.rfc822H,\n" "tr.encrH,\n" "tr.signOkKeyOkH,\n" "tr.signOkKeyBadH,\n" "tr.signWarnH,\n" "tr.signErrH,\n" "div.header {\n" "%1" "}\n\n" "div.fancy.header > div {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" " padding: 4px ! important;\n" " border: solid %3 1px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header > div a[href] { color: %3 ! important; }\n\n" "div.fancy.header > table.outer{\n" " all: inherit;\n" " width: auto ! important;\n" " border-spacing: 0;\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" " border-bottom: solid %3 1px ! important;\n" " border-left: solid %3 1px ! important;\n" " border-right: solid %3 1px ! important;\n" "}\n\n" "div.spamheader {\n" " display:none ! important;\n" "}\n\n" "div.htmlWarn {\n" " border: 2px solid #ffffff ! important;\n" " line-height: normal;\n" "}\n\n" "div.senderpic{\n" " font-size:0.8em ! important;\n" " border:1px solid black ! important;\n" " background-color:%2 ! important;\n" "}\n\n" "div.senderstatus{\n" " text-align:center ! important;\n" "}\n\n" "div.noprint {\n" " display:none ! important;\n" "}\n\n" ) .arg(headerFont, pal.color(QPalette::Background).name(), pal.color(QPalette::Foreground).name()) - + quoteCSS; + + quoteCSS + fullAddressList(); } QString CSSHelperBase::quoteCssDefinition() const { QString quoteCSS; QString blockQuote; for (int i = 0; i < 9; ++i) { blockQuote += QLatin1String("blockquote "); quoteCSS += QString::fromLatin1("%2{\n" " margin: 4pt 0 4pt 0;\n" " padding: 0 0 0 1em;\n" " border-left: 2px solid %1;\n" " unicode-bidi: -webkit-plaintext\n" "}\n\n").arg(quoteColorName(i)).arg(blockQuote); } quoteCSS += QLatin1String(".quotemarks{\n" " color:transparent;\n" " font-size:0px;\n" "}\n\n"); quoteCSS += QLatin1String(".quotemarksemptyline{\n" " color:transparent;\n" " font-size:0px;\n" " line-height: 12pt;\n" "}\n\n"); return quoteCSS; } QString CSSHelperBase::screenCssDefinitions(const CSSHelperBase *helper, bool fixed) const { const QString fgColor = mForegroundColor.name(); const QString bgColor = mBackgroundColor.name(); const QString linkColor = mLinkColor.name(); const QString headerFont = QStringLiteral(" font-family: \"%1\" ! important;\n" " font-size: %2px ! important;\n") .arg(mBodyFont.family()) .arg(pointsToPixel(helper->mPaintDevice, mBodyFont.pointSize())); const QString background = QStringLiteral(" background-color: %1 ! important;\n").arg(bgColor); const QString bodyFontSize = QString::number(pointsToPixel(helper->mPaintDevice, fontSize( fixed))) + QLatin1String("px"); const QPalette &pal = QApplication::palette(); QString quoteCSS; if (bodyFont(fixed).italic()) { quoteCSS += QLatin1String(" font-style: italic ! important;\n"); } if (bodyFont(fixed).bold()) { quoteCSS += QLatin1String(" font-weight: bold ! important;\n"); } if (!quoteCSS.isEmpty()) { quoteCSS = QLatin1String("div.noquote {\n") + quoteCSS + QLatin1String("}\n\n"); } // CSS definitions for quote levels 1-3 for (int i = 0; i < 3; ++i) { quoteCSS += QStringLiteral("div.quotelevel%1 {\n" " color: %2 ! important;\n") .arg(QString::number(i + 1), quoteColorName(i)); if (mQuoteFont.italic()) { quoteCSS += QLatin1String(" font-style: italic ! important;\n"); } if (mQuoteFont.bold()) { quoteCSS += QLatin1String(" font-weight: bold ! important;\n"); } if (mShrinkQuotes) { quoteCSS += QLatin1String(" font-size: ") + QString::fromLatin1(quoteFontSizes[i]) + QLatin1String("% ! important;\n"); } quoteCSS += QLatin1String("}\n\n"); } // CSS definitions for quote levels 4+ for (int i = 0; i < 3; ++i) { quoteCSS += QStringLiteral("div.deepquotelevel%1 {\n" " color: %2 ! important;\n") .arg(QString::number(i + 1), quoteColorName(i)); if (mQuoteFont.italic()) { quoteCSS += QLatin1String(" font-style: italic ! important;\n"); } if (mQuoteFont.bold()) { quoteCSS += QLatin1String(" font-weight: bold ! important;\n"); } if (mShrinkQuotes) { quoteCSS += QLatin1String(" font-size: 70% ! important;\n"); } quoteCSS += QLatin1String("}\n\n"); } quoteCSS += quoteCssDefinition(); return QStringLiteral("body {\n" " font-family: \"%1\" ! important;\n" " font-size: %2 ! important;\n" " color: %3 ! important;\n" "%4" "}\n\n") .arg(bodyFont(fixed).family(), bodyFontSize, fgColor, background) + /* This shouldn't be necessary because font properties are inherited automatically and causes wrong font settings with QTextBrowser because it doesn't understand the inherit statement QString::fromLatin1( "table {\n" " font-family: inherit ! important;\n" " font-size: inherit ! important;\n" " font-weight: inherit ! important;\n" "}\n\n" ) + */ QStringLiteral("a {\n" " color: %1 ! important;\n" " text-decoration: none ! important;\n" "}\n\n" "a.white {\n" " color: white ! important;\n" "}\n\n" "a.black {\n" " color: black ! important;\n" "}\n\n" "table.textAtm { background-color: %2 ! important; }\n\n" "tr.textAtmH {\n" " background-color: %3 ! important;\n" "%4" "}\n\n" "tr.textAtmB {\n" " background-color: %3 ! important;\n" "}\n\n" "table.signInProgress,\n" "table.rfc822 {\n" " background-color: %3 ! important;\n" "}\n\n" "tr.signInProgressH,\n" "tr.rfc822H {\n" "%4" "}\n\n") .arg(linkColor, fgColor, bgColor, headerFont) + QStringLiteral("table.encr {\n" " background-color: %1 ! important;\n" "}\n\n" "tr.encrH {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" "%4" "}\n\n" "tr.encrB { background-color: %5 ! important; }\n\n") .arg(cPgpEncrF.name(), cPgpEncrH.name(), cPgpEncrHT.name(), headerFont, cPgpEncrB.name()) + QStringLiteral("table.signOkKeyOk {\n" " background-color: %1 ! important;\n" "}\n\n" "tr.signOkKeyOkH {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" "%4" "}\n\n" "tr.signOkKeyOkB { background-color: %5 ! important; }\n\n") .arg(cPgpOk1F.name(), cPgpOk1H.name(), cPgpOk1HT.name(), headerFont, cPgpOk1B.name()) + QStringLiteral("table.signOkKeyBad {\n" " background-color: %1 ! important;\n" "}\n\n" "tr.signOkKeyBadH {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" "%4" "}\n\n" "tr.signOkKeyBadB { background-color: %5 ! important; }\n\n") .arg(cPgpOk0F.name(), cPgpOk0H.name(), cPgpOk0HT.name(), headerFont, cPgpOk0B.name()) + QStringLiteral("table.signWarn {\n" " background-color: %1 ! important;\n" "}\n\n" "tr.signWarnH {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" "%4" "}\n\n" "tr.signWarnB { background-color: %5 ! important; }\n\n") .arg(cPgpWarnF.name(), cPgpWarnH.name(), cPgpWarnHT.name(), headerFont, cPgpWarnB.name()) + QStringLiteral("table.signErr {\n" " background-color: %1 ! important;\n" "}\n\n" "tr.signErrH {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" "%4" "}\n\n" "tr.signErrB { background-color: %5 ! important; }\n\n") .arg(cPgpErrF.name(), cPgpErrH.name(), cPgpErrHT.name(), headerFont, cPgpErrB.name()) + QStringLiteral("div.htmlWarn {\n" " border: 2px solid %1 ! important;\n" " line-height: normal;\n" "}\n\n") .arg(cHtmlWarning.name()) + QStringLiteral("div.header {\n" "%1" "}\n\n" "div.fancy.header > div {\n" " background-color: %2 ! important;\n" " color: %3 ! important;\n" " border: solid %4 1px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header > div a[href] { color: %3 ! important; }\n\n" "div.fancy.header > div a[href]:hover { text-decoration: underline ! important; }\n\n" "div.fancy.header > div.spamheader {\n" " background-color: #cdcdcd ! important;\n" " border-top: 0px ! important;\n" " padding: 3px ! important;\n" " color: black ! important;\n" " font-weight: bold ! important;\n" " font-size: smaller ! important;\n" "}\n\n" "div.fancy.header > table.outer {\n" " all: inherit;\n" " width: auto ! important;\n" " border-spacing: 0;\n" " background-color: %5 ! important;\n" " color: %4 ! important;\n" " border-bottom: solid %4 1px ! important;\n" " border-left: solid %4 1px ! important;\n" " border-right: solid %4 1px ! important;\n" "}\n\n" "div.senderpic{\n" " padding: 0px ! important;\n" " font-size:0.8em ! important;\n" " border:1px solid %6 ! important;\n" " background-color:%5 ! important;\n" "}\n\n" "div.senderstatus{\n" " text-align:center ! important;\n" "}\n\n" ) .arg(headerFont) .arg(pal.color(QPalette::Highlight).name(), pal.color(QPalette::HighlightedText).name(), pal.color(QPalette::Foreground).name(), pal.color(QPalette::Background).name()) .arg(pal.color(QPalette::Mid).name()) + quoteCSS + fullAddressList(); } QString CSSHelperBase::commonCssDefinitions() const { const QPalette &pal = QApplication::palette(); const QString headerFont = QStringLiteral("font-family: \"%1\" ! important;\n" " font-size: %2px ! important;\n") .arg(mBodyFont.family()) .arg(pointsToPixel(this->mPaintDevice, mBodyFont.pointSize())); return QStringLiteral("div.header {\n" " margin-bottom: 10pt ! important;\n" "}\n\n" "table.textAtm {\n" " margin-top: 10pt ! important;\n" " margin-bottom: 10pt ! important;\n" "}\n\n" "tr.textAtmH,\n" "tr.textAtmB,\n" "tr.rfc822B {\n" " font-weight: normal ! important;\n" "}\n\n" "tr.signInProgressH,\n" "tr.rfc822H,\n" "tr.encrH,\n" "tr.signOkKeyOkH,\n" "tr.signOkKeyBadH,\n" "tr.signWarnH,\n" "tr.signErrH {\n" " font-weight: bold ! important;\n" "}\n\n" "tr.textAtmH td,\n" "tr.textAtmB td {\n" " padding: 3px ! important;\n" "}\n\n" "table.rfc822 {\n" " width: 100% ! important;\n" " border: solid 1px black ! important;\n" " margin-top: 10pt ! important;\n" " margin-bottom: 10pt ! important;\n" "}\n\n" "table.textAtm,\n" "table.encr,\n" "table.signWarn,\n" "table.signErr,\n" "table.signOkKeyBad,\n" "table.signOkKeyOk,\n" "table.signInProgress,\n" "div.fancy.header table {\n" " width: 100% ! important;\n" " border-width: 0px ! important;\n" " line-height: normal;\n" "}\n\n" "div.htmlWarn {\n" " margin: 0px 5% ! important;\n" " padding: 10px ! important;\n" " text-align: left ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header > div {\n" " font-weight: bold ! important;\n" " padding: 4px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header table {\n" " padding: 2px ! important;\n" // ### khtml bug: this is ignored " text-align: left ! important;\n" " border-collapse: separate ! important;\n" "}\n\n" "div.fancy.header table th {\n" " %3\n" " padding: 0px ! important;\n" " white-space: nowrap ! important;\n" " border-spacing: 0px ! important;\n" " text-align: left ! important;\n" " vertical-align: top ! important;\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " border: 1px ! important;\n" "}\n\n" "div.fancy.header table td {\n" " %3\n" " padding: 0px ! important;\n" " border-spacing: 0px ! important;\n" " text-align: left ! important;\n" " vertical-align: top ! important;\n" " width: 100% ! important;\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " border: 1px ! important;\n" "}\n\n" "div.fancy.header table a:hover {\n" " background-color: transparent ! important;\n" "}\n\n" "span.pimsmileytext {\n" " position: absolute;\n" " top: 0px;\n" " left: 0px;\n" " visibility: hidden;\n" "}\n\n" "img.pimsmileyimg {\n" "}\n\n" "div.quotelevelmark {\n" " position: absolute;\n" " margin-left:-10px;\n" "}\n\n").arg(pal.color(QPalette::Background).name()).arg(pal.color(QPalette:: Foreground).name()) .arg(headerFont) ; } void CSSHelperBase::setBodyFont(const QFont &font) { mBodyFont = font; } void CSSHelperBase::setPrintFont(const QFont &font) { mPrintFont = font; } QString CSSHelperBase::quoteColorName(int level) const { return quoteColor(level).name(); } QColor CSSHelperBase::quoteColor(int level) const { const int actualLevel = qMax(level, 0) % 3; return mQuoteColor[actualLevel]; } QColor CSSHelperBase::pgpWarnColor() const { return cPgpWarnH; } } diff --git a/mimetreeparser/autotests/data/mailheader.css b/mimetreeparser/autotests/data/mailheader.css index 22214efa..7058fd4e 100644 --- a/mimetreeparser/autotests/data/mailheader.css +++ b/mimetreeparser/autotests/data/mailheader.css @@ -1,535 +1,558 @@ div.header { margin-bottom: 10pt ! important; } table.textAtm { margin-top: 10pt ! important; margin-bottom: 10pt ! important; } tr.textAtmH, tr.textAtmB, tr.rfc822B { font-weight: normal ! important; } tr.signInProgressH, tr.rfc822H, tr.encrH, tr.signOkKeyOkH, tr.signOkKeyBadH, tr.signWarnH, tr.signErrH { font-weight: bold ! important; } tr.textAtmH td, tr.textAtmB td { padding: 3px ! important; } table.rfc822 { width: 100% ! important; border: solid 1px black ! important; margin-top: 10pt ! important; margin-bottom: 10pt ! important; } table.textAtm, table.encr, table.signWarn, table.signErr, table.signOkKeyBad, table.signOkKeyOk, table.signInProgress, div.fancy.header table { width: 100% ! important; border-width: 0px ! important; line-height: normal; } div.htmlWarn { margin: 0px 5% ! important; padding: 10px ! important; text-align: left ! important; line-height: normal; } div.fancy.header > div { font-weight: bold ! important; padding: 4px ! important; line-height: normal; } div.fancy.header table { padding: 2px ! important; text-align: left ! important; border-collapse: separate ! important; } div.fancy.header table th { font-family: "Sans Serif" ! important; font-size: 0px ! important; padding: 0px ! important; white-space: nowrap ! important; border-spacing: 0px ! important; text-align: left ! important; vertical-align: top ! important; background-color: #d6d2d0 ! important; color: #221f1e ! important; border: 1px ! important; } div.fancy.header table td { font-family: "Sans Serif" ! important; font-size: 0px ! important; padding: 0px ! important; border-spacing: 0px ! important; text-align: left ! important; vertical-align: top ! important; width: 100% ! important; background-color: #d6d2d0 ! important; color: #221f1e ! important; border: 1px ! important; } div.fancy.header table a:hover { background-color: transparent ! important; } span.pimsmileytext { position: absolute; top: 0px; left: 0px; visibility: hidden; } img.pimsmileyimg { } div.quotelevelmark { position: absolute; margin-left:-10px; } @media screen { body { font-family: "Sans Serif" ! important; font-size: 0px ! important; color: #1f1c1b ! important; background-color: #ffffff ! important; } a { color: #0057ae ! important; text-decoration: none ! important; } a.white { color: white ! important; } a.black { color: black ! important; } table.textAtm { background-color: #1f1c1b ! important; } tr.textAtmH { background-color: #ffffff ! important; font-family: "Sans Serif" ! important; font-size: 0px ! important; } tr.textAtmB { background-color: #ffffff ! important; } table.signInProgress, table.rfc822 { background-color: #ffffff ! important; } tr.signInProgressH, tr.rfc822H { font-family: "Sans Serif" ! important; font-size: 0px ! important; } table.encr { background-color: #0069cc ! important; } tr.encrH { background-color: #0080ff ! important; color: #ffffff ! important; font-family: "Sans Serif" ! important; font-size: 0px ! important; } tr.encrB { background-color: #e0f0ff ! important; } table.signOkKeyOk { background-color: #33cc33 ! important; } tr.signOkKeyOkH { background-color: #40ff40 ! important; color: #27ae60 ! important; font-family: "Sans Serif" ! important; font-size: 0px ! important; } tr.signOkKeyOkB { background-color: #e8ffe8 ! important; } table.signOkKeyBad { background-color: #cccc33 ! important; } tr.signOkKeyBadH { background-color: #ffff40 ! important; color: #f67400 ! important; font-family: "Sans Serif" ! important; font-size: 0px ! important; } tr.signOkKeyBadB { background-color: #ffffe8 ! important; } table.signWarn { background-color: #cccc33 ! important; } tr.signWarnH { background-color: #ffff40 ! important; color: #f67400 ! important; font-family: "Sans Serif" ! important; font-size: 0px ! important; } tr.signWarnB { background-color: #ffffe8 ! important; } table.signErr { background-color: #cc0000 ! important; } tr.signErrH { background-color: #ff0000 ! important; color: #da4453 ! important; font-family: "Sans Serif" ! important; font-size: 0px ! important; } tr.signErrB { background-color: #ffe0e0 ! important; } div.htmlWarn { border: 2px solid #ff4040 ! important; line-height: normal; } div.header { font-family: "Sans Serif" ! important; font-size: 0px ! important; } div.fancy.header > div { background-color: #43ace8 ! important; color: #ffffff ! important; border: solid #221f1e 1px ! important; line-height: normal; } div.fancy.header > div a[href] { color: #ffffff ! important; } div.fancy.header > div a[href]:hover { text-decoration: underline ! important; } div.fancy.header > div.spamheader { background-color: #cdcdcd ! important; border-top: 0px ! important; padding: 3px ! important; color: black ! important; font-weight: bold ! important; font-size: smaller ! important; } div.fancy.header > table.outer { background-color: #d6d2d0 ! important; color: #221f1e ! important; border-bottom: solid #221f1e 1px ! important; border-left: solid #221f1e 1px ! important; border-right: solid #221f1e 1px ! important; } div.senderpic{ padding: 0px ! important; font-size:0.8em ! important; border:1px solid #b3aba7 ! important; background-color:#d6d2d0 ! important; } div.senderstatus{ text-align:center ! important; } div.quotelevel1 { color: #008000 ! important; font-style: italic ! important; } div.quotelevel2 { color: #007000 ! important; font-style: italic ! important; } div.quotelevel3 { color: #006000 ! important; font-style: italic ! important; } div.deepquotelevel1 { color: #008000 ! important; font-style: italic ! important; } div.deepquotelevel2 { color: #007000 ! important; font-style: italic ! important; } div.deepquotelevel3 { color: #006000 ! important; font-style: italic ! important; } blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #008000; unicode-bidi: -webkit-plaintext } blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #007000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #006000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #008000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #007000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #006000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #008000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #007000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #006000; unicode-bidi: -webkit-plaintext } .quotemarks{ color:transparent; font-size:0px; } +input[type=checkbox].addresslist_checkbox {display: none} +.addresslist_label_short {border: 1px; border-radius: 5px; padding: 0px 10px 0px 10px; white-space: nowrap} +.addresslist_label_full {border: 1px; border-radius: 5px; padding: 0px 10px 0px 10px; white-space: nowrap} +.addresslist_label_short {background-image:url(file:///opt/kde5-qt5.10/share/libmessageviewer/pics/quicklistOpened.png); +background-repeat: no-repeat} +.addresslist_label_full {background-image:url(file:///opt/kde5-qt5.10/share/libmessageviewer/pics/quicklistClosed.png); +background-repeat: no-repeat} + +input ~ span.fullFullCcAddressList {display: block} +input ~ span.shortFullCcAddressList {display: none} +input:checked ~ span.fullFullCcAddressList {display: none} +input:checked ~ span.shortFullCcAddressList {display: block} + +input ~ span.fullFullToAddressList {display: block} +input ~ span.shortFullToAddressList {display: none} +input:checked ~ span.fullFullToAddressList {display: none} +input:checked ~ span.shortFullToAddressList {display: block} + +input ~ span.fullFullBccAddressList {display: block} +input ~ span.shortFullBccAddressList {display: none} +input:checked ~ span.fullFullBccAddressList {display: none} +input:checked ~ span.shortFullBccAddressList {display: block} + } @media print { body { font-family: "Sans Serif" ! important; font-size: 9pt ! important; color: #000000 ! important; background-color: #ffffff ! important } tr.textAtmH, tr.signInProgressH, tr.rfc822H, tr.encrH, tr.signOkKeyOkH, tr.signOkKeyBadH, tr.signWarnH, tr.signErrH, div.header { font-family: "Sans Serif" ! important; font-size: 9pt ! important; } div.fancy.header > div { background-color: #d6d2d0 ! important; color: #221f1e ! important; padding: 4px ! important; border: solid #221f1e 1px ! important; line-height: normal; } div.fancy.header > div a[href] { color: #221f1e ! important; } div.fancy.header > table.outer{ background-color: #d6d2d0 ! important; color: #221f1e ! important; border-bottom: solid #221f1e 1px ! important; border-left: solid #221f1e 1px ! important; border-right: solid #221f1e 1px ! important; } div.spamheader { display:none ! important; } div.htmlWarn { border: 2px solid #ffffff ! important; line-height: normal; } div.senderpic{ font-size:0.8em ! important; border:1px solid black ! important; background-color:#d6d2d0 ! important; } div.senderstatus{ text-align:center ! important; } div.noprint { display:none ! important; } blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #008000; unicode-bidi: -webkit-plaintext } blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #007000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #006000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #008000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #007000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #006000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #008000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #007000; unicode-bidi: -webkit-plaintext } blockquote blockquote blockquote blockquote blockquote blockquote blockquote blockquote blockquote { margin: 4pt 0 4pt 0; padding: 0 0 0 1em; border-left: 2px solid #006000; unicode-bidi: -webkit-plaintext } .quotemarks{ color:transparent; font-size:0px; } .quotemarksemptyline{ color:transparent; font-size:0px; line-height: 12pt; } input[type=checkbox].addresslist_checkbox {display: none} -.addresslist_label_short {border: 1px; border-radius: 5px; padding: 0px 4px 0px 4px; white-space: nowrap} -.addresslist_label_full {border: 1px; border-radius: 5px; padding: 0px 6px 0px 6px; white-space: nowrap} +.addresslist_label_short {border: 1px; border-radius: 5px; padding: 0px 10px 0px 10px; white-space: nowrap} +.addresslist_label_full {border: 1px; border-radius: 5px; padding: 0px 10px 0px 10px; white-space: nowrap} .addresslist_label_short {background-image:url(file:///opt/kde5-qt5.10/share/libmessageviewer/pics/quicklistOpened.png); background-repeat: no-repeat} .addresslist_label_full {background-image:url(file:///opt/kde5-qt5.10/share/libmessageviewer/pics/quicklistClosed.png); background-repeat: no-repeat} input ~ span.fullFullCcAddressList {display: block} input ~ span.shortFullCcAddressList {display: none} input:checked ~ span.fullFullCcAddressList {display: none} input:checked ~ span.shortFullCcAddressList {display: block} input ~ span.fullFullToAddressList {display: block} input ~ span.shortFullToAddressList {display: none} input:checked ~ span.fullFullToAddressList {display: none} input:checked ~ span.shortFullToAddressList {display: block} input ~ span.fullFullBccAddressList {display: block} input ~ span.shortFullBccAddressList {display: none} input:checked ~ span.fullFullBccAddressList {display: none} input:checked ~ span.shortFullBccAddressList {display: block} }