[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim] /: Create modern Grantlee templates for Kontact and KMail splash pages
From:       Dan_Vrátil <dvratil () redhat ! com>
Date:       2015-10-14 12:13:56
Message-ID: E1ZmKwO-0008Nn-9d () scm ! kde ! org
[Download RAW message or body]

Git commit 7f73ede4917ce25d458ca8f09d84adedd0edc9ae by Dan Vrátil.
Committed on 14/10/2015 at 12:13.
Pushed by dvratil into branch 'master'.

Create modern Grantlee templates for Kontact and KMail splash pages

REVIEW: 125577

M  +3    -4    kmail/about/CMakeLists.txt
A  +44   -0    kmail/about/introduction_kmail.html
D  +0    -17   kmail/about/kmail.css
D  +0    -66   kmail/about/main.html
D  +-    --    kmail/about/top-left-kmail.png
M  +40   -74   kmail/kmreaderwin.cpp
M  +1    -1    kmail/kmreaderwin.h
M  +1    -0    kontact/src/CMakeLists.txt
M  +4    -4    kontact/src/about/CMakeLists.txt
A  +39   -0    kontact/src/about/introduction_kontact.html
D  +0    -17   kontact/src/about/kontact.css
A  +7    -0    kontact/src/about/loading_kontact.html
D  +0    -66   kontact/src/about/main.html
D  +-    --    kontact/src/about/top-left-kontact.png
M  +45   -77   kontact/src/mainwindow.cpp
M  +2    -2    kontact/src/mainwindow.h
M  +0    -1    messageviewer/CMakeLists.txt
M  +2    -0    messageviewer/src/CMakeLists.txt
A  +1    -0    messageviewer/src/about/CMakeLists.txt
A  +7    -0    messageviewer/src/about/default/CMakeLists.txt
A  +-    --    messageviewer/src/about/default/background.png
A  +98   -0    messageviewer/src/about/default/main.css
A  +36   -0    messageviewer/src/about/default/main.html
A  +4    -0    messageviewer/src/about/default/splash.theme
A  +10   -0    messageviewer/src/about/default/status.html
M  +5    -0    messageviewer/src/viewer/mailwebview.cpp
M  +2    -2    messageviewer/src/viewer/viewer.cpp
M  +3    -2    messageviewer/src/viewer/viewer.h
M  +23   -19   messageviewer/src/viewer/viewer_p.cpp
M  +4    -4    messageviewer/src/viewer/viewer_p.h

http://commits.kde.org/kdepim/7f73ede4917ce25d458ca8f09d84adedd0edc9ae

diff --git a/kmail/about/CMakeLists.txt b/kmail/about/CMakeLists.txt
index c10672a..a62014d 100644
--- a/kmail/about/CMakeLists.txt
+++ b/kmail/about/CMakeLists.txt
@@ -1,5 +1,4 @@
 install(FILES
-    top-left-kmail.png
-    main.html
-    kmail.css
-    DESTINATION ${KDE_INSTALL_DATADIR}/kmail2/about)
+    introduction_kmail.html
+    DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer/about/default
+)
diff --git a/kmail/about/introduction_kmail.html \
b/kmail/about/introduction_kmail.html new file mode 100644
index 0000000..3946e5c
--- /dev/null
+++ b/kmail/about/introduction_kmail.html
@@ -0,0 +1,44 @@
+{% extends "main.html" %}
+
+{% block box %}
+
+<h2>{% i18nc "%1 is version" "Welcome to KMail %1" _(version) %}</h2>
+
+<p>{% i18n "KMail is the email client by KDE. It is designed to be fully compatible \
with Internet mailing standards including IMAP, POP3 and SMTP." %} +</p>
+
+<p>{% i18n_var "KMail has many powerful features that are described in the <a \
href="help:/kmail/index.html">documentation</a>." as features %} +{{ features|safe }}
+</p>
+
+
+{% if importantChanges|length %}
+<p>{% i18n "Important changes since last version:" %}</p>
+<ul>
+    {% for change in importantChanges %}
+    <li>{{ change|safe }}</li>
+    {% endfor %}
+</ul>
+{% endif %}
+
+{% if newFeatures|length %}
+<p>{% i18n "Some of the new features in this release of KMail include:" %}</p>
+<ul>
+    {% for feature in newFeatures %}
+    <li>{{ feature|safe }}</li>
+    {% endfor %}
+</ul>
+{% endif %}
+
+{% if firstStart %}
+<p>{% i18n "Please take a moment to fill in the KMail configuration panel at
+            Settings->Configure KMail. You need to create at least a default \
identity and +            incoming as well as outgoing mail account." %}
+</p>
+{% endif %}
+
+<p>{% i18n "We hope that you will enjoy KMail." %}</p>
+<p>{% i18n_var "Thank you,<br/>The KMail Team" as thankYou %}{{ thankYou|safe }}</p>
+
+
+{% endblock box %}
diff --git a/kmail/about/kmail.css b/kmail/about/kmail.css
deleted file mode 100644
index 4cddf98..0000000
--- a/kmail/about/kmail.css
+++ /dev/null
@@ -1,17 +0,0 @@
-#headerL {
-  background-image: url(top-left-kmail.png);
-}
-
-#title {
-  right: 125px;
-}
-
-#tagline {
-  right: 125px;
-}
-
-#boxCenter {
-  padding: 1em;
-}
-
-/* vim:set sw=2 et nocindent smartindent: */
diff --git a/kmail/about/main.html b/kmail/about/main.html
deleted file mode 100644
index 6d86a45..0000000
--- a/kmail/about/main.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta name="generator" content=
-  "HTML Tidy for Linux/x86 (vers 1st August 2004), see www.w3.org" />
-
-  <style type="text/css">
-  /*<![CDATA[*/
-    @import "%1"; /* kde_infopage.css */
-    %2 /* maybe @import "kde_infopage_rtl.css"; */
-    @import "kmail.css";
-    body {font-size: %3px;}
-  /*]]>*/
-  </style>
-
-  <title>KMail</title>
-</head>
-
-<body>
-  <div id="header">
-    <div id="headerL"></div>
-    <div id="headerR"></div>
-
-    <div id="title">
-    %4 <!-- KMail -->
-    </div>
-
-    <div id="tagline">
-    %5 <!-- Catchphrase -->
-    </div>
-  </div>
-
-  <!-- the bar -->
-  <div id="bar">
-    <div id="barT"><div id="barTL"></div><div id="barTR"></div><div \
                id="barTC"></div></div>
-    <div id="barL">
-      <div id="barR">
-        <div id="barCenter" class="bar_text">
-      %6<!-- KMail is ... -->
-        </div>
-      </div>
-    </div>
-    <div id="barB"><div id="barBL"></div><div id="barBR"></div><div \
                id="barBC"></div></div>
-  </div>
-
-  <!-- the main text box -->
-  <div id="box">
-    <div id="boxT"><div id="boxTL"></div><div id="boxTR"></div><div \
                id="boxTC"></div></div>
-    <div id="boxL">
-      <div id="boxR">
-        <div id="boxCenter">
-        <!--Welcome to KMail-->
-	%7
-        </div>
-      </div>
-    </div>
-    <div id="boxB"><div id="boxBL"></div><div id="boxBR"></div><div \
                id="boxBC"></div></div>
-  </div>
-
-  <div id="footer"><div id="footerL"></div><div id="footerR"></div></div>
-</body>
-</html>
-<!-- vim:set sw=2 et nocindent smartindent: -->
diff --git a/kmail/about/top-left-kmail.png b/kmail/about/top-left-kmail.png
deleted file mode 100644
index f705363..0000000
Binary files a/kmail/about/top-left-kmail.png and /dev/null differ
diff --git a/kmail/kmreaderwin.cpp b/kmail/kmreaderwin.cpp
index bbed9ac..40ec240 100644
--- a/kmail/kmreaderwin.cpp
+++ b/kmail/kmreaderwin.cpp
@@ -305,102 +305,68 @@ QString KMReaderWin::newFeaturesMD5()
     return QLatin1String(md5.result().toBase64());
 }
 
-void KMReaderWin::displaySplashPage(const QString &info)
+void KMReaderWin::displaySplashPage(const QString &templateName, const QVariantHash \
&_data)  {
-    mViewer->displaySplashPage(info);
+    QVariantHash data = _data;
+    if (!data.contains(QStringLiteral("icon"))) {
+         data[QStringLiteral("icon")] = QStringLiteral("kmail");
+    }
+    if (!data.contains(QStringLiteral("name"))) {
+        data[QStringLiteral("name")] = i18n("KMail");
+    }
+    if (!data.contains(QStringLiteral("subtitle"))) {
+        data[QStringLiteral("subtitle")] = i18n("The KDE Mail Client");
+    }
+
+    mViewer->displaySplashPage(templateName, data);
 }
 
 void KMReaderWin::displayBusyPage()
 {
-    const QString info =
-        i18n("<h2 style='margin-top: 0px;'>Retrieving Folder Contents</h2><p>Please \
                wait . . .</p>&nbsp;");
-
-    displaySplashPage(info);
+    displaySplashPage(QStringLiteral("status.html"),
+                      { { QStringLiteral("title"), i18n("Retrieving Folder \
Contents") }, +                        { QStringLiteral("subtext"), i18n("Please wait \
. . .") } });  }
 
 void KMReaderWin::displayOfflinePage()
 {
-    const QString info =
-        i18n("<h2 style='margin-top: 0px;'>Offline</h2><p>KMail is currently in \
                offline mode. "
-             "Click <a href=\"kmail:goOnline\">here</a> to go online . . \
                .</p>&nbsp;");
-
-    displaySplashPage(info);
+    displaySplashPage(QStringLiteral("status.html"),
+                      { { QStringLiteral("title"), i18n("Offline") },
+                        { QStringLiteral("subtext"), i18n("KMail is currently in \
offline mode. " +                                                          "Click <a \
href=\"kmail:goOnline\">here</a> to go online . . .</p>") } +                      \
});  }
 
 void KMReaderWin::displayResourceOfflinePage()
 {
-    const QString info =
-        i18n("<h2 style='margin-top: 0px;'>Offline</h2><p>Account is currently in \
                offline mode. "
-             "Click <a href=\"kmail:goResourceOnline\">here</a> to go online . . \
                .</p>&nbsp;");
-
-    displaySplashPage(info);
+    displaySplashPage(QStringLiteral("status.html"),
+                      { { QStringLiteral("title"), i18n("Offline") },
+                        { QStringLiteral("subtext"),i18n("Account is currently in \
offline mode. " +                                                         "Click <a \
href=\"kmail:goResourceOnline\">here</a> to go online . . .</p>") } +                 \
});  }
 
 void KMReaderWin::displayAboutPage()
 {
-    KLocalizedString info =
-        ki18nc("%1: KMail version; %2: help:// URL; "
-               "%3: generated list of new features; "
-               "%4: First-time user text (only shown on first start); "
-               "%5: generated list of important changes; "
-               "--- end of comment ---",
-               "<h2 style='margin-top: 0px;'>Welcome to KMail %1</h2><p>KMail is the \
                email client by KDE. "
-               "It is designed to be fully compatible with "
-               "Internet mailing standards including MIME, SMTP, POP3, and IMAP."
-               "</p>\n"
-               "<ul><li>KMail has many powerful features which are described in the \
                "
-               "<a href=\"%2\">documentation</a></li>\n"
-               "%5\n" // important changes
-               "%3\n" // new features
-               "%4\n" // first start info
-               "<p>We hope that you will enjoy KMail.</p>\n"
-               "<p>Thank you,</p>\n"
-               "<p style='margin-bottom: 0px'>&nbsp; &nbsp; The KMail Team</p>")
-        .subs(QStringLiteral(KDEPIM_VERSION))
-        .subs(QStringLiteral("help:/kmail/index.html"));
-
-    if ((numKMailNewFeatures > 1) || (numKMailNewFeatures == 1 && \
                strlen(kmailNewFeatures[0]) > 0)) {
-        QString featuresText =
-            i18n("<p>Some of the new features in this release of KMail include "
-                 "(compared to KMail %1, which is part of KDE Software Compilation \
                %2):</p>\n",
-                 QLatin1String("1.13"), QLatin1String(KDEPIM_VERSION));  // prior \
                KMail and KDE version
-        featuresText += QLatin1String("<ul>\n");
-        for (int i = 0; i < numKMailNewFeatures; ++i) {
-            featuresText += QLatin1String("<li>") + i18n(kmailNewFeatures[i]) + \
                QLatin1String("</li>\n");
-        }
-        featuresText += QLatin1String("</ul>\n");
-        info = info.subs(featuresText);
-    } else {
-        info = info.subs(QString());    // remove the place holder
-    }
+    QVariantHash data;
+    data[QStringLiteral("version")] = QStringLiteral(KDEPIM_VERSION);
+    data[QStringLiteral("firstStart")] = kmkernel->firstStart();
 
-    if (kmkernel->firstStart()) {
-        info = info.subs(i18n("<p>Please take a moment to fill in the KMail "
-                              "configuration panel at Settings-&gt;Configure "
-                              "KMail.\n"
-                              "You need to create at least a default identity and "
-                              "an incoming as well as outgoing mail account."
-                              "</p>\n"));
-    } else {
-        info = info.subs(QString());   // remove the place holder
+    QVariantList features;
+    features.reserve(numKMailNewFeatures);
+    for (int i = 0; i < numKMailNewFeatures; ++i) {
+        features.push_back(i18n(kmailNewFeatures[i]));
     }
+    data[QStringLiteral("newFeatures")] = features;
 
-    if ((numKMailChanges > 1) || (numKMailChanges == 1 && strlen(kmailChanges[0]) > \
                0)) {
-        QString changesText =
-            i18n("<p><span style='font-size:125%; font-weight:bold;'>"
-                 "Important changes</span> (compared to KMail %1):</p>\n",
-                 QLatin1String("1.13"));
-        changesText += QLatin1String("<ul>\n");
-        for (int i = 0; i < numKMailChanges; ++i) {
-            changesText += i18n("<li>%1</li>\n", i18n(kmailChanges[i]));
-        }
-        changesText += QLatin1String("</ul>\n");
-        info = info.subs(changesText);
-    } else {
-        info = info.subs(QString());    // remove the place holder
+    QVariantList changes;
+    changes.reserve(numKMailChanges);
+    for (int i = 0; i < numKMailChanges; ++i) {
+        features.push_back(i18n(kmailChanges[i]));
     }
+    data[QStringLiteral("importantChanges")] = changes;
 
-    displaySplashPage(info.toString());
+    displaySplashPage(QStringLiteral("introduction_kmail.html"), data);
 }
 
 void KMReaderWin::slotFind()
diff --git a/kmail/kmreaderwin.h b/kmail/kmreaderwin.h
index eac58e3..ed09481 100644
--- a/kmail/kmreaderwin.h
+++ b/kmail/kmreaderwin.h
@@ -105,7 +105,7 @@ public:
     static QString newFeaturesMD5();
 
     /** Display a generic HTML splash page instead of a message */
-    void displaySplashPage(const QString &info);
+    void displaySplashPage(const QString &templateName, const QVariantHash &data);
 
     /** Display the about page instead of a message */
     void displayAboutPage();
diff --git a/kontact/src/CMakeLists.txt b/kontact/src/CMakeLists.txt
index ca52422..6419a72 100644
--- a/kontact/src/CMakeLists.txt
+++ b/kontact/src/CMakeLists.txt
@@ -31,6 +31,7 @@ PRIVATE
   KF5::KCMUtils
   KF5::WebKit
   KF5::Libkdepim
+  KF5::GrantleeTheme
 )
 
 set_target_properties(kontactprivate PROPERTIES
diff --git a/kontact/src/about/CMakeLists.txt b/kontact/src/about/CMakeLists.txt
index 123fb3c..d6909e9 100644
--- a/kontact/src/about/CMakeLists.txt
+++ b/kontact/src/about/CMakeLists.txt
@@ -1,5 +1,5 @@
 install(FILES
-    top-left-kontact.png
-    main.html
-    kontact.css
-    DESTINATION ${KDE_INSTALL_DATADIR}/kontact/about)
+    introduction_kontact.html
+    loading_kontact.html
+    DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer/about/default
+)
diff --git a/kontact/src/about/introduction_kontact.html \
b/kontact/src/about/introduction_kontact.html new file mode 100644
index 0000000..f384d25
--- /dev/null
+++ b/kontact/src/about/introduction_kontact.html
@@ -0,0 +1,39 @@
+{% extends "main.html" %}
+
+{% block style %}
+.links {
+    margin: auto;
+}
+
+.links td {
+    padding-top: 5px;
+    padding-bottom: 5px;
+}
+
+{% endblock style %}
+
+{% block box %}
+
+<div class="center">
+    <h2>{% i18n "Welcome to Kontact %1" _(version) %}</h2>
+    <p>{% i18n "Kontact handles your e-mail, address book, calendar, to-do list and \
more." %}</p> +</div>
+
+<table class="links">
+    {% for link in links %}
+    <tr>
+        <td>
+            <a href="{{ link.url }}">{% icon link.icon desktop %}</a>
+        <td>
+        <td>
+            <a href="{{ link.url }}">{{ link.title }}</a><br/>
+            <small>{{ link.subtext }}</small>
+        </td>
+    </tr>
+    {% endfor %}
+</table>
+
+<span><a href="exec:/switch">{% i18n "Skip this introduction" %}</a></span>
+
+{% endblock box %}
+
diff --git a/kontact/src/about/kontact.css b/kontact/src/about/kontact.css
deleted file mode 100644
index 59de61d..0000000
--- a/kontact/src/about/kontact.css
+++ /dev/null
@@ -1,17 +0,0 @@
-#headerL {
-  background-image: url(top-left-kontact.png);
-}
-
-#title {
-  right: 125px;
-}
-
-#tagline {
-  right: 125px;
-}
-
-#subtext {
-  font-style: italic;
-}
-
-/* vim:set sw=2 et nocindent smartindent: */
diff --git a/kontact/src/about/loading_kontact.html \
b/kontact/src/about/loading_kontact.html new file mode 100644
index 0000000..b1ea1e7
--- /dev/null
+++ b/kontact/src/about/loading_kontact.html
@@ -0,0 +1,7 @@
+{% extends "main.html" %}
+
+{% block box %}
+
+<h2>{% i18n "Loading Kontact ..." %}</h2>
+
+{% endblock box %}
diff --git a/kontact/src/about/main.html b/kontact/src/about/main.html
deleted file mode 100644
index 60845da..0000000
--- a/kontact/src/about/main.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-  <meta name="generator" content=
-  "HTML Tidy for Linux/x86 (vers 1st August 2004), see www.w3.org" />
-
-  <style type="text/css">
-  /*<![CDATA[*/
-    @import "%1"; /* kde_infopage.css */
-    %2 /* maybe @import "kde_infopage_rtl.css"; */
-    @import "kontact.css";
-    body {font-size: %3px;}
-  /*]]>*/
-  </style>
-
-  <title>Kontact</title>
-</head>
-
-<body>
-  <div id="header">
-    <div id="headerL"></div>
-    <div id="headerR"></div>
-
-    <div id="title">
-    %4 <!-- Kontact -->
-    </div>
-
-    <div id="tagline">
-    %5 <!-- Catchphrase -->
-    </div>
-  </div>
-
-  <!-- the bar -->
-  <div id="bar">
-    <div id="barT"><div id="barTL"></div><div id="barTR"></div><div \
                id="barTC"></div></div>
-    <div id="barL">
-      <div id="barR">
-        <div id="barCenter" class="bar_text">
-      %6<!-- Kontact is ... -->
-        </div>
-      </div>
-    </div>
-    <div id="barB"><div id="barBL"></div><div id="barBR"></div><div \
                id="barBC"></div></div>
-  </div>
-
-  <!-- the main text box -->
-  <div id="box">
-    <div id="boxT"><div id="boxTL"></div><div id="boxTR"></div><div \
                id="boxTC"></div></div>
-    <div id="boxL">
-      <div id="boxR">
-        <div id="boxCenter">
-        <!--Welcome to Kontact-->
-	%7
-        </div>
-      </div>
-    </div>
-    <div id="boxB"><div id="boxBL"></div><div id="boxBR"></div><div \
                id="boxBC"></div></div>
-  </div>
-
-  <div id="footer"><div id="footerL"></div><div id="footerR"></div></div>
-</body>
-</html>
-<!-- vim:set sw=2 et nocindent smartindent: -->
diff --git a/kontact/src/about/top-left-kontact.png \
b/kontact/src/about/top-left-kontact.png deleted file mode 100644
index 94d7248..0000000
Binary files a/kontact/src/about/top-left-kontact.png and /dev/null differ
diff --git a/kontact/src/mainwindow.cpp b/kontact/src/mainwindow.cpp
index 8725b5e..559bd86 100644
--- a/kontact/src/mainwindow.cpp
+++ b/kontact/src/mainwindow.cpp
@@ -76,6 +76,10 @@ using namespace Kontact;
 #include <QHBoxLayout>
 #include <QApplication>
 #include <KAboutData>
+#include <QFontDatabase>
+
+#include <grantleetheme/grantleethememanager.h>
+#include <grantleetheme/grantleetheme.h>
 
 // Define the maximum time Kontact waits for KSycoca to become available.
 static const int KSYCOCA_WAIT_TIMEOUT = 10;
@@ -261,7 +265,7 @@ void MainWindow::initObject()
         selectPlugin(mCurrentPlugin);
     }
 
-    paintAboutScreen(introductionString());
+    paintAboutScreen(QStringLiteral("introduction_kontact.html"), \
introductionData());  \
Prefs::setLastVersionSeen(KAboutData::applicationData().version());  }
 
@@ -360,12 +364,7 @@ void MainWindow::initWidgets()
 
     initAboutScreen();
 
-    const QString loading =
-        i18nc("@item",
-              "<h2 style='text-align:center; margin-top: 0px; margin-bottom: \
                0px'>%1</h2>",
-              i18nc("@item:intext", "Loading Kontact..."));
-
-    paintAboutScreen(loading);
+    paintAboutScreen(QStringLiteral("loading_kontact.html"), QVariantHash());
 
     KPIM::ProgressStatusBarWidget *progressStatusBarWidget = new \
KPIM::ProgressStatusBarWidget(statusBar(), this);  
@@ -380,31 +379,20 @@ void MainWindow::initWidgets()
     mSplitter->setCollapsible(1, false);
 }
 
-void MainWindow::paintAboutScreen(const QString &msg)
+void MainWindow::paintAboutScreen(const QString &templateName, const QVariantHash \
&data)  {
-    QString location = QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
                QStringLiteral("kontact/about/main.html"));
-    QFile f(location);
-    if (!f.open(QIODevice::ReadOnly)) {
-        qCWarning(KONTACT_LOG) << "Failed to load about page: " << f.errorString();
-        return;
-    }
-    QString content = QString::fromLocal8Bit(f.readAll());
-    f.close();
-    content = content.arg(QLatin1String("file:") + \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
                QStringLiteral("/kf5/infopage/kde_infopage.css")));
-    if (QApplication::isRightToLeft()) {
-        content =
-            content.arg(QStringLiteral("@import \"%1\";")).
-            arg(QLatin1String("file:") + \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("/kf5/infopage/kde_infopage_rtl.css"))); +    \
GrantleeTheme::ThemeManager manager(QStringLiteral("splashPage"), +                   \
QStringLiteral("splash.theme"), +                                        Q_NULLPTR,
+                                        QStringLiteral("messageviewer/about/"));
+    GrantleeTheme::Theme theme = manager.theme(QStringLiteral("default"));
+    if (!theme.isValid()) {
+        qCDebug(KONTACT_LOG) << "Theme error: failed to find splash theme";
     } else {
-        content = content.arg(QString());
+        mIntroPart->setHtml(theme.render(templateName, data),
+                            QUrl::fromLocalFile(theme.absolutePath() + \
QLatin1Char('/')));  }
 
-    mIntroPart->setHtml(
-        content.arg(QFont().pointSize() + 2).
-        arg(i18nc("@item:intext", "KDE Kontact")).
-        arg(i18nc("@item:intext", "Get Organized!")).
-        arg(i18nc("@item:intext", "The KDE Personal Information Management Suite")).
-        arg(msg));
 }
 
 void MainWindow::initAboutScreen()
@@ -423,6 +411,11 @@ void MainWindow::initAboutScreen()
     mIntroPart->settings()->setAttribute(QWebSettings::JavaEnabled, false);
     mIntroPart->settings()->setAttribute(QWebSettings::PluginsEnabled, false);
 
+    const QFontInfo font(QFontDatabase().systemFont(QFontDatabase::GeneralFont));
+    mIntroPart->settings()->setFontFamily(QWebSettings::StandardFont, \
font.family()); +    \
mIntroPart->settings()->setFontSize(QWebSettings::DefaultFontSize, font.pixelSize()); \
+ +
     connect(mIntroPart->page(), &QWebPage::linkClicked, this, \
&MainWindow::slotOpenUrl, Qt::QueuedConnection);  }
 
@@ -1181,56 +1174,31 @@ void MainWindow::slotShowStatusMsg(const QString &msg)
     mStatusMsgLabel->setText(msg);
 }
 
-QString MainWindow::introductionString()
+QVariantHash MainWindow::introductionData()
 {
-    KIconLoader *iconloader = KIconLoader::global();
-    const int iconSize = iconloader->currentSize(KIconLoader::Desktop);
-
-    const QString handbook_icon_path = \
                iconloader->iconPath(QStringLiteral("help-contents"), \
                KIconLoader::Desktop);
-    const QString html_icon_path = iconloader->iconPath(QStringLiteral("kontact"), \
                KIconLoader::Desktop);
-    const QString wizard_icon_path = \
                iconloader->iconPath(QStringLiteral("tools-wizard"), \
                KIconLoader::Desktop);
-
-    QString info =
-        ki18nc(
-            "@info",
-            "<h2 style='text-align:center; margin-top: 0px;'>Welcome to Kontact \
                %1</h2>"
-            "<p align=\"center\">%2</p>"
-            "<table align=\"center\">"
-            "<tr><td><a href=\"%3\"><img width=\"%4\" height=\"%5\" src=\"%6\" \
                /></a></td>"
-            "<td><a href=\"%7\">%8</a><br /><span \
                id=\"subtext\"><nobr>%9</nobr></span></td></tr>"
-            "<tr><td><a href=\"%10\"><img width=\"%11\" height=\"%12\" src=\"%13\" \
                /></a></td>"
-            "<td><a href=\"%14\">%15</a><br /><span \
                id=\"subtext\"><nobr>%16</nobr></span></td></tr>"
-            "<tr><td><a href=\"%17\"><img width=\"%18\" height=\"%19\" src=\"%20\" \
                /></a></td>"
-            "<td><a href=\"%21\">%22</a><br /><span \
                id=\"subtext\"><nobr>%23</nobr></span></td></tr>"
-            "</table>"
-            "<p style=\"margin-bottom: 0px\"> <a href=\"%24\">Skip this \
                introduction</a></p>").
-        subs(KAboutData::applicationData().version()).
-        subs(i18nc("@item:intext",
-                   "Kontact handles your e-mail, address book, calendar, to-do list \
                and more.")).
-        subs(QStringLiteral("exec:/help?kontact")).
-        subs(iconSize).
-        subs(iconSize).
-        subs(QLatin1String("file:") + handbook_icon_path).
-        subs(QStringLiteral("exec:/help?kontact")).
-        subs(i18nc("@item:intext", "Read Manual")).
-        subs(i18nc("@item:intext", "Learn more about Kontact and its components")).
-        subs(QStringLiteral("http://kontact.org")).
-        subs(iconSize).
-        subs(iconSize).
-        subs(QLatin1String("file:") + html_icon_path).
-        subs(QStringLiteral("http://kontact.org")).
-        subs(i18nc("@item:intext", "Visit Kontact Website")).
-        subs(i18nc("@item:intext", "Access online resources and tutorials")).
-        subs(QStringLiteral("exec:/accountwizard")).
-        subs(iconSize).
-        subs(iconSize).
-        subs(QLatin1String("file:") + wizard_icon_path).
-        subs(QStringLiteral("exec:/accountwizard")).
-        subs(i18nc("@item:intext", "Setup your Accounts")).
-        subs(i18nc("@item:intext", "Prepare Kontact for use")).
-        subs(QStringLiteral("exec:/switch")).
-        toString();
-    return info;
+    QVariantHash data;
+    data[QStringLiteral("icon")] = QStringLiteral("kontact");
+    data[QStringLiteral("name")] = i18n("Kontact");
+    data[QStringLiteral("subtitle")] = i18n("The KDE Personal Information Management \
Suite."); +    data[QStringLiteral("version")] = \
KAboutData::applicationData().version(); +
+    QVariantList links = {
+        QVariantHash{ { QStringLiteral("url"), QStringLiteral("exec:/help?kontact") \
}, +                      { QStringLiteral("icon"), QStringLiteral("help-contents") \
}, +                      { QStringLiteral("title"), i18n("Read Manual") },
+                      { QStringLiteral("subtext"), i18n("Learn more about Kontact \
and it's components") } }, +        QVariantHash{ { QStringLiteral("url"), \
QStringLiteral("http://kontact.org") }, +                      { \
QStringLiteral("icon"), QStringLiteral("kontact") }, +                      { \
QStringLiteral("title"), i18n("Visit Kontact Website") }, +                      { \
QStringLiteral("subtext"), i18n("Access online resources and tutorials") } }, +       \
QVariantHash{ { QStringLiteral("url"), QStringLiteral("exec:/accountwizard") }, +     \
{ QStringLiteral("icon"), QStringLiteral("tools-wizard") }, +                      { \
QStringLiteral("title"), i18n("Setup your Accounts") }, +                      { \
QStringLiteral("subtext"), i18n("Prepare Kontact for use") } } +    };
+    data[QStringLiteral("links")] = links;
+
+    return data;
 }
 
 void MainWindow::slotShowHideSideBar()
diff --git a/kontact/src/mainwindow.h b/kontact/src/mainwindow.h
index 7387cbc..5d9186e 100644
--- a/kontact/src/mainwindow.h
+++ b/kontact/src/mainwindow.h
@@ -107,8 +107,8 @@ private:
     bool queryClose() Q_DECL_OVERRIDE;
     void readProperties(const KConfigGroup &config) Q_DECL_OVERRIDE;
     void saveProperties(KConfigGroup &config) Q_DECL_OVERRIDE;
-    void paintAboutScreen(const QString &msg);
-    static QString introductionString();
+    void paintAboutScreen(const QString &templateName, const QVariantHash &data);
+    static QVariantHash introductionData();
     KToolBar *findToolBar(const char *name);
 
 private Q_SLOTS:
diff --git a/messageviewer/CMakeLists.txt b/messageviewer/CMakeLists.txt
index 4fbd43d..d2e1524 100644
--- a/messageviewer/CMakeLists.txt
+++ b/messageviewer/CMakeLists.txt
@@ -50,7 +50,6 @@ find_package(KF5IconThemes ${KF5_VERSION} CONFIG REQUIRED)
 find_package(KF5WebKit ${KF5_VERSION} CONFIG REQUIRED)
 find_package(KF5AkonadiNotes ${AKONADINOTES_LIB_VERSION} CONFIG REQUIRED)
 
-
 find_package(Grantlee5 "5.0" CONFIG REQUIRED)
 ecm_setup_version(${KDEPIM_LIB_VERSION} VARIABLE_PREFIX MESSAGEVIEWER
                         VERSION_HEADER \
                "${CMAKE_CURRENT_BINARY_DIR}/messageviewer_version.h"
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index bf71494..4a52857 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -43,6 +43,8 @@ endif()
 add_subdirectory(pics)
 add_subdirectory(grantleefilters)
 add_subdirectory(kconf_update)
+add_subdirectory(about)
+
 if(DEBUG_SIGNATURE)
    add_definitions(-DDEBUG_SIGNATURE)
 endif()
diff --git a/messageviewer/src/about/CMakeLists.txt \
b/messageviewer/src/about/CMakeLists.txt new file mode 100644
index 0000000..19887ed
--- /dev/null
+++ b/messageviewer/src/about/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(default)
diff --git a/messageviewer/src/about/default/CMakeLists.txt \
b/messageviewer/src/about/default/CMakeLists.txt new file mode 100644
index 0000000..80ab9f6
--- /dev/null
+++ b/messageviewer/src/about/default/CMakeLists.txt
@@ -0,0 +1,7 @@
+install(FILES main.css
+              main.html
+              status.html
+              splash.theme
+              background.png
+        DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer/about/default
+)
diff --git a/messageviewer/src/about/default/background.png \
b/messageviewer/src/about/default/background.png new file mode 100644
index 0000000..fbf65a7
Binary files /dev/null and b/messageviewer/src/about/default/background.png differ
diff --git a/messageviewer/src/about/default/main.css \
b/messageviewer/src/about/default/main.css new file mode 100644
index 0000000..e125566
--- /dev/null
+++ b/messageviewer/src/about/default/main.css
@@ -0,0 +1,98 @@
+html {
+    margin: 0;
+    padding: 0;
+    width: 100%;
+    height: 100%;
+}
+
+body {
+    margin: 0px;
+    padding: 0px;
+    background-image: url('background.png');
+    background-position: center center;
+    background-size: cover;
+    background-repeat: no-repeat;
+    color: #111111;
+    height: 100%;
+    width: 100%;
+}
+
+img {
+    margin: 0px;
+    padding: 0px;
+}
+
+a {
+    color: #1A2C36;
+    text-decoration: none;
+    font-weight: bold;
+}
+
+a:hover {
+    color: #003B5A;
+    text-decoration: none;
+    text-shadow: #FFFFFF 0px 0px 6px;
+}
+
+.center {
+   text-align: center
+}
+
+#subtext {
+   font-style: italic;
+}
+
+#nextlink {
+   margin: 0px;
+   padding-top: 1em;
+    text-align: center;
+}
+
+#header {
+    background: rgba(255, 255, 255, 0.6);
+    width: 100%;
+    height: 140px;
+    text-align: center;
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+
+#header img {
+    display: inline-block;
+    position: relative;
+    top: 50%;
+    -webkit-transform: translateY(-50%);
+}
+
+#title {
+    display: inline-block;
+    position: relative;
+    top: 50%;
+    -webkit-transform: translateY(-50%);
+    color: #151515;
+    text-shadow: #FFFFFF 0px 0px 5px;
+    font-weight: bold;
+}
+
+
+#title h1 {
+    margin: 0;
+    padding: 0;
+    text-align: left;
+    font-size: xx-large;
+    color: #151515;
+}
+
+
+#box {
+    width: 100%;
+}
+
+#boxInner {
+    margin: 40px;
+    height: 100%;
+    background-color: rgba(255, 255, 255, 0.6);
+    border-radius: 5px;
+    box-shadow: 0 0 10px #aaa;
+    padding: 20px;
+}
diff --git a/messageviewer/src/about/default/main.html \
b/messageviewer/src/about/default/main.html new file mode 100644
index 0000000..d80bf74
--- /dev/null
+++ b/messageviewer/src/about/default/main.html
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" \
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <style type="text/css">
+  /*<![CDATA[*/
+    @import "main.css";
+  /*]]>*/
+
+  {% block style %}
+  {% endblock style %}
+  </style>
+
+  <title>{{ name }}</title>
+</head>
+
+<body>
+  <div id="header">
+    {% icon icon sizeenormous %}
+    <div id="title">
+        <h1>{{ name }}</h1>
+        {{ subtitle }}
+    </div>
+  </div>
+
+  <div id="box">
+    <div id="boxInner">
+      {% block box %}
+      {% endblock box %}
+    </div>
+  </div>
+</body>
+</html>
+
+<!-- vim:set sw=2 et nocindent smartindent: -->
diff --git a/messageviewer/src/about/default/splash.theme \
b/messageviewer/src/about/default/splash.theme new file mode 100644
index 0000000..e276c1b
--- /dev/null
+++ b/messageviewer/src/about/default/splash.theme
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Name=Default
+Description=Default splash theme
+FileName=main.html
diff --git a/messageviewer/src/about/default/status.html \
b/messageviewer/src/about/default/status.html new file mode 100644
index 0000000..e440f66
--- /dev/null
+++ b/messageviewer/src/about/default/status.html
@@ -0,0 +1,10 @@
+{% extends "main.html" %}
+
+{% block box %}
+
+<div class="center">
+    <h2>{{ title }}</h2>
+    <p>{{ subtext }}</p>
+</div>
+
+{% endblock box %}
\ No newline at end of file
diff --git a/messageviewer/src/viewer/mailwebview.cpp \
b/messageviewer/src/viewer/mailwebview.cpp index ffa1ada..bdfe9da 100644
--- a/messageviewer/src/viewer/mailwebview.cpp
+++ b/messageviewer/src/viewer/mailwebview.cpp
@@ -131,6 +131,11 @@ MailWebView::MailWebView(KActionCollection *actionCollection, \
QWidget *parent)  settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
     settings()->setAttribute(QWebSettings::JavaEnabled, false);
     settings()->setAttribute(QWebSettings::PluginsEnabled, false);
+
+    const QFontInfo font(QFontDatabase().systemFont(QFontDatabase::GeneralFont));
+    settings()->setFontFamily(QWebSettings::StandardFont, font.family());
+    settings()->setFontSize(QWebSettings::DefaultFontSize, font.pixelSize());
+
     connect(page(), &QWebPage::linkHovered,
             this,   &MailWebView::linkHovered);
     connect(this, &QWebView::loadStarted, this, &MailWebView::hideAccessKeys);
diff --git a/messageviewer/src/viewer/viewer.cpp \
b/messageviewer/src/viewer/viewer.cpp index 8b79f3a..6cdef93 100644
--- a/messageviewer/src/viewer/viewer.cpp
+++ b/messageviewer/src/viewer/viewer.cpp
@@ -132,10 +132,10 @@ void Viewer::setMessagePath(const QString &path)
     d->mMessagePath = path;
 }
 
-void Viewer::displaySplashPage(const QString &info)
+void Viewer::displaySplashPage(const QString &templateName, const QVariantHash \
&data)  {
     Q_D(Viewer);
-    d->displaySplashPage(info);
+    d->displaySplashPage(templateName, data);
 }
 
 void Viewer::enableMessageDisplay()
diff --git a/messageviewer/src/viewer/viewer.h b/messageviewer/src/viewer/viewer.h
index c4f4fc3..1258dd8 100644
--- a/messageviewer/src/viewer/viewer.h
+++ b/messageviewer/src/viewer/viewer.h
@@ -217,9 +217,10 @@ public:
 
     /**
     * Display a generic HTML splash page instead of a message.
-    * @param info - the text to be displayed in HTML format
+    * @param templateName - the template to be loaded
+    * @param data - data for the template
     */
-    void displaySplashPage(const QString &info);
+    void displaySplashPage(const QString &templateName, const QVariantHash &data);
 
     /** Enable the displaying of messages again after an splash (or other) page was \
displayed */  void enableMessageDisplay();
diff --git a/messageviewer/src/viewer/viewer_p.cpp \
b/messageviewer/src/viewer/viewer_p.cpp index a167dd1..bc91ef8 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -150,6 +150,9 @@
 #include <viewerplugins/viewerplugininterface.h>
 #include <widgets/zoomactionmenu.h>
 
+#include <grantleetheme/grantleethememanager.h>
+#include <grantleetheme/grantleetheme.h>
+
 using namespace boost;
 using namespace MailTransport;
 using namespace MessageViewer;
@@ -767,30 +770,31 @@ int ViewerPrivate::pointsToPixel(int pointSize) const
     return (pointSize * mViewer->logicalDpiY() + 36) / 72;
 }
 
-void ViewerPrivate::displaySplashPage(const QString &info)
+void ViewerPrivate::displaySplashPage(const QString &message)
+{
+    displaySplashPage(QStringLiteral("status.html"),
+                      { { QStringLiteral("icon"), QStringLiteral("kmail") },
+                        { QStringLiteral("name"), i18n("KMail") },
+                        { QStringLiteral("subtitle"), i18n("The KDE Mail Client") },
+                        { QStringLiteral("message"), message } });
+}
+
+void ViewerPrivate::displaySplashPage(const QString &templateName, const \
QVariantHash &data)  {
     mMsgDisplay = false;
     adjustLayout();
 
-    const QString location = \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("kmail2/about/main.html"));  //FIXME(Andras) copy to \
                $KDEDIR/share/apps/messageviewer
-    const QString stylesheet = \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
                QStringLiteral("/kf5/infopage/kde_infopage.css"));
-    QString rtlStylesheet;
-    if (QApplication::isRightToLeft()) {
-        rtlStylesheet = QLatin1String("@import \"") + \
QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
                QStringLiteral("/kf5/infopage/kde_infopage_rtl.css")) +  \
                QLatin1String("\";");
-    }
-    QFile f(location);
-    if (!f.open(QIODevice::ReadOnly)) {
-        qCWarning(MESSAGEVIEWER_LOG) << "Failed to read splash page: " << \
                f.errorString();
-        return;
+    GrantleeTheme::ThemeManager manager(QStringLiteral("splashPage"),
+                                        QStringLiteral("splash.theme"),
+                                        Q_NULLPTR,
+                                        QStringLiteral("messageviewer/about/"));
+    GrantleeTheme::Theme theme = manager.theme(QStringLiteral("default"));
+    if (!theme.isValid()) {
+        qCDebug(MESSAGEVIEWER_LOG) << "Theme error: failed to find splash theme";
+    } else {
+        mViewer->setHtml(theme.render(templateName, data),
+                         QUrl::fromLocalFile(theme.absolutePath() + \
QLatin1Char('/')));  }
-    const QString content = QString::fromLocal8Bit(f.readAll()).arg(stylesheet, \
                rtlStylesheet);
-    f.close();
-
-    const QString fontSize = \
                QString::number(pointsToPixel(mCSSHelper->bodyFont().pointSize()));
-    const QString catchPhrase; //not enough space for a catch phrase at default \
                window size i18n("Part of the Kontact Suite");
-    const QString quickDescription = i18n("The KDE email client.");
-
-    mViewer->setHtml(content.arg(fontSize).arg(mAppName).arg(catchPhrase).arg(quickDescription).arg(info), \
QUrl::fromLocalFile(location));  mViewer->show();
 }
 
diff --git a/messageviewer/src/viewer/viewer_p.h \
b/messageviewer/src/viewer/viewer_p.h index 8f67f2e..9471d3c 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -248,10 +248,10 @@ public:
     /** Calculate the pixel size */
     int pointsToPixel(int pointSize) const;
 
-    /** Display a generic HTML splash page instead of a message.
-    * @param info - the text to be displayed in HTML format
-    */
-    void displaySplashPage(const QString &info);
+    /** Display a generic HTML splash page instead of a message. */
+    void displaySplashPage(const QString &templateName, const QVariantHash &data);
+
+    void displaySplashPage(const QString &message);
 
     /** Enable the displaying of messages again after an splash (or other) page was \
displayed */  void enableMessageDisplay();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic