Web: update browser commands after loading page

This commit is contained in:
wmayer
2022-06-04 13:21:41 +02:00
parent e3c384263c
commit 7305a73398
2 changed files with 19 additions and 1 deletions

View File

@@ -511,6 +511,10 @@ BrowserView::BrowserView(QWidget* parent)
this, SLOT(onOpenLinkInExternalBrowser(const QUrl &)));
connect(view, SIGNAL(openLinkInNewWindow(const QUrl &)),
this, SLOT(onOpenLinkInNewWindow(const QUrl &)));
connect(view, SIGNAL(loadStarted()),
this, SLOT(onUpdateBrowserActions()));
connect(view, SIGNAL(loadFinished(bool)),
this, SLOT(onUpdateBrowserActions()));
}
/** Destroys the object and frees any allocated resources */
@@ -785,6 +789,18 @@ void BrowserView::onOpenLinkInNewWindow(const QUrl& url)
Gui::getMainWindow()->setActiveWindow(this);
}
void BrowserView::onUpdateBrowserActions()
{
CommandManager& mgr = Application::Instance->commandManager();
std::vector<const char*> cmds = {"Web_BrowserBack", "Web_BrowserNext", "Web_BrowserRefresh", "Web_BrowserStop",
"Web_BrowserZoomIn", "Web_BrowserZoomOut", "Web_BrowserSetURL"};
for (const auto& it : cmds) {
Gui::Command* cmd = mgr.getCommandByName(it);
if (cmd)
cmd->testActive();
}
}
void BrowserView::OnChange(Base::Subject<const char*> &rCaller,const char* rcReason)
{
Q_UNUSED(rCaller);