[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:02 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=ef5bbae
The following commit has been merged in the master branch:
commit ef5bbaef33913897750b1b71411b3f0f5f10eae3
Author: Lasath Fernando <kde at lasath.org>
Date: Mon Jun 25 11:06:22 2012 +1000
Add escape-filter.cpp
There needs to be a better way of git add'ing things that isn't so
easy to forget.
BUG: 299294
BUG: 299334
---
lib/escape-filter.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/lib/escape-filter.cpp b/lib/escape-filter.cpp
new file mode 100644
index 0000000..f4eda3d
--- /dev/null
+++ b/lib/escape-filter.cpp
@@ -0,0 +1,42 @@
+/*
+ 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 "filters.h"
+
+#include <QtGui/QTextDocument> //needed for Qt::escape
+
+EscapeFilter::EscapeFilter(QObject *parent)
+ : 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);
+}
+
+// #include "moc_escape-filter.cpp"
\ No newline at end of file
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list