File indexing completed on 2024-12-22 05:01:15

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 "kmail_private_export.h"
0010 #include <QObject>
0011 class KNotification;
0012 class QTimer;
0013 class KMAILTESTS_TESTS_EXPORT UndoSendCreateJob : public QObject
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit UndoSendCreateJob(QObject *parent = nullptr);
0018     ~UndoSendCreateJob() override;
0019     [[nodiscard]] bool canStart() const;
0020     [[nodiscard]] bool start();
0021 
0022     [[nodiscard]] QString subject() const;
0023     void setMessageInfoText(const QString &subject);
0024 
0025     [[nodiscard]] int delay() const;
0026     void setDelay(int delay);
0027 
0028     [[nodiscard]] qint64 akonadiIndex() const;
0029     void setAkonadiIndex(qint64 akonadiIndex);
0030 
0031 private:
0032     void slotNotificationClosed();
0033     void undoSendEmail();
0034     void slotTimeOut();
0035     QString mSubject;
0036     KNotification *mNotification = nullptr;
0037     QTimer *mTimer = nullptr;
0038     qint64 mAkonadiIndex = -1;
0039     int mDelay = -1;
0040 };