summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/webview.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index fac98f71..0f92cff4 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -215,16 +215,23 @@ 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.") ) )
{
+ 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);