summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/webview.cpp39
-rw-r--r--src/webview.h3
2 files changed, 40 insertions, 2 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index ec747b36..97c2f325 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -170,6 +170,20 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
a->setShortcut(KStandardShortcut::paste().primary());
menu.addAction(a);
+ menu.addSeparator();
+
+ a = new KAction(i18n("Google Search"), this);
+ a->setIcon(Application::icon(KUrl("http://www.google.com")));
+ a->setData("gg:");
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(slotGoogleSearch()));
+ menu.addAction(a);
+
+ a = new KAction(i18n("Wikipedia Search"), this);
+ a->setIcon(Application::icon(KUrl("http://wikipedia.org")));
+ a->setData("wk:");
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(slotWikipediaSearch()));
+ menu.addAction(a);
+
// TODO Add translate, show translation
}
else if (result.isContentEditable())
@@ -191,7 +205,21 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
a->setShortcut(KStandardShortcut::copy().primary());
menu.addAction(a);
- // TODO Add search with google, wikipedia, show translation
+ menu.addSeparator();
+
+ a = new KAction(i18n("Google Search"), this);
+ a->setIcon(Application::icon(KUrl("http://www.google.com")));
+ a->setData("gg:");
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(slotGooWikiSearch()));
+ menu.addAction(a);
+
+ a = new KAction(i18n("Wikipedia Search"), this);
+ a->setIcon(Application::icon(KUrl("http://wikipedia.org")));
+ a->setData("wk:");
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(slotGooWikiSearch()));
+ menu.addAction(a);
+
+ // TODO Add translate, show translation
}
else
{
@@ -283,3 +311,12 @@ void WebView::mousePressEvent(QMouseEvent *event)
QWebView::mousePressEvent(event);
};
}
+
+
+void WebView::slotGooWikiSearch()
+{
+ KAction *a = qobject_cast<KAction*>(sender());
+ QString search = a->data().toString() + selectedText();
+ KUrl urlSearch = KUrl::fromEncoded(search.toUtf8());
+ Application::instance()->loadUrl(urlSearch, Rekonq::NewTab);
+}
diff --git a/src/webview.h b/src/webview.h
index 4efb2733..ea80ef1a 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -64,7 +64,8 @@ private slots:
void setProgress(int progress);
void loadFinished();
void setStatusBarText(const QString &string);
-
+ void slotGooWikiSearch();
+
private:
WebPage *m_page;