[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:19:07 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=28e34bb

The following commit has been merged in the master branch:
commit 28e34bb62467e3a5a122f10daaeb90bf3f91a0de
Author: Florian Reinhard <florian.reinhard at googlemail.com>
Date:   Thu Mar 17 13:57:30 2011 +0100

    Move loading of fallback template from AdiumThemeView to ChatWindowStyle.
    
    Besides i did some code reformating.
    Reviewed-by: David Edmundson <kde at davidedmundson.co.uk>
    REVIEW: 100878
---
 lib/adium-theme-view.cpp  | 30 ++++++------------------------
 lib/chat-window-style.cpp | 17 ++++++++++++++++-
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 0133f3d..abcfd7d 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -91,37 +91,19 @@ AdiumThemeView::AdiumThemeView(QWidget *parent)
 
 void AdiumThemeView::initialise(const AdiumThemeHeaderInfo &chatInfo)
 {
-    QString templateHtml;
-    QString templateFileName(KGlobal::dirs()->findResource("data", "ktelepathy/template.html"));
-
-    templateHtml = m_chatStyle->getTemplateHtml();
+    QString headerHtml;
+    QString templateHtml = m_chatStyle->getTemplateHtml();
+    QString footerHtml = replaceHeaderKeywords(m_chatStyle->getFooterHtml(), chatInfo);
+    QString extraStyleHtml = "@import url( \"main.css\" );";
 
     if (templateHtml.isEmpty()) {
-        //FIXME, move this to ChatStyle (maybe?)
-        QString templateFileName(KGlobal::dirs()->findResource("data", "ktelepathy/template.html"));
-
-        if (! templateFileName.isEmpty() && QFile::exists(templateFileName)) {
-            QFile fileAccess;
-
-            fileAccess.setFileName(templateFileName);
-            fileAccess.open(QIODevice::ReadOnly);
-            QTextStream headerStream(&fileAccess);
-            headerStream.setCodec(QTextCodec::codecForName("UTF-8"));
-            templateHtml = headerStream.readAll();
-            fileAccess.close();
-        } else {
-            KMessageBox::error(this, i18n("Missing required file template.html - check your installation."));
-        }
+        // if templateHtml is empty, we failed to load the fallback template file
+        KMessageBox::error(this, i18n("Missing required file template.html - check your installation."));
     }
 
-    QString headerHtml;
     if (m_displayHeader) {
         headerHtml = replaceHeaderKeywords(m_chatStyle->getHeaderHtml(), chatInfo);
     } //otherwise leave as blank.
-    QString footerHtml;
-    footerHtml = replaceHeaderKeywords(m_chatStyle->getFooterHtml(), chatInfo);
-
-    QString extraStyleHtml = "@import url( \"main.css\" );";
 
     //The templateHtml is in a horrific NSString format.
     //Want to use this rather than roll our own, as that way we can get templates from themes too
diff --git a/lib/chat-window-style.cpp b/lib/chat-window-style.cpp
index e5003ec..33f6c35 100644
--- a/lib/chat-window-style.cpp
+++ b/lib/chat-window-style.cpp
@@ -288,7 +288,7 @@ void ChatWindowStyle::readStyleFiles()
     ChatStylePlistFileReader plistReader(infoPlistFile);
     d->defaultVariantName = plistReader.defaultVariant();
 
-    //Load template file
+    // Load template file
     if (QFile::exists(templateFile)) {
         fileAccess.setFileName(templateFile);
         fileAccess.open(QIODevice::ReadOnly);
@@ -298,6 +298,21 @@ void ChatWindowStyle::readStyleFiles()
         fileAccess.close();
     }
 
+    // Load template file fallback
+    if (d->templateHtml.isEmpty())
+    {
+        QString templateFileName(KGlobal::dirs()->findResource("data", "ktelepathy/template.html"));
+
+        if (! templateFileName.isEmpty() && QFile::exists(templateFileName)) {
+            fileAccess.setFileName(templateFileName);
+            fileAccess.open(QIODevice::ReadOnly);
+            QTextStream headerStream(&fileAccess);
+            headerStream.setCodec(QTextCodec::codecForName("UTF-8"));
+            d->templateHtml = headerStream.readAll();
+            fileAccess.close();
+        }
+    }
+
     // Load header file.
     if (QFile::exists(headerFile)) {
         fileAccess.setFileName(headerFile);

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list