From b1b5a58d7cd5f67cfd20237ea9700057608072b2 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Fri, 20 Aug 2010 16:45:40 +0200 Subject: Fix the help menu and readd the bookmark bar toggle action --- src/mainwindow.cpp | 105 ++++++++++++++++++++++++++++++++--------------------- src/mainwindow.h | 3 ++ 2 files changed, 66 insertions(+), 42 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f0cb5e61..d7eb4efd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -74,6 +74,7 @@ #include #include #include +#include // Qt Includes #include @@ -110,6 +111,7 @@ MainWindow::MainWindow() , m_bookmarksBar(0) , m_popup(new KPassivePopup(this)) , m_hidePopup(new QTimer(this)) + , m_toolsMenu(0) { // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; @@ -216,6 +218,8 @@ void MainWindow::initBookmarkBar() } m_bookmarksBar = new BookmarkToolBar(XMLGUIBkBar, this); Application::bookmarkProvider()->registerBookmarkBar(m_bookmarksBar); + + initToolsMenu(); } @@ -231,6 +235,58 @@ void MainWindow::configureToolbars() } +void MainWindow::initToolsMenu() +{ + if (!m_toolsMenu) + return; + + m_toolsMenu->menu()->clear(); + + 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))); + + 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_toolsMenu->addAction(actionByName(QL1S("encodings"))); + + m_toolsMenu->addSeparator(); + + m_toolsMenu->addAction(actionByName(QL1S("private_browsing"))); + m_toolsMenu->addAction(actionByName(QL1S("clear_private_data"))); + + m_toolsMenu->addSeparator(); + + KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Development"), this); + webMenu->addAction(actionByName(QL1S("web_inspector"))); + webMenu->addAction(actionByName(QL1S("page_source"))); + webMenu->addAction(actionByName(QL1S("net_analyzer"))); + m_toolsMenu->addAction(webMenu); + + m_toolsMenu->addSeparator(); + + action = m_bookmarksBar->toolBar()->toggleViewAction(); + action->setText("Bookmark Toolbar"); + action->setIcon(KIcon("bookmarks-bar")); + m_toolsMenu->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_toolsMenu->addSeparator(); + + this->setHelpMenuEnabled(true); + helpMenu()->setIcon(KIcon("help-browser")); + m_toolsMenu->addAction(helpMenu()->menuAction()); + m_toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences))); +} + + void MainWindow::postLaunch() { setupBookmarksAndToolsShortcuts(); @@ -464,50 +520,15 @@ void MainWindow::setupActions() void MainWindow::setupTools() { kDebug() << "setup tools..."; - KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this); - toolsMenu->setDelayed(false); - toolsMenu->setShortcutConfigurable(true); - toolsMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_T) ); - - toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Open))); - toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs))); - toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print))); - toolsMenu->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))); - toolsMenu->addAction(action); - - toolsMenu->addAction(actionByName(QL1S("encodings"))); - - toolsMenu->addSeparator(); - - toolsMenu->addAction(actionByName(QL1S("private_browsing"))); - toolsMenu->addAction(actionByName(QL1S("clear_private_data"))); - - toolsMenu->addSeparator(); - - KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Development"), this); - webMenu->addAction(actionByName(QL1S("web_inspector"))); - webMenu->addAction(actionByName(QL1S("page_source"))); - webMenu->addAction(actionByName(QL1S("net_analyzer"))); - toolsMenu->addAction(webMenu); - - toolsMenu->addSeparator(); - - toolsMenu->addAction(actionByName(QL1S("show_history_panel"))); - toolsMenu->addAction(actionByName(QL1S("show_bookmarks_panel"))); - toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen))); - - toolsMenu->addSeparator(); - - helpMenu()->setIcon(KIcon("help-browser")); - toolsMenu->addAction(helpMenu()->menuAction()); - toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences))); + m_toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this); + m_toolsMenu->setDelayed(false); + m_toolsMenu->setShortcutConfigurable(true); + m_toolsMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_T) ); // adding rekonq_tools to rekonq actionCollection - actionCollection()->addAction(QL1S("rekonq_tools"), toolsMenu); + actionCollection()->addAction(QL1S("rekonq_tools"), m_toolsMenu); + + // Actions are added after the call to setupGUI() to ensure the help menu works } diff --git a/src/mainwindow.h b/src/mainwindow.h index 6ae99b5e..e135adca 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -167,6 +167,7 @@ private slots: void enableNetworkAnalysis(bool); void initBookmarkBar(); + void initToolsMenu(); private: MainView *m_view; @@ -188,6 +189,8 @@ private: KPassivePopup *m_popup; QTimer *m_hidePopup; + + KActionMenu *m_toolsMenu; }; #endif // MAINWINDOW_H -- cgit v1.2.1 From 0c3309c35377fd8cd6e051f5e2052b341fbe9cd8 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Fri, 20 Aug 2010 20:00:52 +0200 Subject: Make a string translatable --- src/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d7eb4efd..0cab6899 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -219,6 +219,7 @@ void MainWindow::initBookmarkBar() m_bookmarksBar = new BookmarkToolBar(XMLGUIBkBar, this); Application::bookmarkProvider()->registerBookmarkBar(m_bookmarksBar); + // To update the bookmark toolbar action initToolsMenu(); } @@ -270,7 +271,7 @@ void MainWindow::initToolsMenu() m_toolsMenu->addSeparator(); action = m_bookmarksBar->toolBar()->toggleViewAction(); - action->setText("Bookmark Toolbar"); + action->setText(i18n("Bookmarks Toolbar")); action->setIcon(KIcon("bookmarks-bar")); m_toolsMenu->addAction(action); -- cgit v1.2.1 From 8443676e2b9d575d4199cd23ec24da47543b7e40 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Fri, 20 Aug 2010 20:03:41 +0200 Subject: Useless include --- src/mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0cab6899..1017582e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -74,7 +74,6 @@ #include #include #include -#include // Qt Includes #include -- cgit v1.2.1