From bdf8ed4c678acb07f273fd3b722dd39773348395 Mon Sep 17 00:00:00 2001 From: Felix Rohrbach Date: Mon, 10 Jan 2011 21:10:39 +0100 Subject: This commit contains the changes to the context menu which we decided in our meeting: 1. Hide new tab entry if it is not necessary. 2. Print and Search action: I removed the print action. The search action is now in the "search with" submenu if some text is selected. 3. Hide the development menu entries and add an option to show them. RB: 100374 --- src/mainwindow.cpp | 6 ++++++ src/mainwindow.h | 1 + src/rekonq.kcfg | 3 +++ src/settings/settings_webkit.ui | 7 +++++++ src/webview.cpp | 32 +++++++++++++++++--------------- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 599295f7..13660eb9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -863,6 +863,12 @@ void MainWindow::updateHighlight() } } +void MainWindow::findSelectedText() +{ + // FindBar::setVisible() gets the selected text by itself + m_findBar->show(); +} + void MainWindow::viewFullScreen(bool makeFullScreen) { diff --git a/src/mainwindow.h b/src/mainwindow.h index 7dfc186b..02cd7237 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -107,6 +107,7 @@ public Q_SLOTS: void findNext(); void findPrevious(); void updateHighlight(); + void findSelectedText(); Q_SIGNALS: // switching tabs diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index cda76d88..c655d359 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -30,6 +30,9 @@ 0 + + false + diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui index 58fbe459..00bced99 100644 --- a/src/settings/settings_webkit.ui +++ b/src/settings/settings_webkit.ui @@ -120,6 +120,13 @@ + + + + Show web developer tools + + + diff --git a/src/webview.cpp b/src/webview.cpp index 49fa1032..d3eb2f49 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -166,13 +166,6 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addSeparator(); } - // add find action. - if(result.pixmap().isNull()) - { - a = mainwindow->actionByName(KStandardAction::name(KStandardAction::Find)); - menu.addAction(a); - } - // is content editable && selected? Add CUT if (result.isContentEditable() && result.isContentSelected()) { @@ -224,8 +217,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) { menu.addAction(pageAction(KWebPage::Paste)); } - a = mainwindow->actionByName(KStandardAction::name(KStandardAction::Print)); - menu.addAction(a); + // is content selected? Add SEARCH actions if (result.isContentSelected()) { @@ -240,6 +232,10 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) searchMenu->addAction(a); } + a = new KAction(KIcon("edit-find"), i18n("On Current Page"), this); + connect(a, SIGNAL(triggered()), Application::instance()->mainWindow(), SLOT(findSelectedText())); + searchMenu->addAction(a); + if (!searchMenu->menu()->isEmpty()) { menu.addAction(searchMenu); @@ -247,7 +243,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addSeparator(); - menu.addAction(inspectAction); + if (ReKonfig::showDeveloperTools()) + menu.addAction(inspectAction); // TODO Add translate, show translation } @@ -273,7 +270,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(pageAction(KWebPage::CopyLinkToClipboard)); menu.addSeparator(); - menu.addAction(inspectAction); + if (ReKonfig::showDeveloperTools()) + menu.addAction(inspectAction); } // Open url text in new tab/window @@ -332,7 +330,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) { menu.addSeparator(); - menu.addAction(mainwindow->actionByName("new_tab")); + if (!ReKonfig::alwaysShowTabBar() && mainwindow->mainView()->count() == 1) + menu.addAction(mainwindow->actionByName("new_tab")); + menu.addAction(mainwindow->actionByName("new_window")); menu.addSeparator(); @@ -362,9 +362,11 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(a); } - menu.addAction(mainwindow->actionByName("page_source")); - - menu.addAction(inspectAction); + if (ReKonfig::showDeveloperTools()) + { + menu.addAction(mainwindow->actionByName("page_source")); + menu.addAction(inspectAction); + } a = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); menu.addAction(a); -- cgit v1.2.1