[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:22:44 UTC 2016


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

The following commit has been merged in the master branch:
commit ffec4d5f67a974dfc22bc6bec50e96139b90fc24
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Thu Aug 30 11:16:32 2012 +0200

    Add a string list to Message enable plugins to append scripts
---
 lib/message.cpp | 29 +++++++++++++++++++++++++++++
 lib/message.h   | 18 ++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/lib/message.cpp b/lib/message.cpp
index 4e11bd4..ae05770 100644
--- a/lib/message.cpp
+++ b/lib/message.cpp
@@ -53,6 +53,11 @@ void Message::appendMessagePart(const QString& part)
     m_parts << part;
 }
 
+void Message::appendScript(const QString& script)
+{
+    m_scripts << script;
+}
+
 QString Message::finalizedMessage() const
 {
     QString msg = m_mainPart + QLatin1String("
") +
@@ -62,6 +67,30 @@ QString Message::finalizedMessage() const
     return msg;
 }
 
+QString Message::finalizedScript() const
+{
+    if (m_scripts.empty()) {
+        return QString();
+    }
+
+    QString finalScript;
+
+    Q_FOREACH(const QString &script, m_scripts) {
+        if (!finalScript.contains(script)) {
+            if (!finalScript.isEmpty()) {
+                finalScript.append(QLatin1String("; "));
+            }
+            finalScript.append(script);
+        }
+    }
+    if (!finalScript.isEmpty()) {
+        finalScript.append(QLatin1String("; false;"));
+    }
+
+    kDebug() << finalScript;
+    return finalScript;
+}
+
 QVariant Message::property(const char *name) const
 {
     return m_properties[QLatin1String(name)];
diff --git a/lib/message.h b/lib/message.h
index 2f6afa4..41a2264 100644
--- a/lib/message.h
+++ b/lib/message.h
@@ -75,7 +75,16 @@ public:
      */
     void appendMessagePart(const QString &part);
 
+    /*! rief Append a script
+     *
+     * \par
+     * Each plugin that requires to run a script after the page is updated can
+     * use this method to add a script will be run after the message is appended
+     */
+    void appendScript(const QString &script);
+
     /*! rief Construct the final procesesd content
+     *
      * \par
      * This will concatenate all the visual 'parts' of the message into one
      * (Qt supported) HTML string.
@@ -86,6 +95,14 @@ public:
      */
     QString finalizedMessage() const;
 
+    /*! rief Construct the final script
+     *
+     * \par
+     * This will concatenate all the scripts parts of the message into one
+     * script that will be executed from the main view.
+     */
+    QString finalizedScript() const;
+
     /*! rief Sets the contents of a property
      * \par
      * These messages contain meta-data for plugins in the form of 'properties'.
@@ -121,6 +138,7 @@ private:
     QVariantMap m_properties;
     QString     m_mainPart;
     QStringList m_parts;
+    QStringList m_scripts;
 };
 
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list