[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:05:32 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=1fff6d1
The following commit has been merged in the master branch:
commit 1fff6d1ad0406dde32b53ae8dff03941caff858b
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
---
KTp/message-processor.cpp | 35 +++++++++++++++++++++++++++++++++++
KTp/message-processor.h | 3 +++
2 files changed, 38 insertions(+)
diff --git a/KTp/message-processor.cpp b/KTp/message-processor.cpp
index 28ed002..be28a62 100644
--- a/KTp/message-processor.cpp
+++ b/KTp/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/KTp/message-processor.h b/KTp/message-processor.h
index 6d2e1ca..c6183f6 100644
--- a/KTp/message-processor.h
+++ b/KTp/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-common-internals packaging
More information about the pkg-kde-commits
mailing list