Page MenuHomePhorge

kazv-config.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

kazv-config.cpp

/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "kazv-config.hpp"
#include <KSharedConfig>
#include <KConfigGroup>
struct KazvConfigPrivate
{
KSharedConfigPtr sessionrc{KSharedConfig::openConfig("kazvsessionrc")};
KConfigGroup sessionGroup{sessionrc, "Sessions"};
KSharedConfigPtr shortcutsrc{KSharedConfig::openConfig("kazv/shortcutsrc")};
KConfigGroup shortcutsGroup{shortcutsrc, "Shortcuts"};
KSharedConfigPtr cacheDirectoryrc{KSharedConfig::openConfig("kazv/cacheDirectoryrc")};
KConfigGroup cacheDirectoryGroup{cacheDirectoryrc, "CacheDirectory"};
};
KazvConfig::KazvConfig(QObject *parent)
: QObject(parent)
, m_d(new KazvConfigPrivate)
{
}
KazvConfig::~KazvConfig() = default;
QString KazvConfig::lastSession() const
{
return m_d->sessionGroup.readEntry("lastSession", QString());
}
void KazvConfig::setLastSession(QString session)
{
m_d->sessionGroup.writeEntry("lastSession", session);
}
QStringList KazvConfig::shortcutForAction(QString actionName) const
{
return m_d->shortcutsGroup.readEntry(actionName, QStringList());
}
void KazvConfig::setShortcutForAction(QString actionName, QStringList shortcut)
{
m_d->shortcutsGroup.writeEntry(actionName, shortcut);
}
QString KazvConfig::cacheDirectory() const
{
return m_d->cacheDirectoryGroup.readEntry("cacheDirectory", QString());
}
void KazvConfig::setCacheDirectory(QString cacheDirectory)
{
m_d->cacheDirectoryGroup.writeEntry("cacheDirectory", cacheDirectory);
}

File Metadata

Mime Type
text/x-c
Expires
Sun, Dec 1, 9:12 PM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41845
Default Alt Text
kazv-config.cpp (1 KB)

Event Timeline