[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:56 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=ef75791
The following commit has been merged in the master branch:
commit ef757918558346349b3b38d62f1b5e0c658e907c
Author: Lasath Fernando <kde at lasath.org>
Date: Tue May 1 12:54:02 2012 +1000
Create EscapeFilter plugin
The escaping has been brought back, in all it's glory, as a proper
plugin. This has been tested and works.
PS: testEscaping() now passes again.
---
filters/escape/CMakeLists.txt | 28 +++++++++++++
filters/escape/escape-filter.cpp | 47 ++++++++++++++++++++++
lib/filters.h => filters/escape/escape-filter.h | 17 +++-----
.../ktptextui_message_filter_escape.desktop} | 4 +-
4 files changed, 83 insertions(+), 13 deletions(-)
diff --git a/filters/escape/CMakeLists.txt b/filters/escape/CMakeLists.txt
new file mode 100644
index 0000000..c6b0e48
--- /dev/null
+++ b/filters/escape/CMakeLists.txt
@@ -0,0 +1,28 @@
+set (ktptextui_message_filter_escape_SRCS
+ escape-filter.cpp
+)
+
+kde4_add_ui_files (ktptextui_message_filter_escape_SRCS
+)
+
+kde4_add_plugin (ktptextui_message_filter_escape
+ ${ktptextui_message_filter_escape_SRCS}
+)
+
+target_link_libraries (ktptextui_message_filter_escape
+ ktpchat
+ ${QT_LIBRARIES}
+ ${KDE4_KDEUI_LIBS}
+ ${TELEPATHY_QT4_LIBRARIES}
+ ${KDE4_KEMOTICONS_LIBS}
+)
+
+# Install:
+install (TARGETS ktptextui_message_filter_escape
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
+
+install (FILES ktptextui_message_filter_escape.desktop
+ DESTINATION ${SERVICES_INSTALL_DIR}
+)
+
diff --git a/filters/escape/escape-filter.cpp b/filters/escape/escape-filter.cpp
new file mode 100644
index 0000000..ba0b21c
--- /dev/null
+++ b/filters/escape/escape-filter.cpp
@@ -0,0 +1,47 @@
+/*
+ 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
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "escape-filter.h"
+
+#include <QtGui/QTextDocument> //needed for Qt::escape
+
+#include <KPluginFactory>
+
+EscapeFilter::EscapeFilter(QObject *parent, const QVariantList &)
+ : AbstractMessageFilter(parent)
+{
+}
+
+void EscapeFilter::filterMessage(Message& message)
+{
+ QString escapedMessage = Qt::escape(message.mainMessagePart());
+
+ escapedMessage.replace(QLatin1String("
"), QLatin1String("<br/> ")); //keep leading whitespaces
+ escapedMessage.replace(QLatin1Char('
'), QLatin1String("<br/>"));
+ escapedMessage.replace(QLatin1Char('
'), QLatin1String("<br/>"));
+ escapedMessage.replace(QLatin1Char(' '), QLatin1String(" ")); // replace tabs by 4 spaces
+ escapedMessage.replace(QLatin1String(" "), QLatin1String(" ")); // keep multiple whitespaces
+ escapedMessage.replace(QLatin1Char('\'), QLatin1String("\\")); //replace a single backslash with two backslashes.
+
+ message.setMainMessagePart(escapedMessage);
+}
+
+K_PLUGIN_FACTORY(MessageFilterFactory, registerPlugin<EscapeFilter>();)
+K_EXPORT_PLUGIN(MessageFilterFactory("ktptextui_message_filter_escape"))
+
+// #include "moc_escape-filter.cpp"
\ No newline at end of file
diff --git a/lib/filters.h b/filters/escape/escape-filter.h
similarity index 79%
copy from lib/filters.h
copy to filters/escape/escape-filter.h
index cb9b20a..282be8a 100644
--- a/lib/filters.h
+++ b/filters/escape/escape-filter.h
@@ -16,18 +16,13 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef FILTERS_H
-#define FILTERS_H
-
-#include "abstract-message-filter.h"
-
#include <QObject>
-class UrlFilter : public AbstractMessageFilter
+#include <KTp/AbstractMessageFilter>
+
+class EscapeFilter : public AbstractMessageFilter
{
public:
- explicit UrlFilter(QObject *parent = 0);
- void filterMessage(Message &message);
-};
-
-#endif
+ explicit EscapeFilter(QObject* parent, const QVariantList&);
+ virtual void filterMessage(Message& message);
+};
\ No newline at end of file
diff --git a/filters/emoticons/ktptextui_message_filter_emoticons.desktop b/filters/escape/ktptextui_message_filter_escape.desktop
similarity index 80%
copy from filters/emoticons/ktptextui_message_filter_emoticons.desktop
copy to filters/escape/ktptextui_message_filter_escape.desktop
index a3bc566..053d5d3 100644
--- a/filters/emoticons/ktptextui_message_filter_emoticons.desktop
+++ b/filters/escape/ktptextui_message_filter_escape.desktop
@@ -4,10 +4,10 @@ Comment=//TODO:.
Type=Service
ServiceTypes=KTpTextUi/MessageFilter
-X-KDE-Library=ktptextui_message_filter_emoticons
+X-KDE-Library=ktptextui_message_filter_escape
X-KDE-PluginInfo-Author=Lasath Fernando
X-KDE-PluginInfo-Email=kde at lasath.org
-X-KDE-PluginInfo-Name=emoticons
+X-KDE-PluginInfo-Name=escape
X-KDE-PluginInfo-Version=0.3
X-KDE-PluginInfo-Website=http://techbase.kde.org/Projects/Telepathy
X-KDE-PluginInfo-License=GPL
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list