File indexing completed on 2024-04-28 05:11:37

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0005  */
0006 
0007 #pragma once
0008 #include "incidenceeditor_private_export.h"
0009 #include <KCalendarCore/Attendee>
0010 #include <QDialog>
0011 
0012 class KGuiItem;
0013 
0014 class TestIndividualMailDialog;
0015 class QDialogButtonBox;
0016 class QComboBox;
0017 namespace IncidenceEditorNG
0018 {
0019 // Shows a dialog with a question and the option to select which attendee should get the mail or to open a composer for him.
0020 // Used to get individual mails for attendees of an event.
0021 class INCIDENCEEDITOR_TESTS_EXPORT IndividualMailDialog : public QDialog
0022 {
0023     Q_OBJECT
0024     friend class ::TestIndividualMailDialog;
0025 
0026 public:
0027     enum Decisions {
0028         Update, /**< send automatic mail to attendee */
0029         NoUpdate, /**< do not send mail to attendee */
0030         Edit /**< open composer for attendee */
0031     };
0032     explicit IndividualMailDialog(const QString &question,
0033                                   const KCalendarCore::Attendee::List &attendees,
0034                                   const KGuiItem &buttonYes,
0035                                   const KGuiItem &buttonNo,
0036                                   QWidget *parent = nullptr);
0037     ~IndividualMailDialog() override;
0038 
0039     [[nodiscard]] KCalendarCore::Attendee::List editAttendees() const;
0040     [[nodiscard]] KCalendarCore::Attendee::List updateAttendees() const;
0041 
0042 private:
0043     void updateButtonState();
0044 
0045     std::vector<std::pair<KCalendarCore::Attendee, QComboBox *>> mAttendeeDecision;
0046     QDialogButtonBox *m_buttons = nullptr;
0047     QWidget *m_detailsWidget = nullptr;
0048 };
0049 }