[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:03 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=95aab61
The following commit has been merged in the master branch:
commit 95aab61a3330125f1a266e20b9470f60eb27e198
Author: Francesco <francesco.nwokeka at gmail.com>
Date: Sun Mar 13 11:18:56 2011 +0100
Resolved "non clickable links" bug
BUG: 265422 @ http://bugs.kde.org/265422
Added Regex for link detection
---
lib/adium-theme-view.cpp | 22 ++++++++++++++++++++++
lib/adium-theme-view.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index acd3a38..1eefafb 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -40,6 +40,7 @@
#include <KConfig>
#include <KConfigGroup>
#include <KMessageBox>
+#include <KToolInvocation>
AdiumThemeView::AdiumThemeView(QWidget *parent)
@@ -78,6 +79,11 @@ AdiumThemeView::AdiumThemeView(QWidget *parent)
//special HTML debug mode. Debugging/Profiling only (or theme creating) should have no visible way to turn this flag on.
m_webInspector = appearanceConfig.readEntry("debug", false);
+
+ // don't let QWebView handle the links, we do
+ page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+
+ connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(onLinkClicked(QUrl)));
}
void AdiumThemeView::initialise(const AdiumThemeHeaderInfo &chatInfo)
@@ -246,6 +252,11 @@ void AdiumThemeView::addStatusMessage(const AdiumThemeStatusInfo& statusMessage)
appendNewMessage(styleHtml);
}
+void AdiumThemeView::onLinkClicked(const QUrl& url)
+{
+ KToolInvocation::invokeBrowser(url.toString());
+}
+
/** Private */
@@ -301,6 +312,16 @@ QString AdiumThemeView::replaceMessageKeywords(QString &htmlTemplate, const Adiu
{
//message
htmlTemplate.replace("%message%", m_emoticons.theme().parseEmoticons(info.message()));
+
+ QRegExp linkRegExp("https{0,1}://[^
]+");
+ int index = 0;
+ while((index = linkRegExp.indexIn(htmlTemplate, index)) != -1) {
+ QString link = "<a href='" + linkRegExp.cap(0) + "'>" + linkRegExp.cap(0) + "</a>";
+ htmlTemplate.replace(index, linkRegExp.cap(0).length(), link);
+ // advance pos otherwise i end up parsing same link
+ index += link.length();
+ }
+
//service
htmlTemplate.replace("%service%", info.service());
//time
@@ -314,6 +335,7 @@ QString AdiumThemeView::replaceMessageKeywords(QString &htmlTemplate, const Adiu
QString timeKeyword = formatTime(timeRegExp.cap(1), info.time());
htmlTemplate.replace(pos , timeRegExp.cap(0).length() , timeKeyword);
}
+
return htmlTemplate;
}
diff --git a/lib/adium-theme-view.h b/lib/adium-theme-view.h
index 6ba2af1..b984099 100644
--- a/lib/adium-theme-view.h
+++ b/lib/adium-theme-view.h
@@ -59,6 +59,7 @@ public:
public slots:
void addContentMessage(const AdiumThemeContentInfo&);
void addStatusMessage(const AdiumThemeStatusInfo&);
+ void onLinkClicked(const QUrl&);
private:
ChatWindowStyle* m_chatStyle;
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list