[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:43 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=61edc8f
The following commit has been merged in the master branch:
commit 61edc8f4e7a03a5bd2adfd7736f6c1b971f93926
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date: Fri Aug 31 12:32:19 2012 +0200
Add header method to MessageProcessor
This method returns a string that will be inserted in the <head> section of the chat view
---
lib/message-processor.cpp | 35 +++++++++++++++++++++++++++++++++++
lib/message-processor.h | 3 +++
2 files changed, 38 insertions(+)
diff --git a/lib/message-processor.cpp b/lib/message-processor.cpp
index 28ed002..be28a62 100644
--- a/lib/message-processor.cpp
+++ b/lib/message-processor.cpp
@@ -27,6 +27,7 @@
#include <KService>
#include <KServiceTypeTrader>
#include <KPluginFactory>
+#include <KDE/KStandardDirs>
MessageProcessor* MessageProcessor::s_instance = 0;
@@ -58,6 +59,40 @@ MessageProcessor::~MessageProcessor()
{
}
+QString MessageProcessor::header()
+{
+ QStringList scripts;
+ QStringList stylesheets;
+ Q_FOREACH (AbstractMessageFilter *filter, MessageProcessor::m_filters) {
+ Q_FOREACH (const QString &script, filter->requiredScripts()) {
+ // Avoid duplicates
+ if (!scripts.contains(script)) {
+ scripts << script;
+ }
+ }
+ }
+ Q_FOREACH (AbstractMessageFilter *filter, MessageProcessor::m_filters) {
+ Q_FOREACH (const QString &stylesheet, filter->requiredStylesheets()) {
+ // Avoid duplicates
+ if (!stylesheets.contains(stylesheet)) {
+ stylesheets << stylesheet;
+ }
+ }
+ }
+
+ QString out(QLatin1String("
<!-- The following scripts and stylesheets are injected here by the plugins -->
"));
+ Q_FOREACH(const QString &script, scripts) {
+ out.append(QString::fromLatin1(" <script type=\"text/javascript\" src=\"%1\"></script>
").arg(KGlobal::dirs()->findResource("data", script)));
+ }
+ Q_FOREACH(const QString &stylesheet, stylesheets) {
+ out.append(QString::fromLatin1(" <link rel=\"stylesheet\" type=\"text/css\" href=\"%1\" />
").arg(KGlobal::dirs()->findResource("data", stylesheet)));
+ }
+
+ kDebug() << out;
+
+ return out;
+}
+
Message MessageProcessor::processIncomingMessage(Message receivedMessage)
{
Q_FOREACH (AbstractMessageFilter *filter, MessageProcessor::m_filters) {
diff --git a/lib/message-processor.h b/lib/message-processor.h
index 6d2e1ca..c6183f6 100644
--- a/lib/message-processor.h
+++ b/lib/message-processor.h
@@ -45,6 +45,9 @@ public:
static MessageProcessor* instance();
~MessageProcessor();
+ //text-ui will call this somewhere when creating the template
+ QString header();
+
//text-ui will call this somewhere in handleIncommingMessage just before displaying it
Message processIncomingMessage(Message message);
Message processOutgoingMessage(Message message);
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list