[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:04:58 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=dc3a541
The following commit has been merged in the master branch:
commit dc3a5411f3ffd8320a540d1eb938a3124e2899c7
Author: Lasath Fernando <kde at lasath.org>
Date: Thu Feb 2 13:04:18 2012 +1100
Fix linker error and indentation in UrlFilter
---
KTp/message-url-filter.cpp | 88 +++++++++++++++++++++++-----------------------
1 file changed, 44 insertions(+), 44 deletions(-)
diff --git a/KTp/message-url-filter.cpp b/KTp/message-url-filter.cpp
index 6c9360d..18b91f8 100644
--- a/KTp/message-url-filter.cpp
+++ b/KTp/message-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-common-internals packaging
More information about the pkg-kde-commits
mailing list