File indexing completed on 2024-06-23 05:18:37

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QDateTime>
0010 #include <QDialog>
0011 
0012 #include "messagecomposer_export.h"
0013 
0014 class QCheckBox;
0015 class QPushButton;
0016 namespace Ui
0017 {
0018 class SendLaterWidget;
0019 }
0020 
0021 namespace MessageComposer
0022 {
0023 class SendLaterInfo;
0024 
0025 /** Send later dialog. */
0026 class MESSAGECOMPOSER_EXPORT SendLaterDialog : public QDialog
0027 {
0028     Q_OBJECT
0029 public:
0030     enum SendLaterAction {
0031         Unknown = 0,
0032         SendDeliveryAtTime = 1,
0033         Canceled = 2,
0034         PutInOutbox = 3,
0035     };
0036 
0037     explicit SendLaterDialog(SendLaterInfo *info, QWidget *parent = nullptr);
0038     ~SendLaterDialog() override;
0039 
0040     SendLaterInfo *info();
0041 
0042     [[nodiscard]] SendLaterAction action() const;
0043 
0044 private:
0045     MESSAGECOMPOSER_NO_EXPORT void slotRecurrenceClicked(bool);
0046     MESSAGECOMPOSER_NO_EXPORT void slotOkClicked();
0047     MESSAGECOMPOSER_NO_EXPORT void slotDelay(bool delayEnabled);
0048 
0049     MESSAGECOMPOSER_NO_EXPORT void slotDateChanged(const QString &date);
0050     MESSAGECOMPOSER_NO_EXPORT void load(SendLaterInfo *info);
0051 
0052 private:
0053     QDateTime mSendDateTime;
0054     SendLaterAction mAction = Unknown;
0055     QCheckBox *mDelay = nullptr;
0056     Ui::SendLaterWidget *const mSendLaterWidget;
0057     SendLaterInfo *mInfo = nullptr;
0058     QPushButton *mOkButton = nullptr;
0059 };
0060 }