| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 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 |
|
| 47 |
|
| 48 |
|
| 49 |
void deleteMessages(const QList<quint64> &ids); |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
void restoreMessage(const quint64 &id); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
void markMessagesImportant(const QList<quint64> &msgIds, const bool important); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
void markMessagesRead(const QList<quint64> &msgIds, const bool read); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
void markMessagesTodo(const QList<quint64> &msgIds, const bool todo); |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
void markMessagesDone(const QList<quint64> &msgIds, const bool done); |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
void markMessagesReplied(const QList<quint64> &msgIds, const bool all); |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
void markMessageForwarded(const QList<quint64> &msgIds); |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
void syncFolders(const quint64 &accountId, const QList<quint64> &folders); |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
void createStandardFolders(const quint64 &accountId); |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
void moveToFolder(const QList<quint64> &msgIds, const quint64 &folderId); |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
void moveToStandardFolder(const QList<quint64> &msgIds, const int &folder, const bool userTriggered = true); |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
void markFolderRead(const quint64 &folderId); |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
void downloadMessagePart(const quint64 &msgId, const QString &partLocation); |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
void downloadMessages(const QList<quint64> &msgIds); |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
void sendMessage(const quint64 &msgId); |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
void sendPendingMessages(); |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
void synchronizeAccount(const quint64 &accountId); |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
void undoActions(); |
| 148 |
|
| 149 |
|
| 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 |