[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:21:03 UTC 2016


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

The following commit has been merged in the master branch:
commit 199feab388074a1104a71362081b0088863b4a58
Author: Lasath Fernando <kde at lasath.org>
Date:   Fri Jan 27 08:39:06 2012 +1100

    Implement skeleton of MessageProcessor
---
 lib/CMakeLists.txt                                 |  2 +
 .../qml-plugins.h => lib/message-processor.cpp     | 28 ++++++++-----
 lib/{message.cpp => message-processor.h}           | 47 +++++++++-------------
 lib/message.cpp                                    |  4 +-
 lib/message.h                                      | 11 ++---
 5 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 31dadd2..9a41941 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -12,6 +12,8 @@ set(ktpchat_SRCS
         chat-text-edit.cpp
         chat-search-bar.cpp
         logmanager.cpp
+        message.cpp
+        message-processor.cpp
 )
 
 set(ktpchat_HDRS
diff --git a/plasmoid/declarative-plugin/qml-plugins.h b/lib/message-processor.cpp
similarity index 59%
copy from plasmoid/declarative-plugin/qml-plugins.h
copy to lib/message-processor.cpp
index eb8cfd4..e6a140c 100644
--- a/plasmoid/declarative-plugin/qml-plugins.h
+++ b/lib/message-processor.cpp
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2011  Lasath Fernando <kde at lasath.org>
+    Copyright (C) 2012  Lasath Fernando <kde at lasath.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -17,15 +17,25 @@
 */
 
 
-#ifndef QML_PLUGINS_H
-#define QML_PLUGINS_H
+#include "message-processor.h"
 
-#include <QtDeclarative/QDeclarativeExtensionPlugin>
+QList<AbstractMessageFilter*> MessageProcessor::m_filters;
 
-class QmlPlugins : public QDeclarativeExtensionPlugin
+MessageProcessor::MessageProcessor()
 {
-public:
-    virtual void registerTypes(const char *uri);
-};
+}
+
+KTp::Message MessageProcessor::processIncommingMessage(Tp::ReceivedMessage receivedMessage)
+{
+    KTp::Message message(receivedMessage);
+    Q_FOREACH(AbstractMessageFilter *filter, MessageProcessor::m_filters) {
+        filter->filterMessage(message);
+    }
+    return message;
+}
+
+MessageProcessor::~MessageProcessor()
+{
+
+}
 
-#endif // QML_PLUGINS_H
diff --git a/lib/message.cpp b/lib/message-processor.h
similarity index 58%
copy from lib/message.cpp
copy to lib/message-processor.h
index faaa7b6..c2bcfb0 100644
--- a/lib/message.cpp
+++ b/lib/message-processor.h
@@ -17,37 +17,30 @@
 */
 
 
-#include "message.h"
-
-using namespace KTp;
+#ifndef MESSAGE_PROCESSOR_H
+#define MESSAGE_PROCESSOR_H
 
-Message::Message(Tp::Message &original)
-    : originalMessage(original),
-      content(originalMessage.text())
-{
-}
+#include "message.h"
+#include <QList>
 
-QString Message::mainMessagePart() const
-{
-    return content.operator[](Message::MainMessage);
-}
+class AbstractMessageFilter {
+public:
+    virtual void filterMessage(KTp::Message) = 0;
+    virtual ~AbstractMessageFilter();
+};
 
-void Message::setMainMessagePart(const QString& message)
+//each thing that displays message will have an instance of this
+class MessageProcessor
 {
-    content[Message::MainMessage] = message;
-}
 
-void Message::appendMessagePart(const QString& part)
-{
-    content << part;
-}
+public:
+    MessageProcessor();
+    ~MessageProcessor();
 
-QString Message::finalizedMessage() const
-{
-    content.join(QLatin1Literal("
"));
-}
+    //text-ui will call this somewhere in handleIncommingMessage just before displaying it
+    KTp::Message processIncommingMessage(Tp::ReceivedMessage);
+private:
+    static QList<AbstractMessageFilter*> m_filters;
+};
 
-QVariantMap& Message::miscData()
-{
-    return miscData;
-}
\ No newline at end of file
+#endif // MESSAGE_PROCESSOR_H
diff --git a/lib/message.cpp b/lib/message.cpp
index faaa7b6..9fff9c0 100644
--- a/lib/message.cpp
+++ b/lib/message.cpp
@@ -44,10 +44,10 @@ void Message::appendMessagePart(const QString& part)
 
 QString Message::finalizedMessage() const
 {
-    content.join(QLatin1Literal("
"));
+    return content.join(QLatin1String("
"));
 }
 
 QVariantMap& Message::miscData()
 {
-    return miscData;
+    return m_miscData;
 }
\ No newline at end of file
diff --git a/lib/message.h b/lib/message.h
index dfeb643..c4a1aae 100644
--- a/lib/message.h
+++ b/lib/message.h
@@ -1,6 +1,5 @@
 /*
-    <one line to give the library's name and an idea of what it does.>
-    Copyright (C) 2012  Lasath Fernando <email>
+    Copyright (C) 2012  Lasath Fernando <kde at lasath.org>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
@@ -26,18 +25,20 @@
 namespace KTp {
 
 class Message {
+
+public:
     Message(Tp::Message& original);
 
     QString mainMessagePart() const;
-    void setMainMessagePart(const QString&);
-    void appendMessagePart(const QString&);
+    void setMainMessagePart(const QString& message);
+    void appendMessagePart(const QString& part);
 
     QString finalizedMessage() const;
 
     QVariantMap& miscData();
 private:
     Tp::Message originalMessage;
-    QVariantMap miscData;
+    QVariantMap m_miscData;
     QStringList content;
 
     enum MessageParts {

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list