File indexing completed on 2025-01-05 04:49:29
0001 /* 0002 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "quicktext_export.h" 0010 #include <MessageComposer/ConvertSnippetVariablesUtil> 0011 #include <QObject> 0012 class QMenu; 0013 namespace MessageComposer 0014 { 0015 class PluginComposerInterface; 0016 class ConvertSnippetVariableMenu; 0017 } 0018 class QUICKTEXT_EXPORT QuickTextMenu : public QObject 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit QuickTextMenu(QWidget *parentWidget, QObject *parent = nullptr); 0023 ~QuickTextMenu() override; 0024 [[nodiscard]] QMenu *menu() const; 0025 0026 void setPluginComposerInterface(MessageComposer::PluginComposerInterface *composerInterface); 0027 0028 Q_SIGNALS: 0029 void insertText(const QString &str); 0030 void insertVariable(MessageComposer::ConvertSnippetVariablesUtil::VariableType type); 0031 0032 private: 0033 void initializeMenu(); 0034 QWidget *const mParentWidget; 0035 MessageComposer::ConvertSnippetVariableMenu *mMenu = nullptr; 0036 MessageComposer::PluginComposerInterface *mComposerInterface = nullptr; 0037 };