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

0001 /* SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0002    SPDX-FileContributor: SĂ©rgio Martins <sergio.martins@kdab.com>
0003 
0004    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 #pragma once
0007 
0008 #include <MimeTreeParser/BodyPart>
0009 #include <MimeTreeParser/Enums>
0010 
0011 #include <Akonadi/CalendarBase>
0012 #include <QObject>
0013 
0014 namespace MessageViewer
0015 {
0016 class MemoryCalendarMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento
0017 {
0018     Q_OBJECT
0019 public:
0020     MemoryCalendarMemento();
0021 
0022     [[nodiscard]] bool finished() const;
0023     [[nodiscard]] Akonadi::CalendarBase::Ptr calendar() const;
0024 
0025     void detach() override;
0026 
0027 Q_SIGNALS:
0028     // TODO: Factor our update and detach into base class
0029     void update(MimeTreeParser::UpdateMode);
0030 
0031 private Q_SLOTS:
0032     void finalize();
0033 
0034 private:
0035     void slotCalendarLoaded(bool success, const QString &errorMessage);
0036     bool mFinished = false;
0037     Akonadi::CalendarBase::Ptr mCalendar;
0038 };
0039 }