File indexing completed on 2025-03-09 04:54:29
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "dkimmanagerauthenticationserver.h" 0008 #include "dkimutil.h" 0009 #include <KConfigGroup> 0010 #include <KSharedConfig> 0011 0012 using namespace MessageViewer; 0013 namespace 0014 { 0015 static const char myDKIMManagerAuthenticationServerConfigGroupName[] = "AuthenticationServer"; 0016 } 0017 DKIMManagerAuthenticationServer::DKIMManagerAuthenticationServer(QObject *parent) 0018 : QObject(parent) 0019 { 0020 } 0021 0022 DKIMManagerAuthenticationServer::~DKIMManagerAuthenticationServer() 0023 { 0024 save(); 0025 } 0026 0027 DKIMManagerAuthenticationServer *DKIMManagerAuthenticationServer::self() 0028 { 0029 static DKIMManagerAuthenticationServer s_self; 0030 return &s_self; 0031 } 0032 0033 QStringList DKIMManagerAuthenticationServer::serverList() const 0034 { 0035 return mServerList; 0036 } 0037 0038 void DKIMManagerAuthenticationServer::setServerList(const QStringList &serverList) 0039 { 0040 mServerList = serverList; 0041 } 0042 0043 void DKIMManagerAuthenticationServer::load() 0044 { 0045 const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals); 0046 KConfigGroup grp(config, QLatin1StringView(myDKIMManagerAuthenticationServerConfigGroupName)); 0047 mServerList = grp.readEntry("ServerList", QStringList()); 0048 } 0049 0050 void DKIMManagerAuthenticationServer::save() 0051 { 0052 const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals); 0053 KConfigGroup grp(config, QLatin1StringView(myDKIMManagerAuthenticationServerConfigGroupName)); 0054 grp.writeEntry("ServerList", mServerList); 0055 } 0056 0057 #include "moc_dkimmanagerauthenticationserver.cpp"