| 1 |
// SPDX-License-Identifier: GPL-2.0-or-later |
| 2 |
// SPDX-FileCopyrightText: %{CURRENT_YEAR} %{AUTHOR} <%{EMAIL}> |
| 3 |
|
| 4 |
#include "app.h" |
| 5 |
#include <KSharedConfig> |
| 6 |
#include <KWindowConfig> |
| 7 |
#include <QQuickWindow> |
| 8 |
|
| 9 |
void App::restoreWindowGeometry(QQuickWindow *window, const QString &group) const |
| 10 |
{ |
| 11 |
KConfig dataResource(QStringLiteral("data"), KConfig::SimpleConfig, QStandardPaths::AppDataLocation); |
| 12 |
KConfigGroup windowGroup(&dataResource, QStringLiteral("Window-") + group); |
| 13 |
KWindowConfig::restoreWindowSize(window, windowGroup); |
| 14 |
KWindowConfig::restoreWindowPosition(window, windowGroup); |
| 15 |
} |
| 16 |
|
| 17 |
void App::saveWindowGeometry(QQuickWindow *window, const QString &group) const |
| 18 |
{ |
| 19 |
KConfig dataResource(QStringLiteral("data"), KConfig::SimpleConfig, QStandardPaths::AppDataLocation); |
| 20 |
KConfigGroup windowGroup(&dataResource, QStringLiteral("Window-") + group); |
| 21 |
KWindowConfig::saveWindowPosition(window, windowGroup); |
| 22 |
KWindowConfig::saveWindowSize(window, windowGroup); |
| 23 |
dataResource.sync(); |
| 24 |
} |
| 25 |
|
| 26 |
#include "moc_app.cpp" |