Messagelib

dkimmanagerauthenticationserver.cpp
1 /*
2  SPDX-FileCopyrightText: 2019-2021 Laurent Montel <[email protected]>
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 
12 using namespace MessageViewer;
13 namespace
14 {
15 static const char myDKIMManagerAuthenticationServerConfigGroupName[] = "AuthenticationServer";
16 }
17 DKIMManagerAuthenticationServer::DKIMManagerAuthenticationServer(QObject *parent)
18  : QObject(parent)
19 {
20 }
21 
22 DKIMManagerAuthenticationServer::~DKIMManagerAuthenticationServer()
23 {
24  save();
25 }
26 
27 DKIMManagerAuthenticationServer *DKIMManagerAuthenticationServer::self()
28 {
29  static DKIMManagerAuthenticationServer s_self;
30  return &s_self;
31 }
32 
33 QStringList DKIMManagerAuthenticationServer::serverList() const
34 {
35  return mServerList;
36 }
37 
38 void DKIMManagerAuthenticationServer::setServerList(const QStringList &serverList)
39 {
40  mServerList = serverList;
41 }
42 
43 void DKIMManagerAuthenticationServer::load()
44 {
45  const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals);
46  KConfigGroup grp(config, myDKIMManagerAuthenticationServerConfigGroupName);
47  mServerList = grp.readEntry("ServerList", QStringList());
48 }
49 
50 void DKIMManagerAuthenticationServer::save()
51 {
52  const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals);
53  KConfigGroup grp(config, myDKIMManagerAuthenticationServerConfigGroupName);
54  grp.writeEntry("ServerList", mServerList);
55 }
The DKIMManagerAuthenticationServer class.
KSharedConfigPtr config()
const QList< QKeySequence > & save()
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-2021 The KDE developers.
Generated on Thu Dec 2 2021 23:06:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.