Commit 897435e5 authored by Eugene Popov's avatar Eugene Popov 🇺🇦
Browse files

Use applyMainWindowSettings instead of showEvent to apply menubar visibility

parent 5fc0c180
...@@ -378,6 +378,18 @@ void MainWindow::viewFullScreen(bool fullScreen) ...@@ -378,6 +378,18 @@ void MainWindow::viewFullScreen(bool fullScreen)
} }
} }
void MainWindow::applyMainWindowSettings(const KConfigGroup &config)
{
KMainWindow::applyMainWindowSettings(config);
// Override the menubar state from the config file
if (_windowArgsMenuBarVisible.enabled) {
menuBar()->setVisible(_windowArgsMenuBarVisible.showMenuBar);
}
_toggleMenuBarAction->setChecked(menuBar()->isVisibleTo(this));
}
BookmarkHandler *MainWindow::bookmarkHandler() const BookmarkHandler *MainWindow::bookmarkHandler() const
{ {
return _bookmarkHandler; return _bookmarkHandler;
...@@ -880,17 +892,6 @@ void MainWindow::showEvent(QShowEvent *event) ...@@ -880,17 +892,6 @@ void MainWindow::showEvent(QShowEvent *event)
if (_firstShowEvent) { if (_firstShowEvent) {
_firstShowEvent = false; _firstShowEvent = false;
// The initial visibility of menubar should be applied at this last
// moment. Otherwise, the initial visibility will be determined by
// what KMainWindow has automatically stored in konsolerc, but not by
// what users has explicitly configured
if (_windowArgsMenuBarVisible.enabled) {
menuBar()->setVisible(_windowArgsMenuBarVisible.showMenuBar);
_toggleMenuBarAction->setChecked(_windowArgsMenuBarVisible.showMenuBar);
} else {
_toggleMenuBarAction->setChecked(menuBar()->isVisible());
}
if (!KonsoleSettings::rememberWindowSize() || !wasWindowGeometrySaved()) { if (!KonsoleSettings::rememberWindowSize() || !wasWindowGeometrySaved()) {
// Delay resizing to here, so that the other parts of the UI // Delay resizing to here, so that the other parts of the UI
// (ViewManager, TabbedViewContainer, TerminalDisplay ... etc) // (ViewManager, TabbedViewContainer, TerminalDisplay ... etc)
......
...@@ -172,6 +172,8 @@ public Q_SLOTS: ...@@ -172,6 +172,8 @@ public Q_SLOTS:
void viewFullScreen(bool fullScreen); void viewFullScreen(bool fullScreen);
private: private:
void applyMainWindowSettings(const KConfigGroup &config) override;
/** /**
* Returns true if the window geometry was previously saved to the * Returns true if the window geometry was previously saved to the
* config file, false otherwise. * config file, false otherwise.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment