[kmail2] [Bug 484327] Bad initial window sizes
Jonathan Marten
bugzilla_noreply at kde.org
Sat Sep 14 08:54:47 BST 2024
https://bugs.kde.org/show_bug.cgi?id=484327
--- Comment #11 from Jonathan Marten <jjm at keelhaul.me.uk> ---
Restoring the window positions, even on X11 where it is supported, may not work
because of a combination of intended KMail design and KXmlGui. KMainWindow
saves the window position along with the size as intended, but restoring the
size in KMainWindow::applyMainWindowSettings() looks at a saved setting
"RestorePositionForNextInstance" in the application state config. If this flag
is set to false then the window size is not restored. If it is true, then the
window position is restored and then the flag is reset to false so that the
next instance of the window does not open in exactly the same place.
When the window is closed, the flag is reset to true by
KMainWindow::closeEvent() so that the next window opened will again have its
position restored.
The problem in KMail is that a KMail::SecondaryWindow, which the composer and
reader are subclasses of, implements its own closeEvent() to handle the system
tray persistence. If the system tray icon is present, this does not call
KMainWindow::closeEvent() so the flag is not reset to false and the window
positions will never be restored from then on.
You can confirm this by looking at the [Composer] section in
~/.local/state/kmail2staterc and it will probably have a setting
"RestorePositionForNextInstance=false". If you quit KMail, remove this setting
and restart KMail, it will restore the position of the next composer window
that is opened, but subsequent ones will again open with the default window
manager placement.
It may be possible to work around this by copying the KMailWindow::closeEvent()
code, by doing:
KConfigGroup grp = stateConfigGroup();
if (grp.isValid()) grp.deleteEntry("RestorePositionForNextInstance");
immediately before the saveAutoSaveSettings() in SecondaryWindow::closeEvent().
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Kdepim-bugs
mailing list