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: GPL-2.0-or-later
0005 */
0006 
0007 #include "longheaderstyleplugin.h"
0008 #include "longheaderstyleinterface.h"
0009 #include <MessageViewer/PlainHeaderStyle>
0010 
0011 #include <KPluginFactory>
0012 #include <MessageViewer/RichHeaderStrategy>
0013 
0014 using namespace MessageViewer;
0015 
0016 K_PLUGIN_CLASS_WITH_JSON(LongHeaderStylePlugin, "messageviewer_longheaderstyleplugin.json")
0017 
0018 LongHeaderStylePlugin::LongHeaderStylePlugin(QObject *parent, const QList<QVariant> &)
0019     : MessageViewer::HeaderStylePlugin(parent)
0020     , mHeaderStyle(new PlainHeaderStyle)
0021     , mHeaderStrategy(new RichHeaderStrategy)
0022 {
0023 }
0024 
0025 LongHeaderStylePlugin::~LongHeaderStylePlugin()
0026 {
0027     delete mHeaderStyle;
0028     delete mHeaderStrategy;
0029 }
0030 
0031 HeaderStyle *LongHeaderStylePlugin::headerStyle() const
0032 {
0033     return mHeaderStyle;
0034 }
0035 
0036 HeaderStrategy *LongHeaderStylePlugin::headerStrategy() const
0037 {
0038     return mHeaderStrategy;
0039 }
0040 
0041 HeaderStyleInterface *LongHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent)
0042 {
0043     MessageViewer::HeaderStyleInterface *view = new MessageViewer::LongHeaderStyleInterface(this, parent);
0044     if (ac) {
0045         view->createAction(menu, actionGroup, ac);
0046     }
0047     return view;
0048 }
0049 
0050 QString LongHeaderStylePlugin::name() const
0051 {
0052     return QStringLiteral("long-header");
0053 }
0054 
0055 #include "longheaderstyleplugin.moc"
0056 
0057 #include "moc_longheaderstyleplugin.cpp"