quicktextmenu.h 1.01 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
*/

Laurent Montel's avatar
Laurent Montel committed
7
#pragma once
Laurent Montel's avatar
Laurent Montel committed
8

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

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

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

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