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


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

The following commit has been merged in the master branch:
commit b972cd7858b48569d95628a7dfe3271ffba6c943
Author: Lasath Fernando <kde at lasath.org>
Date:   Thu Feb 2 13:04:18 2012 +1100

    Fix linker error and indentation in UrlFilter
---
 lib/CMakeLists.txt |  1 +
 lib/url-filter.cpp | 88 +++++++++++++++++++++++++++---------------------------
 2 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 9a41941..2691c8d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -14,6 +14,7 @@ set(ktpchat_SRCS
         logmanager.cpp
         message.cpp
         message-processor.cpp
+        url-filter.cpp
 )
 
 set(ktpchat_HDRS
diff --git a/lib/url-filter.cpp b/lib/url-filter.cpp
index 6c9360d..18b91f8 100644
--- a/lib/url-filter.cpp
+++ b/lib/url-filter.cpp
@@ -5,63 +5,63 @@
 #include <KProtocolInfo>
 #include <KDebug>
 
-virtual void UrlFilter::filterMessage(Message &info) {
-        QString message = info.mainMessagePart();
-        //FIXME: make "Urls" into a constant
-        QStringList urls = info.property("Urls");
+void UrlFilter::filterMessage(Message &info) {
+    QString message = info.mainMessagePart();
+    //FIXME: make "Urls" into a constant
+    QStringList urls = info.property("Urls").toStringList();
 
-        // link detection
-        QRegExp link(QLatin1String("\b(?:(\w+)://|(www\.))([^\s]+)"));
-        int fromIndex = 0;
+    // link detection
+    QRegExp link(QLatin1String("\b(?:(\w+)://|(www\.))([^\s]+)"));
+    int fromIndex = 0;
 
-        while ((fromIndex = message.indexOf(link, fromIndex)) != -1) {
-            QString realUrl = link.cap(0);
-            QString protocol = link.cap(1);
+    while ((fromIndex = message.indexOf(link, fromIndex)) != -1) {
+        QString realUrl = link.cap(0);
+        QString protocol = link.cap(1);
 
-            //if cap(1) is empty cap(2) was matched -> starts with www.
-            const bool startsWithWWW = link.cap(1).isEmpty();
+        //if cap(1) is empty cap(2) was matched -> starts with www.
+        const bool startsWithWWW = link.cap(1).isEmpty();
 
-            kDebug() << "Found URL " << realUrl << "with protocol : " << (startsWithWWW ? QLatin1String("http") : protocol);
+        kDebug() << "Found URL " << realUrl << "with protocol : " << (startsWithWWW ? QLatin1String("http") : protocol);
 
 
-            // if url has a supported protocol
-            if (startsWithWWW || KProtocolInfo::protocols().contains(protocol, Qt::CaseInsensitive)) {
+        // if url has a supported protocol
+        if (startsWithWWW || KProtocolInfo::protocols().contains(protocol, Qt::CaseInsensitive)) {
 
-                // text not wanted in a link ( <,> )
-                QRegExp unwanted(QLatin1String("(<|>)"));
+            // text not wanted in a link ( <,> )
+            QRegExp unwanted(QLatin1String("(<|>)"));
 
-                if (!realUrl.contains(unwanted)) {
-                    // string to show to user
-                    QString shownUrl = realUrl;
+            if (!realUrl.contains(unwanted)) {
+                // string to show to user
+                QString shownUrl = realUrl;
 
-                    // check for newline and cut link when found
-                    if (realUrl.contains(QLatin1String(("<br/>")))) {
-                        int findIndex = realUrl.indexOf(QLatin1String("<br/>"));
-                        realUrl.truncate(findIndex);
-                        shownUrl.truncate(findIndex);
-                    }
-
-                    // check prefix
-                    if (startsWithWWW) {
-                        realUrl.prepend(QLatin1String("http://"));
-                    }
-
-                    // if the url is changed, show in chat what the user typed in
-                    QString link = QLatin1String("<a href='") + realUrl + QLatin1String("'>") + shownUrl + QLatin1String("</a>");
+                // check for newline and cut link when found
+                if (realUrl.contains(QLatin1String(("<br/>")))) {
+                    int findIndex = realUrl.indexOf(QLatin1String("<br/>"));
+                    realUrl.truncate(findIndex);
+                    shownUrl.truncate(findIndex);
+                }
 
-                    message.replace(fromIndex, shownUrl.length(), link);
-                    // advance position otherwise I end up parsing the same link
-                    fromIndex += link.length();
-                } else {
-                    fromIndex += realUrl.length();
+                // check prefix
+                if (startsWithWWW) {
+                    realUrl.prepend(QLatin1String("http://"));
                 }
 
-                urls.append(realUrl);
+                // if the url is changed, show in chat what the user typed in
+                QString link = QLatin1String("<a href='") + realUrl + QLatin1String("'>") + shownUrl + QLatin1String("</a>");
+
+                message.replace(fromIndex, shownUrl.length(), link);
+                // advance position otherwise I end up parsing the same link
+                fromIndex += link.length();
             } else {
-                fromIndex += link.matchedLength();
+                fromIndex += realUrl.length();
             }
+
+            urls.append(realUrl);
+        } else {
+            fromIndex += link.matchedLength();
         }
+    }
 
-        info.setProperty("Urls", urls);
-        info.setMainMessagePart(message);
-    }
\ No newline at end of file
+    info.setProperty("Urls", urls);
+    info.setMainMessagePart(message);
+}

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list