Messagelib

headerstyleinterface.cpp
1 /*
2  SPDX-FileCopyrightText: 2015-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "headerstyleinterface.h"
8 #include "headerstyleplugin.h"
9 #include "utils/messageviewerutil_p.h"
10 #include <KActionMenu>
11 #include <KToggleAction>
12 #include <QAction>
13 #include <QActionGroup>
14 using namespace MessageViewer;
15 
16 HeaderStyleInterface::HeaderStyleInterface(MessageViewer::HeaderStylePlugin *headerStylePlugin, QObject *parent)
17  : QObject(parent)
18  , mHeaderStylePlugin(headerStylePlugin)
19 {
20 }
21 
22 HeaderStyleInterface::~HeaderStyleInterface() = default;
23 
24 QList<KToggleAction *> HeaderStyleInterface::action() const
25 {
26  return mAction;
27 }
28 
29 void HeaderStyleInterface::addHelpTextAction(QAction *act, const QString &text)
30 {
31  MessageViewer::Util::addHelpTextAction(act, text);
32 }
33 
34 void HeaderStyleInterface::addActionToMenu(KActionMenu *menu, QActionGroup *actionGroup)
35 {
36  for (KToggleAction *taction : std::as_const(mAction)) {
37  menu->addAction(taction);
38  actionGroup->addAction(taction);
39  }
40 }
41 
42 HeaderStylePlugin *HeaderStyleInterface::headerStylePlugin() const
43 {
44  return mHeaderStylePlugin;
45 }
46 
47 void HeaderStyleInterface::slotStyleChanged()
48 {
49  Q_EMIT styleChanged(mHeaderStylePlugin);
50 }
51 
52 #include "moc_headerstyleinterface.cpp"
void addAction(QAction *action)
Q_EMITQ_EMIT
The HeaderStylePlugin class.
QAction * addAction(QAction *action)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 30 2023 03:53:39 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.