+ s.setValue("MainWinGeometry", saveGeometry());
+ s.setValue("MainWinMinimized", isMinimized());
+ s.setValue("MainWinMaximized", isMaximized());
+ s.setValue("MainWinHidden", !isVisible());
+
+#ifdef HAVE_KDE
+ saveAutoSaveSettings();
+#endif
+}
+
+void MainWin::restoreStateFromSettings(UiSettings &s) {
+ _normalSize = s.value("MainWinSize", size()).toSize();
+ _normalPos = s.value("MainWinPos", pos()).toPoint();
+ bool maximized = s.value("MainWinMaximized", false).toBool();
+
+#ifndef HAVE_KDE
+ restoreGeometry(s.value("MainWinGeometry").toByteArray());
+
+ if(maximized) {
+ // restoreGeometry() fails if the windows was maximized, so we resize and position explicitly
+ resize(_normalSize);
+ move(_normalPos);
+ }
+
+ restoreState(s.value("MainWinState").toByteArray());
+
+#else
+ move(_normalPos);
+#endif
+
+ if(s.value("MainWinHidden").toBool())
+ hideToTray();
+ else if(s.value("MainWinMinimized").toBool())
+ showMinimized();
+ else if(maximized)
+ showMaximized();
+ else
+ show();