1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

SuperMenu: Fix enabling Select All and Find actions

This commit is contained in:
David Rosca 2015-04-09 20:07:56 +02:00
parent f1a6499b07
commit 8d34cbc02e
2 changed files with 23 additions and 0 deletions

View File

@ -102,6 +102,9 @@ void MainMenu::initSuperMenu(QMenu* superMenu) const
superMenu->addAction(m_actions[QSL("File/WorkOffline")]);
superMenu->addSeparator();
superMenu->addAction(m_actions[QSL("Standard/Quit")]);
connect(superMenu, &QMenu::aboutToShow, this, &MainMenu::aboutToShowSuperMenu);
connect(superMenu, &QMenu::aboutToHide, this, &MainMenu::aboutToHideSuperMenu);
}
QAction* MainMenu::action(const QString &name) const
@ -455,6 +458,24 @@ void MainMenu::aboutToHideToolsMenu()
m_actions[QSL("Tools/SiteInfo")]->setEnabled(false);
}
void MainMenu::aboutToShowSuperMenu()
{
if (!m_window) {
return;
}
WebView* view = m_window->weView();
m_actions[QSL("Edit/Find")]->setEnabled(true);
m_actions[QSL("Edit/SelectAll")]->setEnabled(view->pageAction(QWebEnginePage::SelectAll)->isEnabled());
}
void MainMenu::aboutToHideSuperMenu()
{
m_actions[QSL("Edit/Find")]->setEnabled(true);
m_actions[QSL("Edit/SelectAll")]->setEnabled(false);
}
void MainMenu::aboutToShowToolbarsMenu()
{
QMenu* menu = qobject_cast<QMenu*>(sender());

View File

@ -111,6 +111,8 @@ private slots:
void aboutToHideEditMenu();
void aboutToShowToolsMenu();
void aboutToHideToolsMenu();
void aboutToShowSuperMenu();
void aboutToHideSuperMenu();
void aboutToShowToolbarsMenu();
void aboutToShowSidebarsMenu();