Messagelib

templatescommandmenu.h
1/*
2 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "templateparser_export.h"
10#include <QMap>
11#include <QObject>
12class KActionMenu;
13class QMenu;
14namespace TemplateParser
15{
16/**
17 * @brief The TemplatesCommandMenu class
18 * @author Laurent Montel <montel@kde.org>
19 */
20class TEMPLATEPARSER_EXPORT TemplatesCommandMenu : public QObject
21{
22 Q_OBJECT
23public:
24 explicit TemplatesCommandMenu(QObject *parent = nullptr);
25 ~TemplatesCommandMenu() override;
26
27 enum MenuType {
28 ReplyForwardMessage = 1,
29 CurrentMessage = 2,
30 External = 4,
31 Misc = 8,
32 Debug = 16,
33 Default = ReplyForwardMessage | CurrentMessage | External | Misc | Debug,
34 };
35 Q_FLAG(MenuType)
36 Q_DECLARE_FLAGS(MenuTypes, MenuType)
37 // TODO: apidox for all these enums
38 enum Command {
39 CDnl = 1,
40 CRem,
41 CInsert,
42 CSystem,
43 CQuotePipe,
44 CQuote,
45 CQHeaders,
46 CHeaders,
47 CTextPipe,
48 CMsgPipe,
49 CBodyPipe,
50 CClearPipe,
51 CText,
52 CToAddr,
53 CToName,
54 CFromAddr,
55 CFromName,
56 CFullSubject,
57 CMsgId,
58 COHeader,
59 CHeader,
60 COToAddr,
61 COToName,
62 COFromAddr,
63 COFromName,
64 COFullSubject,
65 COMsgId,
66 CDateEn,
67 CDateShort,
68 CDate,
69 CDow,
70 CTimeLongEn,
71 CTimeLong,
72 CTime,
73 CODateEn,
74 CODateShort,
75 CODate,
76 CODow,
77 COTimeLongEn,
78 COTimeLong,
79 COTime,
80 CBlank,
81 CNop,
82 CClear,
83 CDebug,
84 CDebugOff,
85 CToFName,
86 CToLName,
87 CFromFName,
88 CFromLName,
89 COToFName,
90 COToLName,
91 COFromFName,
92 COFromLName,
93 CCursor,
94 CCCAddr,
95 CCCName,
96 CCCFName,
97 CCCLName,
98 COCCAddr,
99 COCCName,
100 COCCFName,
101 COCCLName,
102 COAddresseesAddr,
103 CSignature,
104 CQuotePlain,
105 CQuoteHtml,
106 CDictionaryLanguage,
107 CLanguage,
108 };
109
110 [[nodiscard]] QMenu *menu() const;
111 void fillMenu();
112 void fillSubMenus();
113
114 [[nodiscard]] MenuTypes type() const;
115 void setType(MenuTypes type);
116
117Q_SIGNALS:
118 void insertCommand(TemplatesCommandMenu::Command cmd);
119 void insertCommand(const QString &cmd, int adjustCursor = 0);
120
121public Q_SLOTS:
122 void slotInsertCommand(TemplatesCommandMenu::Command cmd);
123
124protected:
125 KActionMenu *mMenu = nullptr;
126
127private:
128 TEMPLATEPARSER_NO_EXPORT void fillMenuFromActionMap(const QMap<QString, TemplatesCommandMenu::Command> &map, KActionMenu *menu);
129 MenuTypes mType = Default;
130 bool mWasInitialized = false;
131};
132}
The TemplatesCommandMenu class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.