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


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

The following commit has been merged in the master branch:
commit a2ccf85e6cb3be91f8033c9f3b93235910c545f2
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Mon Apr 11 14:51:58 2011 +0200

    Fix bug 270345 : URL parser recognizes addresses starting with http:// or https:// only
    
    now smb, ftp links are detected as well
    
    BUG: 270345
    REVIEW: David Edmundson
---
 lib/adium-theme-view.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 3cd889f..6c78889 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -361,11 +361,23 @@ QString AdiumThemeView::replaceMessageKeywords(QString &htmlTemplate, const Adiu
     //message
     htmlTemplate.replace("%message%", m_emoticons.theme().parseEmoticons(info.message()));
 
-    QRegExp linkRegExp("https{0,1}://[^ 	



]+");
+    // link detection
+    QRegExp linkRegExp("(smb://|s{0,1}ftp://|www.|https{0,1}://)[^ 	



]+");
     int index = 0;
     while((index = linkRegExp.indexIn(htmlTemplate, index)) != -1) {
-        QString link = "<a href='" + linkRegExp.cap(0) + "'>" + linkRegExp.cap(0) + "</a>";
+        QString realUrl = linkRegExp.cap(0);
+
+        // remove line breaks
+        realUrl.remove("<br/>");
+
+        if (realUrl.startsWith("www")) {
+            realUrl.prepend("http://");
+        }
+
+        // if the url is changed, show in chat what the user typed in
+        QString link = "<a href='" + realUrl + "'>" + linkRegExp.cap(0) + "</a>";
         htmlTemplate.replace(index, linkRegExp.cap(0).length(), link);
+
         // advance pos otherwise i end up parsing same link
         index += link.length();
     }

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list