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 <MailCommon/SnippetsModel>
0010 #include <MessageComposer/PluginEditorInterface>
0011 #include <QTextCursor>
0012 class QuickTextPluginEditorInterface : public MessageComposer::PluginEditorInterface
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit QuickTextPluginEditorInterface(QObject *parent = nullptr);
0017     ~QuickTextPluginEditorInterface() override;
0018 
0019     void createAction(KActionCollection *ac) override;
0020     void exec() override;
0021     [[nodiscard]] bool processProcessKeyEvent(QKeyEvent *event) override;
0022 
0023     void reloadConfig();
0024 
0025 private:
0026     void updateSnippetsInfo();
0027     void slotActivated();
0028     void selectPreviousWord(QTextCursor &cursor, int cursorPosition);
0029     QList<MailCommon::SnippetsInfo> mSnippetsInfo;
0030     MailCommon::SnippetsModel *const mModel;
0031 };