session window restore

René J.V. Bertin rjvbertin at gmail.com
Wed Sep 21 19:40:27 UTC 2016


On Tuesday September 20 2016 20:42:27 René J.V. Bertin wrote:

> >Patches welcome.
> 
> OK, which of the above methods is most appropriate (if any), and from what class would they be called best?

I've started nosing around, and noticed this in Sublime::MainWindow::loadSettings():
```
    if (cg.hasKey("State")) {
        QByteArray state;
        state = cg.readEntry("State", state);
        state = QByteArray::fromBase64(state);
        // One day will need to load the version number, but for now, assume 0
        restoreState(state);
    } else {
        // If there's no state we use a default size of 870x650
        // Resize only when showing "code" area. If we do that for other areas,
        // then we'll hit bug https://bugs.kde.org/show_bug.cgi?id=207990
        // TODO: adymo: this is more like a hack, we need a proper first-start initialization
        if (area() && area()->objectName() == QLatin1String("code"))
            resize(870,650);
    }
```

And this in Sublime:MainWindow::saveSettings():
```
    KConfigGroup cg = KSharedConfig::openConfig()->group(group);
    /* This will try to save window size, too.  But it's OK, since we
       won't use this information when loading.  */
    saveMainWindowSettings(cg);
```

But it looks like this is not actually used for the toplevel/parent window but for the various areas instead?

R.


More information about the KDevelop-devel mailing list