The key format is changing in
https://invent.kde.org/frameworks/kconfig/-/merge_requests/184; take
that into account here.
Currently this function copies code from KWindowConfig, which is not
ideal; a more robust solution would be to expose the config file key
value publicly using a function in KWindowConfig that Konsole can call.
That's KF6 material, though, so for now, let's fix this issue by simply
supporting the new key format as well as the old one.
MainWindow::wasWindowGeometrySaved() doesn't take into account the currently connected outputs. So
when Konsole starts after hotplugging a new output, wasWindowGeometrySaved() will erroneously return
true and resize(sizeHint()) in MainWindow::showEvent() won't be called thus resulting in Konsole
starting with wrong size.
This change makes Konsole take the current output layout into account when deciding whether the
geometry has been restored (logic was copied from KWindowConfig), however it indicates that we have
some fundamental issues in KMainWindow or KWindowConfig as it's a really messy way to determine
whether the previous state has been properly restored.
BUG: 460428
Using "Yes" & "No" text labels on dialog buttons is discouraged by not
only the KDE HIG these days. Yet the legacy API of KMessageBox was
using Yes & No as terms in its API, conflicting with what the HIG
recommends and trapping HIG-unaware developers into thinking to use
Yes & No buttons.
New substitute API uses the term "action" instead, matching the concept
proposed by the KDE HIG.
GIT_SILENT
To support focusing a session from a notification in Wayland, we need to
use the XdgActivation protocol. This is done by passing to
KWindowSystem an XDG activation token that we get from the notification.
Adds a "Show session" button to notifications, which, when clicked, will
focus the originating session.
Original patch by Kasper Laudrup at bug 305162, then updated by Martin
T. H. Sandsmark.
Now updated and extended to silence/activity/process termination
notifications, adding support for focusing a TerminalDisplay inside a
hierarchy of ViewSplitters inside a TabbedViewContainer, and using
KWindowSystem::forceActiveWindow() instead of ::activateWindow().
BUG: 305162
BUG: 344208
This change removes some application attributes that are not necessary anymore (like disabling the global menu bar) or make Konsole behave slightly different when used from a KPart (e.g. inside Kate), and changes some keyboard shortcuts around (mainly using Command instead of Ctrl+Shift now.)
Unfortunately this does not resolve the requirement for the special keytab file for macOS; it looks like Qt does something funny with the QKeyEvents here: on Linux these have a `text` attribute set to e.g. `\u0003` for `^C`, that attribute is empty on macOS.
Note this could impact shortcut changes on non-macOS systems.
- Call ProfileSettings::slotAccepted() when the parent ConfigurationDialog
is accepted, so that ProfileManager::saveSettings() is called
- don't delete the ProfileSettings dialog on accept, it'll be destroyed when
the parent ConfigurationDialog is destroyed
- save the profiles' shorcuts if they were actually changed
With this commit and the previous one, there is no need for ~Part() or
~Application() to call saveSettings(), shorcuts settings are saved when
the ProfileSettings dialog is accepted and saving the default profile is
done in setDefaultProfile(). This fixes an issue where changing e.g. the
default profile is only saved to the konsolerc file when the main window is
closed.
- refactor the code
- remove redundant includes
- change the string used in the GUI to "window color scheme", to differentiate
between it and the terminal color schemes
Add AppColorSchemeChooser class which use KColorSchemeManager to change
konsole color scheme. Inspired by KateColorSchemeChooser wrote by
Zhigalin Alexander <alexander@zhigalin.tk>.
The Qt::WA_NativeWindow attribute is need so that windowHandle() doesn't
return 0, since windowHandle() is used in two places now in the code, just
always set it.
When rememberWindowSize() is false, override the Window-Maximized config
key, which maximizes the window initially.
To test:
- unset "remember window size"
- close the window and make sure the config has been saved to konsolerc
- open konsole, keep the window unmaximized, close, open -> size is restored
- open konsole, maximize the window, close, open, the window is maximized
even when rememberWindowSize() is false
Currently there are two options to control menubar visibility: the first in the menu and the second in the preferences dialog, moreover the second option makes the changes persistent. This MR removes the second option (from the preferences dialog) and makes the first option (from the menu) make the changes persistent.
BUG: 440328
This includes the toolbar/menubar/dockwidget states (i.e. the State= config
key), and the window geometry. I was wrong to think the State= key included
the window geometry.
Depending on the "remeber window size" setting, we can apply the size saved
in the config file or the size from the profile settings (lines x columns),
which is included in MainWindow::sizeHint().
BUG: 442252
FIXED-IN: 21.12
Sub-menu will always be displayed in "File>New Tab" and "New Tab" button,
even if there is only one profile to display (the built-in default).
This fixes not being able to create a new tab from "File>New Tab" menu and
long-pressing on the new tab toolbar button.
BUG: 436264
It looks like switching virtual desktops in OpenBox invokes a show event
(this doesn't happen while running Plasma).
The code in MainWindow::showEvent() should only be run once on first show,
so guard it with a bool member.
BUG: 441610
FIXED-IN: 21.08.1
There are two scenarios when closing a window:
A) clicking the close button on the title bar (or Ctrl+Shift+Q):
~MainWindow()
~ViewManager()
~TabbedViewContainer()
~TerminalDisplay()
~Session()
B) closing the last session/tab in a window:
SessionController::sessionFinished()
~Session()
~TerminalDisplay()
~TabbedViewContainer()
~MainWindow()
~ViewManager()
the issue with the second case is that the TerminalDisplay is torn down
first, which exposes the TabbedViewContainer widget, the latter has the same
Qt::Window colour as the system colour scheme window background colour, if
you're using a dark terminal colour scheme and a light-coloured system colour
scheme, you could see some "flashing" when you close the last session with
e.g. Ctrl+D.
To fix this, in sessionFinished() check if TabbedViewContainer::count() is
1 (i.e. closing last tab/session), and emit the empty() signal in that case,
which is connected to MainwWindow::close(), then the order of tear down
becomes:
SessionController::sessionFinished()
~Session()
~MainWindow()
~ViewManager()
~TabbedViewContainer()
~TerminalDisplay()
BUG: 432077
FIXED-IN: 21.12
The very first time a user runs Konsole, where is no konsolerc file in $HOME,
there is no saved size to restore, instead use the sizeHint(), which ideally
will be the size set in the default profile (based on lines/columns setting).
CCBUG: 437791
Call setupGUI(), which will call createGUI (since we set the
KXmlGuiWindow::Create flag), omit the StatusBar flag since we don't have a
statusbar and don't want the "Show StatusBar" menu action.
TabbedViewContainer::sizeHint() calculates an optimum size for itself,
including the sizes of its child widgets; added in efb621d091 by
Mariusz Glebocki; following the code:
MainWindow creates a ViewManager
ViewManager creates a TabbedViewContainer and then a TerminalDisplay
which means that the first time TabbedViewContainer::sizeHint() is called
the TerminalDisplay widget size is 0, then TabbedViewContainer::sizeHint()
would return 0.
Which is why calling resize() in MainWindow was delayed to the showEvent(),
(and even delayed more by a QTimer::singleShot() call in Application),
at which point all the child widgets have been created and
MainWindow::sizeHint() (which logically takes into account the sizeHint()
of its child widgets) would return a sensible size.
CCBUG: 430036
CCBUG: 439339
BUG: 436471
Basically to use QWidget::windowHandle() to get a QWindow*, we need to first
set the Qt::WA_NativeWindow attribute on the QWidget. See:
https://phabricator.kde.org/D23108
BUG: 439871
FIXED-IN: 21.12
This commit introduces a plugins sytem for konsole, so we can
extend the application without touching the core. Currently
there's a testcase plugin (in the next commit) that handles
ssh connections and will serve as a base introduction on how
to write plugins for konsole.
Things we need to keep in mind when developing a plugin for
konsole:
- We can have more than a mainwindow, so if the plugin creates
widgets, it needs to create the widget per window
- We can have multiple tabs / multiple TerminalDisplays so always
check what terminal display you are triggering the action (using
activeTerminalDisplay())
From the mainWindow you can get the activeTerminalDisplay, from
the terminalDisplay you can get the Session, the VT102Emulation and
the Screen.
Then you can go crazy.
We only need to set the favourite emblem for the default profile icon, for
other profiles, the profile icon is already set on the menu action.
Rename a lambda to a more meaningful name.
BUG: 437200
FIXED-IN: 21.08
When you open settings and close it, than open a new window, than
close the old window, the MainWindow with the settings will
delete the configDialog. If you try to open settings againg it crashes.
Fix is each MainWindow now has its own configDialog.
BUG: 436366
Now the 'File->New Tab' menu is updated when the default profile is
changed, i.e. the action font is made bold and the favourites icon
emblem is added to the profile icon.
A call to menu()->setDefaultAction() has been removed, as I don't see
what it serves exactly in the current code.
Reported by khindenburg in:
https://invent.kde.org/utilities/konsole/-/merge_requests/351
When this feature is turned off, it deletes some keys from Konsole's
config file. However this broke recently for two reasons:
1. The key names changed a few Frameworks releases ago
2. There are new keys that need to be deleted or else position gets
restored too
This commit fixes that bug by updating the condition to delete all the
config keys required to make the off state for this feature work again.
BUG: 427610
FIXED-IN: 20.12.2
(cherry picked from commit 8fa1c4b508)