Debian Codegraph @

Dekko/backend/mail/SubmissionManager.h

raw symbols SCIP
1 /* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef SUBMISSIONMANAGER_H
19 #define SUBMISSIONMANAGER_H
20
21 #include <QObject>
22 #include <QTimer>
23 #include <qmailaccount.h>
24 #include <qmailmessage.h>
25 #include <MailServiceClient.h>
26 #include "MessageBuilder.h"
27 #include "SenderIdentities.h"
28
29 class SubmissionManager : public QObject
30 {
31 Q_OBJECT
32 Q_PROPERTY(QObject *builder READ builder WRITE setBuilder NOTIFY builderChanged)
33 Q_PROPERTY(bool canSend READ canSend CONSTANT)
34 Q_ENUMS(ResponseType)
35 Q_ENUMS(Error)
36 public:
37 explicit SubmissionManager(QObject *parent = 0);
38
39 enum ResponseType {
40 None,
41 Reply,
42 ReplyAll,
43 ReplyList,
44 ForwardInline,
45 ForwardAsAttachment
46 };
47
48 enum Error {
49 NoBuilder,
50 InvalidMessage,
51 NoIdentities,
52 InvalidIdentity
53 };
54
55 QObject *builder() const;
56 bool canSend() const;
57 void respondToMessage(const ResponseType &type, const QMailMessageId &msgId);
58 void forwardMessage(const ResponseType &type, const QMailMessageId &msgId);
59 void reloadDraft(const QMailMessageId &msgId);
60 signals:
61 void builderChanged();
62 void error(const Error &error);
63 void messageQueued();
64 void savingDraftSilently();
65 void draftSavedSilently();
66 void draftSaved();
67 void messageDiscarded();
68
69 public slots:
70 void setBuilder(QObject * builder);
71 void send();
72 void saveDraft(const bool userTriggered = false);
73 // void respond(const ResponseType &type);
74 void messageSent(const QMailMessageIdList &ids);
75 void reloadDraft(const quint64 &msgId);
76 void respondToMessage(const ResponseType &type, const quint64 &msgId);
77 void forwardMessage(const ResponseType &type, const quint64 &msgId);
78 void reset();
79 void discard();
80
81 protected:
82 bool hasBuilder();
83 bool hasIdentities();
84 bool selectedIdentityIsValid();
85
86 private slots:
87 void maybeStartSaveTimer();
88
89 private:
90 MessageBuilder *m_builder;
91 QTimer m_timer;
92 };
93
94 #endif // SUBMISSIONMANAGER_H