┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/dolphin_update_splitviewsettings.cpp
blob: 5ba905442cb2d7f0a0bd4d535e95a72156779972 (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
#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;
}