File indexing completed on 2025-01-05 04:49:46

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <MessageViewer/ViewerPluginInterface>
0010 class KActionCollection;
0011 
0012 namespace MessageViewer
0013 {
0014 class NoteEdit;
0015 class ViewerPluginCreatenoteInterface : public ViewerPluginInterface
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit ViewerPluginCreatenoteInterface(KActionCollection *ac, QWidget *parent = nullptr);
0020     ~ViewerPluginCreatenoteInterface() override;
0021 
0022     void setText(const QString &text) override;
0023     [[nodiscard]] QList<QAction *> actions() const override;
0024     void setMessage(const KMime::Message::Ptr &value) override;
0025     void closePlugin() override;
0026     void showWidget() override;
0027     void setMessageItem(const Akonadi::Item &item) override;
0028     void updateAction(const Akonadi::Item &item) override;
0029     [[nodiscard]] ViewerPluginInterface::SpecificFeatureTypes featureTypes() const override;
0030 
0031 private:
0032     void slotCreateNote(const KMime::Message::Ptr &notePtr, const Akonadi::Collection &collection);
0033 
0034     void slotNoteItemFetched(KJob *job);
0035     [[nodiscard]] Akonadi::Relation relatedNoteRelation() const;
0036     void showCreateNewNoteWidget();
0037     void createAction(KActionCollection *ac);
0038     [[nodiscard]] NoteEdit *widget();
0039 
0040     Akonadi::Item mMessageItem;
0041     NoteEdit *mNoteEdit = nullptr;
0042     QList<QAction *> mAction;
0043 };
0044 }