From f1172628f530c5529d89daf06faecda49a55aa91 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Wed, 30 Sep 2009 13:56:04 +0200 Subject: "Added support" for opening URLs that start with www. --- src/webview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webview.cpp b/src/webview.cpp index fac98f71..45967430 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -215,7 +215,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) { // page action QString text = selectedText(); - if (text.startsWith( QLatin1String("http://") ) || text.startsWith( QLatin1String("https://") )) + if (text.startsWith( QLatin1String("http://") ) || text.startsWith( QLatin1String("https://") ) || text.startsWith( QLatin1String("www.") ) ) { //open selected text url in a new tab a = new KAction(KIcon("tab-new"), i18n("Open: '") + text.toUtf8().left(15) + QString("...'"), this); -- cgit v1.2.1 From afca7533c88b062a549363786abdac30d92d7d18 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Wed, 30 Sep 2009 14:47:28 +0200 Subject: Made the String "easier" to translatable, by changing some stuff. Thanks to Lionel and http://websvn.kde.org/trunk/playground/libs/webkitkde/part/webview.cpp?revision=993719&view=markup (lines 186-188) ;-) --- src/webview.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/webview.cpp b/src/webview.cpp index 45967430..0f92cff4 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -217,14 +217,21 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) QString text = selectedText(); if (text.startsWith( QLatin1String("http://") ) || text.startsWith( QLatin1String("https://") ) || text.startsWith( QLatin1String("www.") ) ) { + QString truncatedURL = text; + if (text.length() > 18) + { + truncatedURL.truncate(15); + truncatedURL += "..."; + } + //open selected text url in a new tab - a = new KAction(KIcon("tab-new"), i18n("Open: '") + text.toUtf8().left(15) + QString("...'"), this); + a = new KAction(KIcon("tab-new"), i18n("Open '%1' in New Tab", truncatedURL), this); a->setData(QUrl(text)); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab())); menu.addAction(a); //open selected text url in a new window - a = new KAction(KIcon("window-new"), i18n("Open: '") + text.toUtf8().left(15) + QString("...'"), this); + a = new KAction(KIcon("window-new"), i18n("Open '%1' in New Window", truncatedURL), this); a->setData(QUrl(text)); connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); menu.addAction(a); -- cgit v1.2.1