File indexing completed on 2024-04-28 05:11:36
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 0009 #include "incidenceeditor_export.h" 0010 0011 #include <Akonadi/IncidenceChanger> 0012 #include <Akonadi/MessageQueueJob> 0013 #include <KIdentityManagementCore/Identity> 0014 namespace IncidenceEditorNG 0015 { 0016 class OpenComposerJob; 0017 class IndividualMailDialog; 0018 0019 class IndividualMessageQueueJob : public Akonadi::MessageQueueJob 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit IndividualMessageQueueJob(const KIdentityManagementCore::Identity &identity, 0024 const KCalendarCore::Attendee::List &update, 0025 const KCalendarCore::Attendee::List &edit, 0026 QObject *parent); 0027 0028 void start() override; 0029 0030 private: 0031 void startQueueJob(const QStringList &messageTo, const QStringList &to, const QStringList &messageCc, const QStringList &cc); 0032 void startComposerJob(const QStringList &to, const QStringList &cc); 0033 void handleJobFinished(KJob *job); 0034 KCalendarCore::Attendee::List mUpdate; 0035 KCalendarCore::Attendee::List mEdit; 0036 KIdentityManagementCore::Identity mIdentity; 0037 Akonadi::MessageQueueJob *mQueueJob = nullptr; 0038 OpenComposerJob *mComposerJob = nullptr; 0039 }; 0040 0041 class IndividualMailITIPHandlerDialogDelegate : public Akonadi::ITIPHandlerDialogDelegate 0042 { 0043 Q_OBJECT 0044 public: 0045 explicit IndividualMailITIPHandlerDialogDelegate(const KCalendarCore::Incidence::Ptr &incidence, KCalendarCore::iTIPMethod method, QWidget *parent); 0046 0047 void openDialogIncidenceCreated(Recipient recipient, 0048 const QString &question, 0049 Action action = ActionAsk, 0050 const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")), 0051 const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send"))) override; 0052 0053 void openDialogIncidenceModified(bool attendeeStatusChanged, 0054 Recipient recipient, 0055 const QString &question, 0056 Action action = ActionAsk, 0057 const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")), 0058 const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send"))) override; 0059 0060 void openDialogIncidenceDeleted(Recipient recipient, 0061 const QString &question, 0062 Action action = ActionAsk, 0063 const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")), 0064 const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send"))) override; 0065 0066 Q_SIGNALS: 0067 void setEdit(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Attendee::List &edit); 0068 void setUpdate(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Attendee::List &update); 0069 0070 protected: 0071 void 0072 openDialog(const QString &question, const KCalendarCore::Attendee::List &attendees, Action action, const KGuiItem &buttonYes, const KGuiItem &buttonNo); 0073 0074 private: 0075 void onDialogClosed(int result); 0076 IndividualMailDialog *mDialog = nullptr; 0077 }; 0078 0079 class INCIDENCEEDITOR_EXPORT IndividualMailComponentFactory : public Akonadi::ITIPHandlerComponentFactory 0080 { 0081 Q_OBJECT 0082 public: 0083 explicit IndividualMailComponentFactory(QObject *parent = nullptr); 0084 Akonadi::MessageQueueJob * 0085 createMessageQueueJob(const KCalendarCore::IncidenceBase::Ptr &incidence, const KIdentityManagementCore::Identity &identity, QObject *parent) override; 0086 0087 Akonadi::ITIPHandlerDialogDelegate * 0088 createITIPHanderDialogDelegate(const KCalendarCore::Incidence::Ptr &incidence, KCalendarCore::iTIPMethod method, QWidget *parent) override; 0089 0090 public Q_SLOTS: 0091 void onSetEdit(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Attendee::List &edit); 0092 void onSetUpdate(const KCalendarCore::Incidence::Ptr &incidence, const KCalendarCore::Attendee::List &update); 0093 0094 private: 0095 QHash<QString, KCalendarCore::Attendee::List> mEdit; 0096 QHash<QString, KCalendarCore::Attendee::List> mUpdate; 0097 }; 0098 }