quicktextmenu.h 1.05 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   SPDX-FileCopyrightText: 2019-2021 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

4
   SPDX-License-Identifier: GPL-2.0-or-later
Laurent Montel's avatar
Laurent Montel committed
5
6
7
8
9
*/

#ifndef QUICKTEXTMENU_H
#define QUICKTEXTMENU_H

10
#include "quicktext_export.h"
Laurent Montel's avatar
Laurent Montel committed
11
#include <MessageComposer/ConvertSnippetVariablesUtil>
Laurent Montel's avatar
Laurent Montel committed
12
#include <QObject>
Laurent Montel's avatar
Laurent Montel committed
13
class QMenu;
Laurent Montel's avatar
Laurent Montel committed
14
15
namespace MessageComposer
{
Laurent Montel's avatar
Laurent Montel committed
16
class PluginComposerInterface;
Laurent Montel's avatar
Laurent Montel committed
17
class ConvertSnippetVariableMenu;
Laurent Montel's avatar
Laurent Montel committed
18
}
19
class QUICKTEXT_EXPORT QuickTextMenu : public QObject
Laurent Montel's avatar
Laurent Montel committed
20
21
22
23
{
    Q_OBJECT
public:
    explicit QuickTextMenu(QWidget *parentWidget, QObject *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
24
    ~QuickTextMenu() override;
Laurent Montel's avatar
Laurent Montel committed
25
26
    QMenu *menu() const;

Laurent Montel's avatar
Laurent Montel committed
27
28
    void setPluginComposerInterface(MessageComposer::PluginComposerInterface *composerInterface);

Laurent Montel's avatar
Laurent Montel committed
29
30
Q_SIGNALS:
    void insertText(const QString &str);
Laurent Montel's avatar
Laurent Montel committed
31
    void insertVariable(MessageComposer::ConvertSnippetVariablesUtil::VariableType type);
Laurent Montel's avatar
Laurent Montel committed
32

Laurent Montel's avatar
Laurent Montel committed
33
private:
Laurent Montel's avatar
Laurent Montel committed
34
    void initializeMenu();
Laurent Montel's avatar
Laurent Montel committed
35
    QWidget *const mParentWidget;
Laurent Montel's avatar
Laurent Montel committed
36
    MessageComposer::ConvertSnippetVariableMenu *mMenu = nullptr;
Laurent Montel's avatar
Laurent Montel committed
37
    MessageComposer::PluginComposerInterface *mComposerInterface = nullptr;
Laurent Montel's avatar
Laurent Montel committed
38
39
40
};

#endif // QUICKTEXTMENU_H