diff --git a/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyle.cpp b/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyle.cpp index 4a44bcba..81f45782 100644 --- a/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyle.cpp +++ b/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyle.cpp @@ -1,228 +1,228 @@ /* Copyright (C) 2013-2018 Montel Laurent 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) any later version. 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "enterpriseheaderstyle.h" #include "messageviewer/headerstyle_util.h" #include "messageviewer/messageviewersettings.h" #include "messageviewer/headerstrategy.h" #include #include #include #include #include #include using namespace MessageCore; using namespace MessageViewer; QString EnterpriseHeaderStyle::format(KMime::Message *message) const { if (!message) { return QString(); } const HeaderStrategy *strategy = headerStrategy(); // The direction of the header is determined according to the direction // of the application layout. // However, the direction of the message subject within the header is // determined according to the contents of the subject itself. Since // the "Re:" and "Fwd:" prefixes would always cause the subject to be // considered left-to-right, they are ignored when determining its // direction. // colors depend on if it is encapsulated or not QColor fontColor(Qt::white); QString linkColor = QStringLiteral("class =\"white\""); const QColor activeColor = KColorScheme(QPalette::Active, KColorScheme::Selection). background().color(); QColor activeColorDark = activeColor.darker(130); // reverse colors for encapsulated if (!isTopLevel()) { activeColorDark = activeColor.darker(50); fontColor = QColor(Qt::black); linkColor = QStringLiteral("class =\"black\""); } QString imgpath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("libmessageviewer/pics/"), QStandardPaths::LocateDirectory)); - imgpath.prepend(QLatin1String("file:///")); + imgpath.prepend(QLatin1String("file://")); imgpath.append(QLatin1String("enterprise_")); const QString borderSettings(QStringLiteral(" padding-top: 0px; padding-bottom: 0px; border-width: 0px ")); QString headerStr; // 3D borders if (isTopLevel()) { headerStr += QLatin1String("
 
" "
 
"); } headerStr += QStringLiteral("
") + mHeaderStyleUtil.dateString(message, isPrinting(), /* shortDate */ MessageViewer::HeaderStyleUtil::CustomDate) + QStringLiteral("
" // #0057ae " \n" + + QStringLiteral("; border-collapse:collapse; top: 14px; min-width: 200px; \" cellpadding='0'> \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n" " \n") + attachment +QStringLiteral(" \n" " \n" " \n" + + imgpath + QStringLiteral("sp_right.png\" style=\"float: right; \"/> \n" " \n" " \n" "
\n"); headerStr += QStringLiteral("
\n" - "\n" + "\n" "
\n"); headerStr - += QStringLiteral(" \n"); + += QStringLiteral("
\n"); // subject if (strategy->showHeader(QStringLiteral("subject"))) { const KTextToHTML::Options flags = KTextToHTML::PreserveSpaces | KTextToHTML::ReplaceSmileys; headerStr += QStringLiteral(" \n" " \n" " \n" " \n"); } // from if (strategy->showHeader(QStringLiteral("from"))) { // We by design use the stripped mail address here, it is more enterprise-like. QString fromPart = StringUtil::emailAddrAsAnchor(message->from(), StringUtil::DisplayFullAddress, linkColor); if (!vCardName().isEmpty()) { fromPart += QStringLiteral("  ') + i18n("[vCard]") + QStringLiteral(""); } //TDDO strategy date //if ( strategy->showHeader( "date" ) ) headerStr += QStringLiteral(" \n" " \n" " " " "); } // to line if (strategy->showHeader(QStringLiteral("to"))) { headerStr += QStringLiteral(" " " " " " " \n"); } // cc line, if any if (strategy->showHeader(QStringLiteral("cc")) && message->cc(false)) { headerStr += QStringLiteral(" " " " " " " \n"); } // bcc line, if any if (strategy->showHeader(QStringLiteral("bcc")) && message->bcc(false)) { headerStr += QStringLiteral(" " " " " " " \n"); } // attachments QString attachment; if (isTopLevel()) { attachment = QStringLiteral("" - "" "" "" ""); } // header-bottom headerStr += QStringLiteral("
"); headerStr += mHeaderStyleUtil.subjectString(message, flags) + QStringLiteral("
") + i18n( "From: ") + QStringLiteral("") + fromPart + QStringLiteral("
") + i18n( "To: ") + QStringLiteral("") +StringUtil::emailAddrAsAnchor(message->to(), StringUtil::DisplayFullAddress, linkColor) +QStringLiteral("
") + i18n( "CC: ") + QStringLiteral("") +StringUtil::emailAddrAsAnchor(message->cc(), StringUtil::DisplayFullAddress, linkColor) +QStringLiteral("
") + i18n( "BCC: ") + QStringLiteral("") +StringUtil::emailAddrAsAnchor(message->bcc(), StringUtil::DisplayFullAddress, linkColor) +QStringLiteral("
" + "" "
" "
%1
" "
" "
" + + QStringLiteral("right.png);'>
\n" "
\n" " \n" + + imgpath + QStringLiteral("sw.png\" style=\"margin: 0px; height: 30px; overflow:hidden; \"/> \n" "
\n"); if (isPrinting()) { //provide a bit more left padding when printing //kolab/issue3254 (printed mail cut at the left side) headerStr += QLatin1String("
"); } else { headerStr += QLatin1String("
"); } // TODO // spam status // ### iterate over the rest of strategy->headerToDisplay() (or // ### all headers if DefaultPolicy == Display) (elsewhere, too) return headerStr; } const char *MessageViewer::EnterpriseHeaderStyle::name() const { return "enterprise"; }