summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorYoann Laissus <yoann.laissus@gmail.com>2010-08-20 16:45:40 +0200
committerYoann Laissus <yoann.laissus@gmail.com>2010-08-20 16:45:40 +0200
commitb1b5a58d7cd5f67cfd20237ea9700057608072b2 (patch)
tree491a393dfcafac7e297533452f2069f8a0f1c82c /src/mainwindow.cpp
parent- The bookmark toolbar is now a real toolbar, not an action. (diff)
downloadrekonq-b1b5a58d7cd5f67cfd20237ea9700057608072b2.tar.xz
Fix the help menu and readd the bookmark bar toggle action
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp105
1 files changed, 63 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 <KStandardDirs>
#include <KActionCategory>
#include <KProcess>
+#include <KActionMenu>
// Qt Includes
#include <QtCore/QTimer>
@@ -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
}