Messagelib

headerstyleinterface.cpp
1 /*
2  SPDX-FileCopyrightText: 2015-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "headerstyleinterface.h"
8 #include "headerstyle.h"
9 #include "headerstyleplugin.h"
10 #include "utils/messageviewerutil_p.h"
11 #include <KActionMenu>
12 #include <KToggleAction>
13 #include <QAction>
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 }
void addAction(QAction *action)
QAction * addAction(QAction *action)
The HeaderStylePlugin class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:05:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.