KNotifyConfig

knotifyconfigelement.cpp
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2005-2006 Olivier Goffart <ogoffart at kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#include "knotifyconfigelement.h"
9
10#include <KConfig>
11#include <KConfigGroup>
12
13KNotifyConfigElement::KNotifyConfigElement(const QString &eventid, KConfig *config)
14 : m_config(new KConfigGroup(config, QStringLiteral("Event/") + eventid))
15 , m_eventId(eventid)
16{
17}
18
19KNotifyConfigElement::~KNotifyConfigElement()
20{
21 delete m_config;
22}
23
24QString KNotifyConfigElement::readEntry(const QString &entry, bool path)
25{
26 if (m_cache.contains(entry)) {
27 return m_cache[entry];
28 }
29 return path ? m_config->readPathEntry(entry, QString()) : m_config->readEntry(entry, QString());
30}
31
32void KNotifyConfigElement::writeEntry(const QString &entry, const QString &data)
33{
34 m_cache[entry] = data;
35}
36
37QString KNotifyConfigElement::eventId() const
38{
39 return m_eventId;
40}
41
42void KNotifyConfigElement::save()
43{
45 for (; it != m_cache.constEnd(); ++it) {
46 m_config->writeEntry(it.key(), it.value());
47 }
48}
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readPathEntry(const char *key, const QString &aDefault) const
QString readEntry(const char *key, const char *aDefault=nullptr) const
QString path(const QString &relativePath)
const_iterator constBegin() const const
const_iterator constEnd() const const
bool contains(const Key &key) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.