File indexing completed on 2024-09-08 13:03:43
0001 // SPDX-License-Identifier: GPL-2.0-or-later 0002 // SPDX-FileCopyrightText: 2022 Louis Schul <schul9louis@gmail.com> 0003 0004 #include "app.h" 0005 #include <KSharedConfig> 0006 #include <KWindowConfig> 0007 #include <QQuickWindow> 0008 0009 void App::restoreWindowGeometry(QQuickWindow *window, const QString &group) const 0010 { 0011 KConfig dataResource(QStringLiteral("data"), KConfig::SimpleConfig, QStandardPaths::AppDataLocation); 0012 KConfigGroup windowGroup(&dataResource, QStringLiteral("Window-") + group); 0013 KWindowConfig::restoreWindowSize(window, windowGroup); 0014 KWindowConfig::restoreWindowPosition(window, windowGroup); 0015 } 0016 0017 void App::saveWindowGeometry(QQuickWindow *window, const QString &group) const 0018 { 0019 KConfig dataResource(QStringLiteral("data"), KConfig::SimpleConfig, QStandardPaths::AppDataLocation); 0020 KConfigGroup windowGroup(&dataResource, QStringLiteral("Window-") + group); 0021 KWindowConfig::saveWindowPosition(window, windowGroup); 0022 KWindowConfig::saveWindowSize(window, windowGroup); 0023 dataResource.sync(); 0024 }