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

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "standardsheaderstyleplugin.h"
0008 #include "standardheaderstrategy.h"
0009 #include "standardsheaderstyleinterface.h"
0010 #include <KPluginFactory>
0011 #include <MessageViewer/PlainHeaderStyle>
0012 
0013 using namespace MessageViewer;
0014 
0015 K_PLUGIN_CLASS_WITH_JSON(StandardsHeaderStylePlugin, "messageviewer_standardsheaderstyleplugin.json")
0016 
0017 StandardsHeaderStylePlugin::StandardsHeaderStylePlugin(QObject *parent, const QList<QVariant> &)
0018     : MessageViewer::HeaderStylePlugin(parent)
0019     , mHeaderStyle(new PlainHeaderStyle)
0020     , mHeaderStrategy(new StandardHeaderStrategy)
0021 {
0022 }
0023 
0024 StandardsHeaderStylePlugin::~StandardsHeaderStylePlugin()
0025 {
0026     delete mHeaderStyle;
0027     delete mHeaderStrategy;
0028 }
0029 
0030 HeaderStyle *StandardsHeaderStylePlugin::headerStyle() const
0031 {
0032     return mHeaderStyle;
0033 }
0034 
0035 HeaderStrategy *StandardsHeaderStylePlugin::headerStrategy() const
0036 {
0037     return mHeaderStrategy;
0038 }
0039 
0040 HeaderStyleInterface *StandardsHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent)
0041 {
0042     MessageViewer::HeaderStyleInterface *view = new MessageViewer::StandardsHeaderStyleInterface(this, parent);
0043     if (ac) {
0044         view->createAction(menu, actionGroup, ac);
0045     }
0046     return view;
0047 }
0048 
0049 QString StandardsHeaderStylePlugin::name() const
0050 {
0051     return QStringLiteral("standards-header");
0052 }
0053 
0054 #include "standardsheaderstyleplugin.moc"
0055 
0056 #include "moc_standardsheaderstyleplugin.cpp"