summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-03-27 00:34:09 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-03-27 00:34:09 +0100
commitebd45e57568a821b9bd0fae7c88ff44af799510f (patch)
treeff7f94d03ef56af6024a8059fec4df645f20f87b /src/webview.cpp
parentFixing my fixed patch :) (diff)
downloadrekonq-ebd45e57568a821b9bd0fae7c88ff44af799510f.tar.xz
Fix context menu and set comments to improve its code (after 0.7 release)
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp46
1 files changed, 14 insertions, 32 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index 9e05a89e..3ec654ac 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -152,6 +152,7 @@ WebPage *WebView::page()
}
+// TODO: refactor me!
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
@@ -177,6 +178,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
menu.addAction(a);
+ menu.addSeparator();
menu.addAction(pageAction(KWebPage::DownloadLinkToDisk));
menu.addAction(pageAction(KWebPage::CopyLinkToClipboard));
menu.addSeparator();
@@ -283,46 +285,26 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(slotCopyImageLocation()));
menu.addAction(a);
- menu.addAction(pageAction(KWebPage::CopyLinkToClipboard));
menu.addSeparator();
if (ReKonfig::showDeveloperTools())
menu.addAction(inspectAction);
}
- // Open url text in new tab/window
- if (result.linkUrl().isEmpty())
- {
-
- QString text = selectedText();
- text = text.trimmed();
- if (text.startsWith(QL1S("http://"))
- || text.startsWith(QL1S("https://"))
- || text.startsWith(QL1S("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 '%1' in New Tab", truncatedURL), this);
- a->setData(QUrl(text));
- connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab()));
- menu.addAction(a);
+// TODO: REMOVE ME!
+// These actions are here just to NOT remove strings until stable release.
+// Just remove the lines here after that.
+if (result.linkUrl().isEmpty())
+{
+ QString truncatedURL;
- //open selected text url in a new window
- 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);
+ //open selected text url in a new tab
+ a = new KAction(KIcon("tab-new"), i18n("Open '%1' in New Tab", truncatedURL), this);
- menu.addSeparator();
- }
- }
+ //open selected text url in a new window
+ a = new KAction(KIcon("window-new"), i18n("Open '%1' in New Window", truncatedURL), this);
+}
+// TODO: ----------- END REMOVE
// page actions
if (!result.isContentSelected() && result.linkUrl().isEmpty())