mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[Mac] Fixed, refresh state of menu actions
This commit is contained in:
parent
3346c8f1ce
commit
0293a7bcd3
@ -192,7 +192,10 @@ void QupZilla::postLaunch()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
case Qz::BW_MacFirstWindow:
|
case Qz::BW_MacFirstWindow:
|
||||||
|
QTimer::singleShot(0, this, SLOT(refreshStateOfAllActions()));
|
||||||
|
#endif
|
||||||
case Qz::BW_NewWindow:
|
case Qz::BW_NewWindow:
|
||||||
addTab = true;
|
addTab = true;
|
||||||
break;
|
break;
|
||||||
@ -247,6 +250,8 @@ void QupZilla::postLaunch()
|
|||||||
QMainWindow::setWindowTitle(m_lastWindowTitle);
|
QMainWindow::setWindowTitle(m_lastWindowTitle);
|
||||||
|
|
||||||
setUpdatesEnabled(true);
|
setUpdatesEnabled(true);
|
||||||
|
raise();
|
||||||
|
activateWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QupZilla::setupUi()
|
void QupZilla::setupUi()
|
||||||
@ -701,6 +706,16 @@ void QupZilla::setupMacMenu()
|
|||||||
m_actionPageInfo = m_menuTools->actions().at(1);
|
m_actionPageInfo = m_menuTools->actions().at(1);
|
||||||
m_actionPrivateBrowsing = m_menuTools->actions().at(9);
|
m_actionPrivateBrowsing = m_menuTools->actions().at(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QupZilla::refreshStateOfAllActions()
|
||||||
|
{
|
||||||
|
mApp->macMenuReceiver()->aboutToShowFileMenu(m_menuFile);
|
||||||
|
mApp->macMenuReceiver()->aboutToShowHistoryMenu(m_menuHistory);
|
||||||
|
mApp->macMenuReceiver()->aboutToShowBookmarksMenu(m_menuBookmarks);
|
||||||
|
mApp->macMenuReceiver()->aboutToShowViewMenu(m_menuView);
|
||||||
|
mApp->macMenuReceiver()->aboutToShowEditMenu(m_menuEdit);
|
||||||
|
mApp->macMenuReceiver()->aboutToShowToolsMenu(m_menuTools);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void QupZilla::loadSettings()
|
void QupZilla::loadSettings()
|
||||||
@ -2122,6 +2137,8 @@ void QupZilla::closeEvent(QCloseEvent* event)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
QTimer::singleShot(0, this, SLOT(refreshStateOfAllActions()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mApp->aboutToCloseWindow(this);
|
mApp->aboutToCloseWindow(this);
|
||||||
|
@ -209,6 +209,9 @@ private slots:
|
|||||||
void restoreAllClosedTabs();
|
void restoreAllClosedTabs();
|
||||||
void clearClosedTabsList();
|
void clearClosedTabsList();
|
||||||
void hideNavigationSlot();
|
void hideNavigationSlot();
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
void refreshStateOfAllActions();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
@ -426,9 +426,9 @@ void MacMenuReceiver::loadActionUrlInNewNotSelectedTab(QObject* obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// about to show/hide slots
|
// about to show/hide slots
|
||||||
void MacMenuReceiver::aboutToShowFileMenu()
|
void MacMenuReceiver::aboutToShowFileMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
menu = menu ? menu : qobject_cast<QMenu*>(sender());
|
||||||
setEnabledSelectedMenuActions(menu);
|
setEnabledSelectedMenuActions(menu);
|
||||||
if (!callSlot("aboutToShowFileMenu")) {
|
if (!callSlot("aboutToShowFileMenu")) {
|
||||||
setDisabledSelectedMenuActions(menu, QList<int>()
|
setDisabledSelectedMenuActions(menu, QList<int>()
|
||||||
@ -441,9 +441,9 @@ void MacMenuReceiver::aboutToHideFileMenu()
|
|||||||
callSlot("aboutToHideFileMenu");
|
callSlot("aboutToHideFileMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMenuReceiver::aboutToShowHistoryMenu()
|
void MacMenuReceiver::aboutToShowHistoryMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
menu = menu ? menu : qobject_cast<QMenu*>(sender());
|
||||||
// 2=Home, 3=Show all History, 7=Closed Tabs
|
// 2=Home, 3=Show all History, 7=Closed Tabs
|
||||||
setEnabledSelectedMenuActions(menu, QList<int>() << 2 << 3 << 7);
|
setEnabledSelectedMenuActions(menu, QList<int>() << 2 << 3 << 7);
|
||||||
if (!callSlot("aboutToShowHistoryMenu")) {
|
if (!callSlot("aboutToShowHistoryMenu")) {
|
||||||
@ -462,18 +462,18 @@ void MacMenuReceiver::aboutToShowClosedTabsMenu()
|
|||||||
callSlot("aboutToShowClosedTabsMenu");
|
callSlot("aboutToShowClosedTabsMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMenuReceiver::aboutToShowBookmarksMenu()
|
void MacMenuReceiver::aboutToShowBookmarksMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
menu = menu ? menu : qobject_cast<QMenu*>(sender());
|
||||||
setEnabledSelectedMenuActions(menu, QList<int>() << 0 << 1 << 2);
|
setEnabledSelectedMenuActions(menu, QList<int>() << 0 << 1 << 2);
|
||||||
if (!callSlot("aboutToShowBookmarksMenu")) {
|
if (!callSlot("aboutToShowBookmarksMenu")) {
|
||||||
setDisabledSelectedMenuActions(menu, QList<int>() << 0 << 1 << 2);
|
setDisabledSelectedMenuActions(menu, QList<int>() << 0 << 1 << 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMenuReceiver::aboutToShowViewMenu()
|
void MacMenuReceiver::aboutToShowViewMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
menu = menu ? menu : qobject_cast<QMenu*>(sender());
|
||||||
// 7,8,9=Zoom actions, 12=Character Encoding, 15=Fullscreen
|
// 7,8,9=Zoom actions, 12=Character Encoding, 15=Fullscreen
|
||||||
setEnabledSelectedMenuActions(menu, QList<int>()
|
setEnabledSelectedMenuActions(menu, QList<int>()
|
||||||
<< 0 << 1 << 2 << 7 << 8 << 9 << 11 << 12 << 15);
|
<< 0 << 1 << 2 << 7 << 8 << 9 << 11 << 12 << 15);
|
||||||
@ -492,9 +492,9 @@ void MacMenuReceiver::aboutToHideViewMenu()
|
|||||||
callSlot("aboutToHideViewMenu");
|
callSlot("aboutToHideViewMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMenuReceiver::aboutToShowEditMenu()
|
void MacMenuReceiver::aboutToShowEditMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
menu = menu ? menu : qobject_cast<QMenu*>(sender());
|
||||||
// 8=Find
|
// 8=Find
|
||||||
setEnabledSelectedMenuActions(menu, QList<int>() << 8);
|
setEnabledSelectedMenuActions(menu, QList<int>() << 8);
|
||||||
if (!callSlot("aboutToShowEditMenu")) {
|
if (!callSlot("aboutToShowEditMenu")) {
|
||||||
@ -507,9 +507,9 @@ void MacMenuReceiver::aboutToHideEditMenu()
|
|||||||
callSlot("aboutToHideEditMenu");
|
callSlot("aboutToHideEditMenu");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacMenuReceiver::aboutToShowToolsMenu()
|
void MacMenuReceiver::aboutToShowToolsMenu(QMenu* menu)
|
||||||
{
|
{
|
||||||
QMenu* menu = qobject_cast<QMenu*>(sender());
|
menu = menu ? menu : qobject_cast<QMenu*>(sender());
|
||||||
// enable all
|
// enable all
|
||||||
setEnabledSelectedMenuActions(menu);
|
setEnabledSelectedMenuActions(menu);
|
||||||
if (!callSlot("aboutToShowToolsMenu")) {
|
if (!callSlot("aboutToShowToolsMenu")) {
|
||||||
|
@ -44,6 +44,14 @@ public:
|
|||||||
inline QAction* menuBookmarksAction() { return m_menuBookmarksAction; }
|
inline QAction* menuBookmarksAction() { return m_menuBookmarksAction; }
|
||||||
inline void setMenuBookmarksAction(QAction* action) { m_menuBookmarksAction = action; }
|
inline void setMenuBookmarksAction(QAction* action) { m_menuBookmarksAction = action; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void aboutToShowFileMenu(QMenu* menu = 0);
|
||||||
|
void aboutToShowEditMenu(QMenu* menu = 0);
|
||||||
|
void aboutToShowViewMenu(QMenu* menu = 0);
|
||||||
|
void aboutToShowHistoryMenu(QMenu* menu = 0);
|
||||||
|
void aboutToShowBookmarksMenu(QMenu* menu = 0);
|
||||||
|
void aboutToShowToolsMenu(QMenu* menu = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setEnabledSelectedMenuActions(QMenu* menu, const QList<int> indexList = QList<int>());
|
void setEnabledSelectedMenuActions(QMenu* menu, const QList<int> indexList = QList<int>());
|
||||||
void setDisabledSelectedMenuActions(QMenu* menu, const QList<int> indexList = QList<int>());
|
void setDisabledSelectedMenuActions(QMenu* menu, const QList<int> indexList = QList<int>());
|
||||||
@ -66,17 +74,11 @@ private slots:
|
|||||||
void addTab();
|
void addTab();
|
||||||
void savePageScreen();
|
void savePageScreen();
|
||||||
|
|
||||||
void aboutToShowFileMenu();
|
|
||||||
void aboutToHideFileMenu();
|
void aboutToHideFileMenu();
|
||||||
void aboutToShowHistoryMenu();
|
|
||||||
void aboutToHideHistoryMenu();
|
void aboutToHideHistoryMenu();
|
||||||
void aboutToShowClosedTabsMenu();
|
void aboutToShowClosedTabsMenu();
|
||||||
void aboutToShowBookmarksMenu();
|
|
||||||
void aboutToShowViewMenu();
|
|
||||||
void aboutToHideViewMenu();
|
void aboutToHideViewMenu();
|
||||||
void aboutToShowEditMenu();
|
|
||||||
void aboutToHideEditMenu();
|
void aboutToHideEditMenu();
|
||||||
void aboutToShowToolsMenu();
|
|
||||||
void aboutToHideToolsMenu();
|
void aboutToHideToolsMenu();
|
||||||
void aboutToShowEncodingMenu();
|
void aboutToShowEncodingMenu();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user