diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 45ff3da46..c305f68b2 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -830,7 +830,7 @@ void QupZilla::receiveMessage(Qz::AppMessageType mes, bool state) break; case Qz::AM_BookmarksChanged: - m_bookmarksMenuChanged = true; + setBookmarksMenuChanged(true); break; default: @@ -853,13 +853,13 @@ void QupZilla::aboutToHideFileMenu() void QupZilla::aboutToShowBookmarksMenu() { - if (!MENU_RECEIVER->bookmarksMenuChanged()) { - if (m_menuBookmarksAction) { - m_menuBookmarksAction->setVisible(m_bookmarksToolbar->isVisible()); + if (!bookmarksMenuChanged()) { + if (menuBookmarksAction()) { + menuBookmarksAction()->setVisible(m_bookmarksToolbar->isVisible()); } return; } - m_bookmarksMenuChanged = false; + setBookmarksMenuChanged(false); while (m_menuBookmarks->actions().count() != 4) { QAction* act = m_menuBookmarks->actions().at(4); @@ -910,7 +910,7 @@ void QupZilla::aboutToShowBookmarksMenu() if (menuBookmarks->isEmpty()) { menuBookmarks->addAction(tr("Empty"))->setEnabled(false); } - m_menuBookmarksAction = m_menuBookmarks->addMenu(menuBookmarks); + setMenuBookmarksAction(m_menuBookmarks->addMenu(menuBookmarks)); query.exec("SELECT name FROM folders"); while (query.next()) { @@ -962,7 +962,7 @@ void QupZilla::aboutToShowBookmarksMenu() m_menuBookmarks->addAction(act); } - m_menuBookmarksAction->setVisible(m_bookmarksToolbar->isVisible()); + menuBookmarksAction()->setVisible(m_bookmarksToolbar->isVisible()); } void QupZilla::aboutToShowHistoryMenu() @@ -1060,7 +1060,10 @@ void QupZilla::aboutToShowViewMenu() m_actionShowToolbar->setChecked(m_navigationBar->isVisible()); #ifndef Q_OS_MAC m_actionShowMenubar->setChecked(menuBar()->isVisible()); +#else + m_sideBarManager->setSideBarMenu(m_menuView->actions().at(1)->menu()); #endif + m_actionShowStatusbar->setChecked(statusBar()->isVisible()); m_actionShowBookmarksToolbar->setChecked(m_bookmarksToolbar->isVisible()); @@ -2081,6 +2084,42 @@ void QupZilla::clearClosedTabsList() m_tabWidget->clearClosedTabsList(); } +bool QupZilla::bookmarksMenuChanged() +{ +#ifdef Q_OS_MAC + return mApp->macMenuReceiver()->bookmarksMenuChanged(); +#else + return m_bookmarksMenuChanged; +#endif +} + +void QupZilla::setBookmarksMenuChanged(bool changed) +{ +#ifdef Q_OS_MAC + mApp->macMenuReceiver()->setBookmarksMenuChanged(changed); +#else + m_bookmarksMenuChanged = changed; +#endif +} + +QAction* QupZilla::menuBookmarksAction() +{ +#ifdef Q_OS_MAC + return mApp->macMenuReceiver()->menuBookmarksAction(); +#else + return m_menuBookmarksAction; +#endif +} + +void QupZilla::setMenuBookmarksAction(QAction* action) +{ +#ifdef Q_OS_MAC + mApp->macMenuReceiver()->setMenuBookmarksAction(action); +#else + m_menuBookmarksAction = action; +#endif +} + QByteArray QupZilla::saveState(int version) const { #ifdef QZ_WS_X11 diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index ce75460ec..d26624b0e 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -103,8 +103,6 @@ public: inline bool isClosing() { return m_isClosing; } inline QUrl homepageUrl() { return m_homepage; } - inline bool bookmarksMenuChanged() { return m_bookmarksMenuChanged; } - signals: void startingCompleted(); void message(Qz::AppMessageType mes, bool state); @@ -236,6 +234,12 @@ private: void moveToVirtualDesktop(int desktopId); #endif + bool bookmarksMenuChanged(); + void setBookmarksMenuChanged(bool changed); + + QAction* menuBookmarksAction(); + void setMenuBookmarksAction(QAction* action); + bool m_historyMenuChanged; bool m_bookmarksMenuChanged; bool m_isClosing; diff --git a/src/lib/other/macmenureceiver.cpp b/src/lib/other/macmenureceiver.cpp index e68d96e45..5cc6eb0a8 100644 --- a/src/lib/other/macmenureceiver.cpp +++ b/src/lib/other/macmenureceiver.cpp @@ -29,14 +29,11 @@ MacMenuReceiver::MacMenuReceiver(QObject* parent) : QObject(parent) , m_macMenuBar(0) + , m_menuBookmarksAction(0) + , m_bookmarksMenuChanged(true) { } -bool MacMenuReceiver::bookmarksMenuChanged() -{ - return mApp->getWindow() && mApp->getWindow()->bookmarksMenuChanged(); -} - void MacMenuReceiver::setEnabledSelectedMenuActions(QMenu* menu, const QList indexList) { if (!menu || mApp->windowCount() == 0) { diff --git a/src/lib/other/macmenureceiver.h b/src/lib/other/macmenureceiver.h index dbd136f12..1f3e4c069 100644 --- a/src/lib/other/macmenureceiver.h +++ b/src/lib/other/macmenureceiver.h @@ -37,7 +37,12 @@ public: inline QMenuBar* menuBar() { return m_macMenuBar; } inline void setMenuBar(QMenuBar* menuBar) { m_macMenuBar = menuBar; } - bool bookmarksMenuChanged(); + + inline bool bookmarksMenuChanged() { return m_bookmarksMenuChanged; } + inline void setBookmarksMenuChanged(bool changed) { m_bookmarksMenuChanged = changed; } + + inline QAction* menuBookmarksAction() { return m_menuBookmarksAction; } + inline void setMenuBookmarksAction(QAction* action) { m_menuBookmarksAction = action; } private: void setEnabledSelectedMenuActions(QMenu* menu, const QList indexList = QList()); @@ -47,6 +52,8 @@ private: QGenericArgument val1 = QGenericArgument()); QMenuBar* m_macMenuBar; + bool m_bookmarksMenuChanged; + QAction* m_menuBookmarksAction; private slots: void goNext();