diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9d2f0ff4..c0085d50 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -35,6 +35,7 @@ #include "rekonq.h" // Local Includes +#include "adblockmanager.h" #include "analyzerpanel.h" #include "application.h" #include "bookmarkprovider.h" @@ -114,8 +115,8 @@ MainWindow::MainWindow() , m_bookmarksBar(0) , m_popup(new KPassivePopup(this)) , m_hidePopupTimer(new QTimer(this)) - , m_toolsMenu(0) - , m_developerMenu(0) + , m_rekonqMenu(0) + , m_toolsActionMenu(0) { // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; @@ -223,56 +224,57 @@ void MainWindow::configureToolbars() void MainWindow::updateToolsMenu() { - if (m_toolsMenu->isEmpty()) + if (m_rekonqMenu->isEmpty()) { - m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Open))); - m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs))); - m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print))); - m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find))); + m_rekonqMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Open))); + m_rekonqMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs))); + m_rekonqMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print))); + m_rekonqMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find))); QAction *action = actionByName(KStandardAction::name(KStandardAction::Zoom)); action->setCheckable(true); connect(m_zoomBar, SIGNAL(visibilityChanged(bool)), action, SLOT(setChecked(bool))); - m_toolsMenu->addAction(action); + m_rekonqMenu->addAction(action); - m_toolsMenu->addAction(actionByName(QL1S("useragent"))); + m_rekonqMenu->addSeparator(); - m_toolsMenu->addSeparator(); + m_rekonqMenu->addAction(actionByName(QL1S("private_browsing"))); + m_rekonqMenu->addAction(actionByName(QL1S("clear_private_data"))); - m_toolsMenu->addAction(actionByName(QL1S("private_browsing"))); - m_toolsMenu->addAction(actionByName(QL1S("clear_private_data"))); + m_rekonqMenu->addSeparator(); - m_toolsMenu->addSeparator(); + // tools Action Menu + m_toolsActionMenu = new KActionMenu(KIcon("preferences-other"), i18n("Tools"), this); + m_toolsActionMenu->addAction(actionByName(QL1S("web_inspector"))); + m_toolsActionMenu->addAction(actionByName(QL1S("page_source"))); + m_toolsActionMenu->addAction(actionByName(QL1S("net_analyzer"))); + m_toolsActionMenu->addAction(actionByName(QL1S("set_editable"))); - m_developerMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Development"), this); - m_developerMenu->addAction(actionByName(QL1S("web_inspector"))); - m_developerMenu->addAction(actionByName(QL1S("page_source"))); - m_developerMenu->addAction(actionByName(QL1S("net_analyzer"))); - m_developerMenu->addAction(actionByName(QL1S("set_editable"))); + m_toolsActionMenu->addSeparator(); - m_toolsMenu->addAction(m_developerMenu); - if (!ReKonfig::showDeveloperTools()) - m_developerMenu->setVisible(false); + m_toolsActionMenu->addAction(actionByName(QL1S("useragent"))); + m_toolsActionMenu->addAction(actionByName(QL1S("adblock"))); - m_toolsMenu->addSeparator(); + m_rekonqMenu->addAction(m_toolsActionMenu); + // ----------------------------------------------------------------------------------------- + + m_rekonqMenu->addSeparator(); action = m_bookmarksBar->toolBar()->toggleViewAction(); action->setText(i18n("Bookmarks Toolbar")); action->setIcon(KIcon("bookmarks-bar")); - m_toolsMenu->addAction(action); + m_rekonqMenu->addAction(action); - m_toolsMenu->addAction(actionByName(QL1S("show_history_panel"))); - m_toolsMenu->addAction(actionByName(QL1S("show_bookmarks_panel"))); - m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen))); + m_rekonqMenu->addAction(actionByName(QL1S("show_history_panel"))); + m_rekonqMenu->addAction(actionByName(QL1S("show_bookmarks_panel"))); + m_rekonqMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen))); - m_toolsMenu->addSeparator(); + m_rekonqMenu->addSeparator(); helpMenu()->setIcon(KIcon("help-browser")); - m_toolsMenu->addAction(helpMenu()->menuAction()); - m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences))); + m_rekonqMenu->addAction(helpMenu()->menuAction()); + m_rekonqMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences))); } - - m_developerMenu->setVisible(ReKonfig::showDeveloperTools()); } @@ -549,10 +551,16 @@ void MainWindow::setupActions() actionCollection()->addAction(QL1S("UserAgentSettings"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(showUserAgentSettings())); + // Editable Page a = new KAction(KIcon(""), i18n("set editable"), this); a->setCheckable(true); actionCollection()->addAction(QL1S("set_editable"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(setEditable(bool))); + + // Adblock + a = new KAction(KIcon("preferences-web-browser-adblock"), i18n("Ad Block"), this); + actionCollection()->addAction(QL1S("adblock"), a); + connect(a, SIGNAL(triggered(bool)), rApp->adblockManager(), SLOT(showSettings())); } @@ -562,9 +570,9 @@ void MainWindow::setupTools() toolsAction->setDelayed(false); toolsAction->setShortcutConfigurable(true); toolsAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_T)); - m_toolsMenu = new KMenu(this); - toolsAction->setMenu(m_toolsMenu); // dummy menu to have the dropdown arrow - connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(updateToolsMenu())); + m_rekonqMenu = new KMenu(this); + toolsAction->setMenu(m_rekonqMenu); // dummy menu to have the dropdown arrow + connect(m_rekonqMenu, SIGNAL(aboutToShow()), this, SLOT(updateToolsMenu())); // adding rekonq_tools to rekonq actionCollection actionCollection()->addAction(QL1S("rekonq_tools"), toolsAction); |