File indexing completed on 2025-03-09 04:54:38
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 */ 0007 #include "scamdetectionwhitelistsettingsmanager.h" 0008 0009 #include <KConfigGroup> 0010 #include <KSharedConfig> 0011 0012 namespace 0013 { 0014 static const char myScamDetectionWhiteListGroupName[] = "ScamDetectionWhiteList"; 0015 } 0016 using namespace MessageViewer; 0017 ScamDetectionWhiteListSettingsManager::ScamDetectionWhiteListSettingsManager(QObject *parent) 0018 : QObject{parent} 0019 { 0020 loadSettings(); 0021 } 0022 0023 ScamDetectionWhiteListSettingsManager::~ScamDetectionWhiteListSettingsManager() 0024 { 0025 writeSettings(); 0026 } 0027 0028 ScamDetectionWhiteListSettingsManager *ScamDetectionWhiteListSettingsManager::self() 0029 { 0030 static ScamDetectionWhiteListSettingsManager s_self; 0031 return &s_self; 0032 } 0033 0034 void ScamDetectionWhiteListSettingsManager::loadSettings() 0035 { 0036 mScamDetectionInfoList.clear(); 0037 KSharedConfig::Ptr config = KSharedConfig::openConfig(); 0038 KConfigGroup group(config, QLatin1StringView(myScamDetectionWhiteListGroupName)); 0039 // TODO 0040 } 0041 0042 void ScamDetectionWhiteListSettingsManager::writeSettings() 0043 { 0044 KSharedConfig::Ptr config = KSharedConfig::openConfig(); 0045 KConfigGroup group(config, QLatin1StringView(myScamDetectionWhiteListGroupName)); 0046 // TODO 0047 } 0048 0049 QList<ScamDetectionInfo> ScamDetectionWhiteListSettingsManager::scamDetectionInfoList() const 0050 { 0051 return mScamDetectionInfoList; 0052 } 0053 0054 void ScamDetectionWhiteListSettingsManager::setScamDetectionInfoList(const QList<ScamDetectionInfo> &newScamDetectionInfoList) 0055 { 0056 if (mScamDetectionInfoList != newScamDetectionInfoList) { 0057 mScamDetectionInfoList = newScamDetectionInfoList; 0058 writeSettings(); 0059 } 0060 } 0061 0062 #include "moc_scamdetectionwhitelistsettingsmanager.cpp"