File indexing completed on 2025-01-05 04:49:42

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "scamconfiguresettingswidget.h"
0008 #include "scamconfiguresettingstreewidget.h"
0009 #include <KLocalizedString>
0010 #include <KSharedConfig>
0011 #include <MessageViewer/ScamDetectionWhiteListSettingsManager>
0012 #include <QHeaderView>
0013 #include <QTreeWidget>
0014 #include <QVBoxLayout>
0015 
0016 ScamConfigureSettingsWidget::ScamConfigureSettingsWidget(QWidget *parent)
0017     : QWidget{parent}
0018     , mTreeWidget(new ScamConfigureSettingsTreeWidget(this))
0019 {
0020     auto mainLayout = new QVBoxLayout(this);
0021     mainLayout->setObjectName(QLatin1StringView("mainLayout"));
0022     mainLayout->setContentsMargins({});
0023 
0024     mTreeWidget->setObjectName(QLatin1StringView("mTreeWidget"));
0025     mainLayout->addWidget(mTreeWidget);
0026     mTreeWidget->setRootIsDecorated(false);
0027     mTreeWidget->header()->setSectionsMovable(false);
0028     mTreeWidget->setHeaderLabels({i18n("Domain"), i18n("Check")});
0029 }
0030 
0031 ScamConfigureSettingsWidget::~ScamConfigureSettingsWidget() = default;
0032 
0033 void ScamConfigureSettingsWidget::loadSettings()
0034 {
0035     const QList<MessageViewer::ScamDetectionInfo> scanInfo = MessageViewer::ScamDetectionWhiteListSettingsManager::self()->scamDetectionInfoList();
0036     fillList(scanInfo);
0037 }
0038 
0039 void ScamConfigureSettingsWidget::saveSettings()
0040 {
0041     QList<MessageViewer::ScamDetectionInfo> scanInfo;
0042     // TODO
0043     MessageViewer::ScamDetectionWhiteListSettingsManager::self()->setScamDetectionInfoList(scanInfo);
0044     // TODO
0045 }
0046 
0047 void ScamConfigureSettingsWidget::fillList(const QList<MessageViewer::ScamDetectionInfo> &scanInfo)
0048 {
0049     // TODO
0050 }
0051 
0052 #include "moc_scamconfiguresettingswidget.cpp"