diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-12-15 16:51:18 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-12-15 16:51:18 +0100 |
commit | 159d1d66494869c7eb95f740144ed69b7cea7a0c (patch) | |
tree | 0c93e103e31776a61d86d66e4a39a01a35373b17 | |
parent | Add kDebug message (diff) | |
parent | Hard-coded shortcuts fix (diff) | |
download | rekonq-159d1d66494869c7eb95f740144ed69b7cea7a0c.tar.xz |
Merge branch 'ImproveNewTabPages'
-rw-r--r-- | src/mainwindow.cpp | 36 | ||||
-rw-r--r-- | src/mainwindow.h | 7 |
2 files changed, 32 insertions, 11 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d02f75f5..6b15385d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -217,8 +217,8 @@ MainWindow::MainWindow() // accept d'n'd setAcceptDrops(true); - // Bookmark ToolBar (needs to be setup after the call to setupGUI()) - QTimer::singleShot(1, this, SLOT(initBookmarkBar())); + // Things that need to be setup after the call to setupGUI() and after ctor call + QTimer::singleShot(1, this, SLOT(postLaunch())); } @@ -247,8 +247,9 @@ void MainWindow::setupToolbars() } -void MainWindow::initBookmarkBar() +void MainWindow::postLaunch() { + // Bookmarks Bar KToolBar *XMLGUIBkBar = toolBar("bookmarkToolBar"); if (!XMLGUIBkBar) return; @@ -261,8 +262,19 @@ void MainWindow::initBookmarkBar() m_bookmarksBar = new BookmarkToolBar(XMLGUIBkBar, this); rApp->bookmarkManager()->registerBookmarkBar(m_bookmarksBar); - QAction *a = actionByName(QL1S("show_bookmarks_toolbar")); + QAction *a; + + // Bookmarks bar action + a = actionByName(QL1S("show_bookmarks_toolbar")); a->setChecked(XMLGUIBkBar->isVisible()); + + // History panel action + a = actionByName(QL1S("show_history_panel")); + a->setChecked(m_historyPanel->isVisible()); + + // Bookmarks panel action + a = actionByName(QL1S("show_bookmarks_panel")); + a->setChecked(m_bookmarksPanel->isVisible()); } @@ -558,7 +570,8 @@ void MainWindow::setupPanels() // STEP 1 // Setup history panel - m_historyPanel = new HistoryPanel(i18n("History Panel"), this); + const QString historyTitle = i18n("History Panel"); + m_historyPanel = new HistoryPanel(historyTitle, this); connect(m_historyPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), rApp, SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); connect(m_historyPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString))); @@ -567,14 +580,16 @@ void MainWindow::setupPanels() addDockWidget(Qt::LeftDockWidgetArea, m_historyPanel); // setup history panel action - a = (KAction *) m_historyPanel->toggleViewAction(); + a = new KAction(KIcon("view-history"), historyTitle, this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); - a->setIcon(KIcon("view-history")); actionCollection()->addAction(QL1S("show_history_panel"), a); + a->setCheckable(true); + connect(a, SIGNAL(triggered(bool)), m_historyPanel, SLOT(setVisible(bool))); // STEP 2 // Setup bookmarks panel - m_bookmarksPanel = new BookmarksPanel(i18n("Bookmarks Panel"), this); + const QString bookmarksTitle = i18n("Bookmarks Panel"); + m_bookmarksPanel = new BookmarksPanel(bookmarksTitle, this); connect(m_bookmarksPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), rApp, SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); connect(m_bookmarksPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString))); @@ -585,10 +600,11 @@ void MainWindow::setupPanels() rApp->bookmarkManager()->registerBookmarkPanel(m_bookmarksPanel); // setup bookmarks panel action - a = (KAction *) m_bookmarksPanel->toggleViewAction(); + a = new KAction(KIcon("bookmarks-organize"), bookmarksTitle, this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); - a->setIcon(KIcon("bookmarks-organize")); actionCollection()->addAction(QL1S("show_bookmarks_panel"), a); + a->setCheckable(true); + connect(a, SIGNAL(triggered(bool)), m_bookmarksPanel, SLOT(setVisible(bool))); // STEP 3 // Setup webinspector panel diff --git a/src/mainwindow.h b/src/mainwindow.h index e64cdc22..8d827b04 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -182,9 +182,14 @@ private Q_SLOTS: void enableNetworkAnalysis(bool); void setEditable(bool); - void initBookmarkBar(); void toggleBookmarkBarVisible(bool); + /** + * This is for the things to do ABSOLUTELY AFTER ctor launch: + * the less, the better. + */ + void postLaunch(); + private: MainView *m_view; FindBar *m_findBar; |