File indexing completed on 2025-01-19 04:46:44

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "antispamplugininterface.h"
0008 #include "../common/antispamwizard.h"
0009 #include <KActionCollection>
0010 #include <KLocalizedString>
0011 #include <QAction>
0012 
0013 AntiSpamPluginInterface::AntiSpamPluginInterface(QObject *parent)
0014     : PimCommon::GenericPluginInterface(parent)
0015 {
0016 }
0017 
0018 AntiSpamPluginInterface::~AntiSpamPluginInterface() = default;
0019 
0020 void AntiSpamPluginInterface::createAction(KActionCollection *ac)
0021 {
0022     auto action = new QAction(i18n("&Anti-Spam Wizard..."), this);
0023     ac->addAction(QStringLiteral("antiSpamWizard"), action);
0024     connect(action, &QAction::triggered, this, &AntiSpamPluginInterface::slotActivated);
0025     PimCommon::ActionType type(action, PimCommon::ActionType::Tools);
0026     addActionType(type);
0027 }
0028 
0029 void AntiSpamPluginInterface::slotActivated()
0030 {
0031     Q_EMIT emitPluginActivated(this);
0032 }
0033 
0034 void AntiSpamPluginInterface::exec()
0035 {
0036     KMail::AntiSpamWizard wiz(KMail::AntiSpamWizard::AntiSpam, parentWidget());
0037     wiz.exec();
0038 }