mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[Mac gobalmenu] Fixed issue about bookmark menu and sidebar menu.
This commit is contained in:
parent
7b0e45269f
commit
a1ff0799cb
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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<int> indexList)
|
||||
{
|
||||
if (!menu || mApp->windowCount() == 0) {
|
||||
|
@ -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<int> indexList = QList<int>());
|
||||
@ -47,6 +52,8 @@ private:
|
||||
QGenericArgument val1 = QGenericArgument());
|
||||
|
||||
QMenuBar* m_macMenuBar;
|
||||
bool m_bookmarksMenuChanged;
|
||||
QAction* m_menuBookmarksAction;
|
||||
|
||||
private slots:
|
||||
void goNext();
|
||||
|
Loading…
Reference in New Issue
Block a user