Messagelib

dkimmanagerauthenticationserver.cpp
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "dkimmanagerauthenticationserver.h"
8#include "dkimutil.h"
9#include <KConfigGroup>
10#include <KSharedConfig>
11
12using namespace MessageViewer;
13namespace
14{
15static const char myDKIMManagerAuthenticationServerConfigGroupName[] = "AuthenticationServer";
16}
17DKIMManagerAuthenticationServer::DKIMManagerAuthenticationServer(QObject *parent)
18 : QObject(parent)
19{
20}
21
22DKIMManagerAuthenticationServer::~DKIMManagerAuthenticationServer()
23{
24 save();
25}
26
27DKIMManagerAuthenticationServer *DKIMManagerAuthenticationServer::self()
28{
30 return &s_self;
31}
32
33QStringList DKIMManagerAuthenticationServer::serverList() const
34{
35 return mServerList;
36}
37
38void DKIMManagerAuthenticationServer::setServerList(const QStringList &serverList)
39{
40 mServerList = serverList;
41}
42
43void DKIMManagerAuthenticationServer::load()
44{
45 const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals);
46 KConfigGroup grp(config, QLatin1StringView(myDKIMManagerAuthenticationServerConfigGroupName));
47 mServerList = grp.readEntry("ServerList", QStringList());
48}
49
50void DKIMManagerAuthenticationServer::save()
51{
52 const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals);
53 KConfigGroup grp(config, QLatin1StringView(myDKIMManagerAuthenticationServerConfigGroupName));
54 grp.writeEntry("ServerList", mServerList);
55}
56
57#include "moc_dkimmanagerauthenticationserver.cpp"
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 11:58:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.