KMail: Fix scrolling up/down on the message viewer
[kdepim.git] / incidenceeditor-ng / individualmailcomponentfactory.h
blob3cb4be2836cfd71f81bdc26776d6e1992fd29ad8
1 /*
2 * Copyright (c) 2014 Sandro Knauß <knauss@kolabsys.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * As a special exception, permission is given to link this program
19 * with any edition of Qt, and distribute the resulting executable,
20 * without including the source code for Qt in the source distribution.
23 #ifndef INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
24 #define INCIDENCEEDITOR_INDUVIDUALMAILJOBFACTORY_H
26 #include "incidenceeditors_ng_export.h"
28 #include "opencomposerjob.h"
30 #include <mailtransport/messagequeuejob.h>
31 #include <Akonadi/Calendar/IncidenceChanger>
32 #include <KIdentityManagement/Identity>
34 namespace IncidenceEditorNG
37 class IndividualMailDialog;
39 class IndividualMessageQueueJob : public MailTransport::MessageQueueJob
41 Q_OBJECT
42 public:
43 explicit IndividualMessageQueueJob(const KIdentityManagement::Identity &identity, const KCalCore::Attendee::List &update, const KCalCore::Attendee::List &edit, QObject *parent);
45 void start() Q_DECL_OVERRIDE;
46 private Q_SLOTS:
47 void startQueueJob(const QStringList &to, const QStringList &cc);
48 void startComposerJob(const QStringList &to, const QStringList &cc);
49 void handleJobFinished(KJob *job);
51 private:
52 KCalCore::Attendee::List mUpdate;
53 KCalCore::Attendee::List mEdit;
54 KIdentityManagement::Identity mIdentity;
55 MailTransport::MessageQueueJob *mQueueJob;
56 OpenComposerJob *mComposerJob;
59 class IndividualMailITIPHandlerDialogDelegate : public Akonadi::ITIPHandlerDialogDelegate
61 Q_OBJECT
62 public:
64 explicit IndividualMailITIPHandlerDialogDelegate(const KCalCore::Incidence::Ptr &incidence, KCalCore::iTIPMethod method, QWidget *parent);
66 void openDialogIncidenceCreated(Recipient recipient,
67 const QString &question,
68 Action action = ActionAsk,
69 const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
70 const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send"))) Q_DECL_OVERRIDE;
72 void openDialogIncidenceModified(bool attendeeStatusChanged,
73 Recipient recipient,
74 const QString &question,
75 Action action = ActionAsk,
76 const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
77 const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send"))) Q_DECL_OVERRIDE;
79 void openDialogIncidenceDeleted(Recipient recipient,
80 const QString &question,
81 Action action = ActionAsk,
82 const KGuiItem &buttonYes = KGuiItem(i18nc("@action:button dialog positive answer", "Send Email")),
83 const KGuiItem &buttonNo = KGuiItem(i18nc("@action:button dialog negative answer", "Do Not Send"))) Q_DECL_OVERRIDE;
85 Q_SIGNALS:
86 void setEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit);
87 void setUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update);
89 protected:
90 void openDialog(const QString &question, const KCalCore::Attendee::List &attendees,
91 Action action,
92 const KGuiItem &buttonYes, const KGuiItem &buttonNo);
94 private Q_SLOTS:
95 void onDialogClosed(int result);
96 private:
97 IndividualMailDialog *mDialog;
100 class INCIDENCEEDITORS_NG_EXPORT IndividualMailComponentFactory : public Akonadi::ITIPHandlerComponentFactory
102 Q_OBJECT
103 public:
104 explicit IndividualMailComponentFactory(QObject *parent = Q_NULLPTR);
105 MailTransport::MessageQueueJob *createMessageQueueJob(const KCalCore::IncidenceBase::Ptr &incidence,
106 const KIdentityManagement::Identity &identity, QObject *parent) Q_DECL_OVERRIDE;
108 Akonadi::ITIPHandlerDialogDelegate *createITIPHanderDialogDelegate(const KCalCore::Incidence::Ptr &incidence,
109 KCalCore::iTIPMethod method, QWidget *parent) Q_DECL_OVERRIDE;
111 public Q_SLOTS:
112 void onSetEdit(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &edit);
113 void onSetUpdate(const KCalCore::Incidence::Ptr &incidence, const KCalCore::Attendee::List &update);
115 private:
116 QHash<QString, KCalCore::Attendee::List> mEdit;
117 QHash<QString, KCalCore::Attendee::List> mUpdate;
121 #endif