┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/dolphin_update_splitviewsettings.cpp
blob: f208d3d2f89c490e7e93c56520c25e98babb0742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-FileCopyrightText: 2025 Rafał Lichwała <[email protected]>
//
// SPDX-License-Identifier: GPL-2.0-or-later

#include <KConfigGroup>
#include <KSharedConfig>

int main()
{
    const auto closeActiveSplitView = QStringLiteral("CloseActiveSplitView");
    const auto closeSplitViewChoice = QStringLiteral("CloseSplitViewChoice");
    auto config = KSharedConfig::openConfig(QStringLiteral("dolphinrc"));

    KConfigGroup general = config->group(QStringLiteral("General"));
    if (!general.hasKey(closeActiveSplitView)) {
        return EXIT_SUCCESS;
    }

    const auto value = general.readEntry(closeActiveSplitView);
    if (value == QStringLiteral("true")) {
        general.deleteEntry(closeActiveSplitView);
        general.writeEntry(closeSplitViewChoice, QStringLiteral("ActiveView"));
    } else if (value == QStringLiteral("false")) {
        general.deleteEntry(closeActiveSplitView);
        general.writeEntry(closeSplitViewChoice, QStringLiteral("InactiveView"));
    }

    return general.sync() ? EXIT_SUCCESS : EXIT_FAILURE;
}