D28580: [Kleopatra] Fix size saving/restore

David Faure noreply at phabricator.kde.org
Fri Apr 10 09:23:14 BST 2020


dfaure added inline comments.

INLINE COMMENTS

> mainwindow.cpp:706
> +    if (cfgGroup.readEntry<bool>("hidden", false)) {
> +        hide();
> +    } else {

Shorter form:

  setVisible(cfgGroup.readEntry("hidden", false));

> andreylegayev wrote in mainwindow.cpp:696
> I agree - MainWindow inherits it from KMainWindow, but it works only with KDE session management.
> Methods `readProperties()` and `saveProperties()` are called when you save session (this is how I debugged it) and when you run app with parameter `-session`
> 
> There is also builtin timer which saves window settings automatically once you resize window, but there is no code which loads saved settings.
> If you run most recent Kleopatra on your machine you'll get window size 1024x500 regardless previously saved size.
> 
> In this class I could call KMainWindow methods directly, but I wanted to have universal code snippet for all windows to save geometry on multi-dpi/-screen without annoying Qt bug. I re-used it in dialogs as you saw.
> 
> Annoying Qt bug - win10:
> I literally cannot make SignEncrypt window appear to me. 
> The only way is to delete `geometry` from kleopatrarc and restart Kleopatra.
> It so annoyed me that I configured dev environment and started all this debug :-)

The code to load autosaved settings is the end of KMainWindow::setAutoSaveSettings.
This works for all other KMainWindow-based applications, you know ;)

To enable the autosave functionality, you call setAutoSaveSettings at creation time, and it will load the previously saved settings.

readProperties and saveProperties are called from here, so obviously not just for session management purposes.

I would really like kleopatra to do like all other KMainWindow-based applications and rely on the KMainWindow code as much as possible. This makes long term maintenance easier.

I see that we're missing something similar for dialogs, which means we should have something in a KDE Frameworks about that, but for now I'm ok with your solution of duplicating a bit of code in every one of kleopatra's dialogs. For the mainwindow, though, I'd like it to do the right thing since that is available.

REPOSITORY
  R168 Kleopatra

REVISION DETAIL
  https://phabricator.kde.org/D28580

To: andreylegayev, dfaure
Cc: dfaure, mlaurent, kde-pim, andreylegayev, fbampaloukas, dcaliste, dvasin, rodsevich, ach, winterz, vkrause, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200410/8d58f348/attachment.html>


More information about the kde-pim mailing list