File indexing completed on 2025-01-26 05:06:34

0001 /*
0002     SPDX-FileCopyrightText: 2018 Roman Gilg <subdiff@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #include "libinput_settings.h"
0007 
0008 #include <KConfigGroup>
0009 #include <KSharedConfig>
0010 
0011 template<>
0012 bool LibinputSettings::load(QString key, bool defVal)
0013 {
0014     KSharedConfig::Ptr kcminputPtr = KSharedConfig::openConfig("kcminputrc");
0015     KConfigGroup group(kcminputPtr, QStringLiteral("Mouse"));
0016 
0017     return group.readEntry(key, defVal);
0018 }
0019 
0020 template<>
0021 qreal LibinputSettings::load(QString key, qreal defVal)
0022 {
0023     KSharedConfig::Ptr kcminputPtr = KSharedConfig::openConfig("kcminputrc");
0024     KConfigGroup group(kcminputPtr, QStringLiteral("Mouse"));
0025 
0026     return group.readEntry(key, defVal);
0027 }
0028 
0029 template<>
0030 void LibinputSettings::save(QString key, bool val)
0031 {
0032     KSharedConfig::Ptr kcminputPtr = KSharedConfig::openConfig("kcminputrc");
0033     KConfigGroup group(kcminputPtr, QStringLiteral("Mouse"));
0034 
0035     group.writeEntry(key, val);
0036 
0037     group.sync();
0038     kcminputPtr->sync();
0039 }
0040 
0041 template<>
0042 void LibinputSettings::save(QString key, qreal val)
0043 {
0044     KSharedConfig::Ptr kcminputPtr = KSharedConfig::openConfig("kcminputrc");
0045     KConfigGroup group(kcminputPtr, QStringLiteral("Mouse"));
0046 
0047     group.writeEntry(key, val);
0048 
0049     group.sync();
0050     kcminputPtr->sync();
0051 }