1 /*
2    SPDX-FileCopyrightText: 2014-2021 Laurent Montel <montel@kde.org>
3 
4    SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <Akonadi/Item>
10 #include <KSharedConfig>
11 #include <QObject>
12 #include <QPointer>
13 namespace FollowUpReminder
14 {
15 class FollowUpReminderInfo;
16 }
17 class FollowUpReminderNoAnswerDialog;
18 class FollowUpReminderManager : public QObject
19 {
20     Q_OBJECT
21 public:
22     explicit FollowUpReminderManager(QObject *parent = nullptr);
23     ~FollowUpReminderManager() override;
24 
25     void load(bool forceReloadConfig = false);
26     void addReminder(FollowUpReminder::FollowUpReminderInfo *reminder); // takes ownership
27     void checkFollowUp(const Akonadi::Item &item, const Akonadi::Collection &col);
28 
29     Q_REQUIRED_RESULT QString printDebugInfo() const;
30 
31 private:
32     Q_DISABLE_COPY(FollowUpReminderManager)
33     void slotCheckFollowUpFinished(const QString &messageId, Akonadi::Item::Id id);
34 
35     void slotFinishTaskDone();
36     void slotFinishTaskFailed();
37     void slotReparseConfiguration();
38     void answerReceived(const QString &from);
39     Q_REQUIRED_RESULT QString infoToStr(FollowUpReminder::FollowUpReminderInfo *info) const;
40 
41     KSharedConfig::Ptr mConfig;
42     QList<FollowUpReminder::FollowUpReminderInfo *> mFollowUpReminderInfoList;
43     QPointer<FollowUpReminderNoAnswerDialog> mNoAnswerDialog;
44     bool mInitialize = false;
45 };
46 
47