Messagelib

templatesinsertcommandaction.cpp
1/*
2 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "templatesinsertcommandaction.h"
8
9#include <QMenu>
10
11using namespace TemplateParser;
12
13TemplatesInsertCommandAction::TemplatesInsertCommandAction(QObject *parent)
14 : QWidgetAction(parent)
15 , mMenuCommand(new TemplatesCommandMenu(this))
16{
17 mMenuCommand->fillMenu();
18 mMenuCommand->fillSubMenus();
19 mMenuCommand->setObjectName(QLatin1StringView("templatescommandmenu"));
20 connect(mMenuCommand, qOverload<const QString &, int>(&TemplatesCommandMenu::insertCommand), this, &TemplatesInsertCommandAction::insertCommand);
21 setMenu(mMenuCommand->menu());
22}
23
24TemplatesInsertCommandAction::~TemplatesInsertCommandAction() = default;
25
26TemplatesCommandMenu::MenuTypes TemplatesInsertCommandAction::type() const
27{
28 return mMenuCommand->type();
29}
30
31void TemplatesInsertCommandAction::setType(TemplatesCommandMenu::MenuTypes type)
32{
33 mMenuCommand->setType(type);
34 setMenu(mMenuCommand->menu());
35}
36
37#include "moc_templatesinsertcommandaction.cpp"
The TemplatesCommandMenu class.
void setMenu(QMenu *menu)
void setObjectName(const QString &name)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.