Debian Codegraph @

Dekko/backend/network/MsgReply.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 MSGREPLY_H
19 #define MSGREPLY_H
20
21 #include <QObject>
22 #include <QBuffer>
23 #include <QNetworkReply>
24 #include <qmailstore.h>
25 #include <MailServiceClient.h>
26 #include "MsgPartQNAM.h"
27
28 class MsgReply : public QNetworkReply
29 {
30 Q_OBJECT
31 public:
32 MsgReply(MsgPartQNAM *parent, QMailMessageId &msgId);
33 MsgReply(MsgPartQNAM *parent, QMailMessageId &msgId, const bool requiresFormatting);
34 ~MsgReply();
35
36 // QIODevice interface
37 public:
38 virtual void close();
39 virtual qint64 bytesAvailable() const;
40
41 protected:
42 virtual qint64 readData(char *data, qint64 maxlen);
43
44 // QNetworkReply interface
45 public slots:
46 virtual void abort() { close(); }
47 void failed(const QString &reason);
48
49 void handleMsgsAvailable(const QMailMessageIdList &list);
50 void handleFetchFailed(const QMailMessageIdList &list);
51
52 void messageReady();
53 void init();
54
55 private:
56 QByteArray *formattedBufferContent;
57 mutable QBuffer buffer;
58 QMailMessageId m_id;
59 QMailMessage m_msg;
60 bool m_format;
61 };
62
63 #endif // MSGREPLY_H