diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 08ce2240..3b5a3757 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -66,7 +66,6 @@ MainWindow::MainWindow() , _toggleMenuBarAction(nullptr) , _newTabMenuAction(nullptr) , _pluggedController(nullptr) - , _menuBarInitialVisibility(true) { updateUseTransparency(); @@ -114,15 +113,6 @@ MainWindow::MainWindow() KCrash::initialize(); } -void MainWindow::applyMainWindowSettings(const KConfigGroup &config) -{ - KMainWindow::applyMainWindowSettings(config); - - // Override the menubar state from the config file - menuBar()->setVisible(_menuBarInitialVisibility); - _toggleMenuBarAction->setChecked(_menuBarInitialVisibility); -} - bool MainWindow::wasWindowGeometrySaved() const { KSharedConfigPtr konsoleConfig = KSharedConfig::openConfig(QStringLiteral("konsolerc")); @@ -783,7 +773,6 @@ void MainWindow::showSettingsDialog(const bool showProfilePage) void MainWindow::applyKonsoleSettings() { - setMenuBarInitialVisibility(KonsoleSettings::showMenuBarByDefault()); setRemoveWindowTitleBarAndFrame(KonsoleSettings::removeWindowTitleBarAndFrame()); if (KonsoleSettings::allowMenuAccelerators()) { restoreMenuAccelerators(); @@ -854,9 +843,10 @@ void MainWindow::setBlur(bool blur) } } -void MainWindow::setMenuBarInitialVisibility(bool visible) +void MainWindow::setMenuBarInitialVisibility(bool showMenuBar) { - _menuBarInitialVisibility = visible; + _windowArgsMenuBarVisible.enabled = true; + _windowArgsMenuBarVisible.showMenuBar = showMenuBar; } void MainWindow::setRemoveWindowTitleBarAndFrame(bool frameless) @@ -890,6 +880,17 @@ void MainWindow::showEvent(QShowEvent *event) if (_firstShowEvent) { _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()) { // Delay resizing to here, so that the other parts of the UI // (ViewManager, TabbedViewContainer, TerminalDisplay ... etc) diff --git a/src/MainWindow.h b/src/MainWindow.h index c738b460..f292ee6c 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -88,7 +88,7 @@ public: /** * Set the initial visibility of the menubar. */ - void setMenuBarInitialVisibility(bool visible); + void setMenuBarInitialVisibility(bool showMenuBar); /** * @brief Set the frameless state @@ -172,8 +172,6 @@ public Q_SLOTS: void viewFullScreen(bool fullScreen); private: - void applyMainWindowSettings(const KConfigGroup &config) override; - /** * Returns true if the window geometry was previously saved to the * config file, false otherwise. @@ -205,9 +203,13 @@ private: QPointer _pluggedController; QList _plugins; - bool _menuBarInitialVisibility; - bool _firstShowEvent = true; bool _blurEnabled = false; + bool _firstShowEvent = true; + + struct { + bool enabled = false; // indicates that we got a command line argument for menubar + bool showMenuBar = true; + } _windowArgsMenuBarVisible; }; } diff --git a/src/settings/GeneralSettings.cpp b/src/settings/GeneralSettings.cpp index 6da27d38..fa76226e 100644 --- a/src/settings/GeneralSettings.cpp +++ b/src/settings/GeneralSettings.cpp @@ -17,8 +17,6 @@ GeneralSettings::GeneralSettings(QWidget *aParent) setupUi(this); connect(enableAllMessagesButton, &QPushButton::clicked, this, &Konsole::GeneralSettings::slotEnableAllMessages); - - kcfg_ShowTerminalSizeHint->setVisible(false); } GeneralSettings::~GeneralSettings() = default; diff --git a/src/settings/GeneralSettings.ui b/src/settings/GeneralSettings.ui index e7c34ba7..1e7bfa51 100644 --- a/src/settings/GeneralSettings.ui +++ b/src/settings/GeneralSettings.ui @@ -6,8 +6,8 @@ 0 0 - 385 - 384 + 654 + 483 @@ -49,23 +49,14 @@ 6 - - - - - 0 - 0 - - - - Sets whether search should start from the bottom - + + - Search backwards + Search: - + @@ -78,8 +69,8 @@ - - + + 0 @@ -87,15 +78,15 @@ - Sets whether the search is case sensitive + If enabled, profile settings will be ignored - Case sensitive + Remember window size - - + + 0 @@ -103,28 +94,19 @@ - Show menubar + Show window title on the titlebar - - - - - 0 - 0 - - - - If enabled, profile settings will be ignored - + + - Remember window size + Focus terminals when the mouse pointer is moved over them - - + + 0 @@ -132,11 +114,11 @@ - Show window title on the titlebar + Match using regular expressions - + @@ -152,21 +134,7 @@ - - - - Remove window titlebar and frame - - - - - - - Focus terminals when the mouse pointer is moved over them - - - - + @@ -179,34 +147,46 @@ - - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 16 + + + + + + 0 0 - - Show hint for terminal size after resizing + + Sets whether the search is case sensitive - - - - - Notifications: + Case sensitive - - + + - Search: + Remove window titlebar and frame - + Qt::Vertical @@ -222,7 +202,24 @@ - + + + + Process and window: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Notifications: + + + + 0 @@ -258,45 +255,22 @@ - - - - Process and window: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + 0 0 + + Sets whether search should start from the bottom + - Match using regular expressions + Search backwards - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 16 - - - - diff --git a/src/settings/konsole.kcfg b/src/settings/konsole.kcfg index 3fc787f4..24a02ade 100644 --- a/src/settings/konsole.kcfg +++ b/src/settings/konsole.kcfg @@ -5,11 +5,6 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - - - Show menubar by default in each Konsole window - true - false @@ -28,11 +23,6 @@ Allow users to access top menu through Alt+Key combination false - - - Show terminal size in columns and lines in the center of window after resizing - true - The window size will be saved upon exiting Konsole