Debian Codegraph @

Dekko/backend/mail/service/MailServiceWorker.h

raw symbols SCIP
1 /* Copyright (C) 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 MAILSERVICEWORKER_H
19 #define MAILSERVICEWORKER_H
20
21
22 #include <QObject>
23 #include <QtDBus>
24 #include "ClientService.h"
25 #include <qmailmessagekey.h>
26 #include <qmailmessagesortkey.h>
27
28
29 class MailServiceWorker : public QObject
30 {
31 Q_OBJECT
32 Q_CLASSINFO("D-Bus Interface", "org.dekkoproject.MailService")
33
34 public:
35 explicit MailServiceWorker(QObject *parent = Q_NULLPTR);
36
37 static void registerTypes();
38
39 Q_PROPERTY(bool hasUndoableAction READ hasUndoableAction)
40 bool hasUndoableAction();
41 Q_PROPERTY(QString undoDescription READ undoDescription)
42 QString undoDescription();
43
44 public slots:
45 /**
46 * @brief deleteMessages
47 * @param ids
48 */
49 void deleteMessages(const QList<quint64> &ids);
50 /**
51 * @brief restoreMessage
52 * @param id
53 */
54 void restoreMessage(const quint64 &id);
55 /**
56 * @brief markMessagesImportant
57 * @param msgIds
58 * @param important
59 */
60 void markMessagesImportant(const QList<quint64> &msgIds, const bool important);
61 /**
62 * @brief markMessagesRead
63 * @param msgIds
64 * @param read
65 */
66 void markMessagesRead(const QList<quint64> &msgIds, const bool read);
67 /**
68 * @brief markMessagesTodo
69 * @param msgIds
70 * @param todo
71 */
72 void markMessagesTodo(const QList<quint64> &msgIds, const bool todo);
73 /**
74 * @brief markMessagesDone
75 * @param msgIds
76 * @param done
77 */
78 void markMessagesDone(const QList<quint64> &msgIds, const bool done);
79 /**
80 * @brief markMessagesReplied
81 * @param msgIds
82 * @param all
83 */
84 void markMessagesReplied(const QList<quint64> &msgIds, const bool all);
85 /**
86 * @brief markMessageForwarded
87 * @param msgIds
88 */
89 void markMessageForwarded(const QList<quint64> &msgIds);
90 /**
91 * @brief syncFolders
92 * @param accountId
93 * @param folders
94 */
95 void syncFolders(const quint64 &accountId, const QList<quint64> &folders);
96 /**
97 * @brief createStandardFolders
98 * @param accountId
99 */
100 void createStandardFolders(const quint64 &accountId);
101 /**
102 * @brief moveToFolder
103 * @param msgIds
104 * @param folderId
105 */
106 void moveToFolder(const QList<quint64> &msgIds, const quint64 &folderId);
107 /**
108 * @brief moveToStandardFolder
109 * @param msgIds
110 * @param folder
111 * @param userTriggered
112 */
113 void moveToStandardFolder(const QList<quint64> &msgIds, const int &folder, const bool userTriggered = true);
114 /**
115 * @brief markFolderRead
116 * @param folderId
117 */
118 void markFolderRead(const quint64 &folderId);
119 /**
120 * @brief downloadMessagePart
121 * @param msgId
122 * @param partLocation
123 */
124 void downloadMessagePart(const quint64 &msgId, const QString &partLocation);
125 /**
126 * @brief downloadMessages
127 * @param msgIds
128 */
129 void downloadMessages(const QList<quint64> &msgIds);
130 /**
131 * @brief sendMessage
132 * @param msgId
133 */
134 void sendMessage(const quint64 &msgId);
135 /**
136 * @brief sendPendingMessages
137 */
138 void sendPendingMessages();
139 /**
140 * @brief synchronizeAccount
141 * @param accountId
142 */
143 void synchronizeAccount(const quint64 &accountId);
144 /**
145 * @brief undoActions
146 */
147 void undoActions();
148 /**
149 * @brief sendAnyQueuedMail
150 */
151 void sendAnyQueuedMail();
152
153 void emptyTrash(const QList<quint64> &accountIds);
154
155 void removeMessage(const quint64 &msgId, const int &option);
156
157 int totalCount(const QByteArray &msgKey);
158
159 QList<quint64> queryMessages(const QByteArray &msgKey, const QByteArray &sortKey, const int &limit);
160 QList<quint64> queryFolders(const QByteArray &folderKey, const QByteArray &sortKey = QByteArray(), const int &limit = 0);
161
162 void pruneCache(const QList<quint64> &msgIds);
163 signals:
164 void undoCountChanged();
165 void updatesRolledBack();
166 void queueChanged();
167 void messageRestored(const quint64 &msgId);
168 void messagePartNowAvailable(const quint64 &msgId, const QString &partLocation);
169 void messagePartFetchFailed(const quint64 &msgId, const QString &partLocation);
170 void messagesNowAvailable(const QList<quint64> &idList);
171 void messageFetchFailed(const QList<quint64> &ids);
172 void messagesSent(const QList<quint64> &ids);
173 void messageSendingFailed(const QList<quint64> &ids, const int &error);
174 void accountSynced(const quint64 &id);
175 void syncAccountFailed(const quint64 &id);
176 void clientError(const quint64 &accountId, const int &error, const QString &errorString);
177 void standardFoldersCreated(const quint64 &accountId, const bool &created);
178 void actionFailed(const quint64 &id, const int &statusCode, const QString &statusText);
179 void foldersSynced(const quint64 &accountId, const QList<quint64> &folderIds);
180 void foldersSyncFailed(const quint64 &accountId, const QList<quint64> &folderIds);
181
182
183 private slots:
184 void handleMessagesFetched(const QMailMessageIdList &msgIds);
185 void handleMessageFetchFailed(const QMailMessageIdList &msgIds);
186 void handleMessagesSent(const QMailMessageIdList &msgIds);
187 void handleMessageSendingFailed(const QMailMessageIdList &ids, QMailServiceAction::Status::ErrorCode error);
188 void handleActionFailed(const quint64 &id, const QMailServiceAction::Status &status);
189 void handleFoldersSynced(const quint64 &accountId, const QMailFolderIdList &folders);
190 void handleFoldersSyncFailed(const quint64 &accountId, const QMailFolderIdList &folders);
191
192 private:
193 ClientService *m_service;
194
195 };
196
197
198 #endif // MAILSERVICEWORKER_H