Messagelib

scamdetectionwhitelistsettingsmanager.cpp
1/*
2 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5
6*/
7#include "scamdetectionwhitelistsettingsmanager.h"
8
9#include <KConfigGroup>
10#include <KSharedConfig>
11
12namespace
13{
14static const char myScamDetectionWhiteListGroupName[] = "ScamDetectionWhiteList";
15}
16using namespace MessageViewer;
17ScamDetectionWhiteListSettingsManager::ScamDetectionWhiteListSettingsManager(QObject *parent)
18 : QObject{parent}
19{
20 loadSettings();
21}
22
23ScamDetectionWhiteListSettingsManager::~ScamDetectionWhiteListSettingsManager()
24{
25 writeSettings();
26}
27
28ScamDetectionWhiteListSettingsManager *ScamDetectionWhiteListSettingsManager::self()
29{
30 static ScamDetectionWhiteListSettingsManager s_self;
31 return &s_self;
32}
33
34void ScamDetectionWhiteListSettingsManager::loadSettings()
35{
36 mScamDetectionInfoList.clear();
37 KSharedConfig::Ptr config = KSharedConfig::openConfig();
38 KConfigGroup group(config, QLatin1StringView(myScamDetectionWhiteListGroupName));
39 // TODO
40}
41
42void ScamDetectionWhiteListSettingsManager::writeSettings()
43{
44 KSharedConfig::Ptr config = KSharedConfig::openConfig();
45 KConfigGroup group(config, QLatin1StringView(myScamDetectionWhiteListGroupName));
46 // TODO
47}
48
49QList<ScamDetectionInfo> ScamDetectionWhiteListSettingsManager::scamDetectionInfoList() const
50{
51 return mScamDetectionInfoList;
52}
53
54void ScamDetectionWhiteListSettingsManager::setScamDetectionInfoList(const QList<ScamDetectionInfo> &newScamDetectionInfoList)
55{
56 if (mScamDetectionInfoList != newScamDetectionInfoList) {
57 mScamDetectionInfoList = newScamDetectionInfoList;
58 writeSettings();
59 }
60}
61
62#include "moc_scamdetectionwhitelistsettingsmanager.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 Mon Nov 4 2024 16:33:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.