File indexing completed on 2025-01-19 04:46:57

0001 /*
0002   SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QWidget>
0010 
0011 #include <Akonadi/Collection>
0012 #include <Akonadi/NoteUtils>
0013 #include <KMime/KMimeMessage>
0014 
0015 class QLineEdit;
0016 class QPushButton;
0017 namespace Akonadi
0018 {
0019 class CollectionComboBox;
0020 }
0021 
0022 namespace MessageViewer
0023 {
0024 class NoteEdit : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit NoteEdit(QWidget *parent = nullptr);
0029     ~NoteEdit() override;
0030 
0031     [[nodiscard]] Akonadi::Collection collection() const;
0032     void setCollection(const Akonadi::Collection &value);
0033 
0034     [[nodiscard]] KMime::Message::Ptr message() const;
0035     void setMessage(const KMime::Message::Ptr &value);
0036 
0037     void writeConfig();
0038     void showNoteEdit();
0039 
0040 public Q_SLOTS:
0041     void slotCloseWidget();
0042 
0043 Q_SIGNALS:
0044     void createNote(const KMime::Message::Ptr &note, const Akonadi::Collection &collection);
0045     void collectionChanged(const Akonadi::Collection &col);
0046     void messageChanged(const KMime::Message::Ptr &msg);
0047 
0048 protected:
0049     bool eventFilter(QObject *object, QEvent *e) override;
0050 
0051 private:
0052     void slotReturnPressed();
0053     void slotCollectionChanged(int);
0054     void slotUpdateButtons(const QString &subject);
0055     void readConfig();
0056     Akonadi::Collection mCollection;
0057     KMime::Message::Ptr mMessage;
0058     QLineEdit *const mNoteEdit;
0059     Akonadi::CollectionComboBox *const mCollectionCombobox;
0060     QPushButton *const mSaveButton;
0061 };
0062 }