diff options
author | Johannes Tröscher <fritz_van_tom@hotmail.com> | 2011-08-02 19:49:15 +0200 |
---|---|---|
committer | Johannes Tröscher <fritz_van_tom@hotmail.com> | 2011-08-02 19:49:15 +0200 |
commit | 961e1472e3b81046dec8fb61c9bd95589230890f (patch) | |
tree | e505b85f5162d99c4792104efb89dcd650c30c46 /src/webview.cpp | |
parent | detect srollbar extent in notifyMessage REVIEW:102182 (diff) | |
download | rekonq-961e1472e3b81046dec8fb61c9bd95589230890f.tar.xz |
action to search with default searchEnine in marked text's context menu. REVIEW:102180
Diffstat (limited to 'src/webview.cpp')
-rw-r--r-- | src/webview.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/webview.cpp b/src/webview.cpp index d416af49..f31d2343 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -229,6 +229,18 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) // is content selected? Add SEARCH actions if (result.isContentSelected()) { + //Default SearchEngine + KService::Ptr defaultEngine = SearchEngine::defaultEngine(); + if (defaultEngine) // check if a default engine is set + { + a = new KAction(i18nc("Search selected text with the default search engine", "Search with %1", defaultEngine->name()), this); + a->setIcon(rApp->iconManager()->iconForUrl(SearchEngine::buildQuery(defaultEngine, ""))); + a->setData(defaultEngine->entryPath()); + connect(a, SIGNAL(triggered(bool)), this, SLOT(search())); + menu.addAction(a); + } + + //All favourite ones KActionMenu *searchMenu = new KActionMenu(KIcon("edit-find"), i18n("Search with"), this); foreach(const KService::Ptr & engine, SearchEngine::favorites()) |