Diffstat (limited to 'noncore/unsupported/mailit/emailhandler.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h index b645868..5b59f65 100644 --- a/noncore/unsupported/mailit/emailhandler.h +++ b/noncore/unsupported/mailit/emailhandler.h | |||
@@ -1,149 +1,150 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef EmailHandler_H | 20 | #ifndef EmailHandler_H |
21 | #define EmailHandler_H | 21 | #define EmailHandler_H |
22 | 22 | ||
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlist.h> | 26 | #include <qlist.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qfile.h> | 28 | #include <qfile.h> |
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <qcollection.h> | 30 | #include <qcollection.h> |
31 | #include <qpe/qcopenvelope_qws.h> | ||
31 | 32 | ||
32 | #include "smtpclient.h" | 33 | #include "smtpclient.h" |
33 | #include "popclient.h" | 34 | #include "popclient.h" |
34 | #include "textparser.h" | 35 | #include "textparser.h" |
35 | #include "maillist.h" | 36 | #include "maillist.h" |
36 | 37 | ||
37 | struct Enclosure | 38 | struct Enclosure |
38 | { | 39 | { |
39 | int id; | 40 | int id; |
40 | QString originalName; | 41 | QString originalName; |
41 | QString name; | 42 | QString name; |
42 | QString path; | 43 | QString path; |
43 | QString contentType; | 44 | QString contentType; |
44 | QString contentAttribute; | 45 | QString contentAttribute; |
45 | QString encoding; | 46 | QString encoding; |
46 | QString body; //might use to much mem. check!! | 47 | QString body; //might use to much mem. check!! |
47 | bool saved, installed; | 48 | bool saved, installed; |
48 | }; | 49 | }; |
49 | 50 | ||
50 | class EnclosureList : public QList<Enclosure> | 51 | class EnclosureList : public QList<Enclosure> |
51 | { | 52 | { |
52 | public: | 53 | public: |
53 | Item newItem(Item d); | 54 | Item newItem(Item d); |
54 | private: | 55 | private: |
55 | Enclosure* dupl(Enclosure *in); | 56 | Enclosure* dupl(Enclosure *in); |
56 | Enclosure *ac; | 57 | Enclosure *ac; |
57 | }; | 58 | }; |
58 | 59 | ||
59 | struct Email | 60 | struct Email |
60 | { | 61 | { |
61 | QString id; | 62 | QString id; |
62 | QString from; | 63 | QString from; |
63 | QString fromMail; | 64 | QString fromMail; |
64 | QStringList recipients; | 65 | QStringList recipients; |
65 | QStringList carbonCopies; | 66 | QStringList carbonCopies; |
66 | QString date; | 67 | QString date; |
67 | QString subject; | 68 | QString subject; |
68 | QString body; | 69 | QString body; |
69 | QString bodyPlain; | 70 | QString bodyPlain; |
70 | bool sent, received, read, downloaded; | 71 | bool sent, received, read, downloaded; |
71 | QString rawMail; | 72 | QString rawMail; |
72 | int mimeType; //1 = Mime 1.0 | 73 | int mimeType; //1 = Mime 1.0 |
73 | int serverId; | 74 | int serverId; |
74 | int internalId; | 75 | int internalId; |
75 | int fromAccountId; | 76 | int fromAccountId; |
76 | QString contentType; //0 = text | 77 | QString contentType; //0 = text |
77 | QString contentAttribute; //0 = plain, 1 = html | 78 | QString contentAttribute; //0 = plain, 1 = html |
78 | EnclosureList files; | 79 | EnclosureList files; |
79 | uint size; | 80 | uint size; |
80 | 81 | ||
81 | void addEnclosure(Enclosure *e) | 82 | void addEnclosure(Enclosure *e) |
82 | { | 83 | { |
83 | files.append(e); | 84 | files.append(e); |
84 | } | 85 | } |
85 | }; | 86 | }; |
86 | 87 | ||
87 | struct MailAccount | 88 | struct MailAccount |
88 | { | 89 | { |
89 | QString accountName; | 90 | QString accountName; |
90 | QString name; | 91 | QString name; |
91 | QString emailAddress; | 92 | QString emailAddress; |
92 | QString popUserName; | 93 | QString popUserName; |
93 | QString popPasswd; | 94 | QString popPasswd; |
94 | QString popServer; | 95 | QString popServer; |
95 | QString smtpServer; | 96 | QString smtpServer; |
96 | bool synchronize; | 97 | bool synchronize; |
97 | int syncLimit; | 98 | int syncLimit; |
98 | int lastServerMailCount; | 99 | int lastServerMailCount; |
99 | int id; | 100 | int id; |
100 | }; | 101 | }; |
101 | 102 | ||
102 | const int ErrUnknownResponse = 1001; | 103 | const int ErrUnknownResponse = 1001; |
103 | const int ErrLoginFailed = 1002; | 104 | const int ErrLoginFailed = 1002; |
104 | const int ErrCancel = 1003; | 105 | const int ErrCancel = 1003; |
105 | 106 | ||
106 | 107 | ||
107 | class EmailHandler : public QObject | 108 | class EmailHandler : public QObject |
108 | { | 109 | { |
109 | Q_OBJECT | 110 | Q_OBJECT |
110 | 111 | ||
111 | public: | 112 | public: |
112 | EmailHandler(); | 113 | EmailHandler(); |
113 | void setAccount(MailAccount account); | 114 | void setAccount(MailAccount account); |
114 | MailAccount* getAccount(){return &mailAccount;} | 115 | MailAccount* getAccount(){return &mailAccount;} |
115 | void sendMail(QList<Email> *mailList); | 116 | void sendMail(QList<Email> *mailList); |
116 | void getMail(); | 117 | void getMail(); |
117 | void getMailHeaders(); | 118 | void getMailHeaders(); |
118 | void getMailByList(MailList *mailList); | 119 | void getMailByList(MailList *mailList); |
119 | bool parse(QString in, QString lineShift, Email *mail); | 120 | bool parse(QString in, QString lineShift, Email *mail); |
120 | bool getEnclosure(Enclosure *ePtr); | 121 | bool getEnclosure(Enclosure *ePtr); |
121 | int parse64base(char *src, char *dest); | 122 | int parse64base(char *src, char *dest); |
122 | int encodeMime(Email *mail); | 123 | int encodeMime(Email *mail); |
123 | int encodeFile(QString fileName, QString *toBody); | 124 | int encodeFile(QString fileName, QString *toBody); |
124 | void encode64base(char *src, QString *dest, int len); | 125 | void encode64base(char *src, QString *dest, int len); |
125 | void cancel(); | 126 | void cancel(); |
126 | 127 | ||
127 | signals: | 128 | signals: |
128 | void mailSent(); | 129 | void mailSent(); |
129 | void smtpError(int); | 130 | void smtpError(int); |
130 | void popError(int); | 131 | void popError(int); |
131 | void mailArrived(const Email &, bool); | 132 | void mailArrived(const Email &, bool); |
132 | void updatePopStatus(const QString &); | 133 | void updatePopStatus(const QString &); |
133 | void updateSmtpStatus(const QString &); | 134 | void updateSmtpStatus(const QString &); |
134 | void mailTransfered(int); | 135 | void mailTransfered(int); |
135 | void mailboxSize(int); | 136 | void mailboxSize(int); |
136 | void currentMailSize(int); | 137 | void currentMailSize(int); |
137 | void downloadedSize(int); | 138 | void downloadedSize(int); |
138 | 139 | ||
139 | public slots: | 140 | public slots: |
140 | void messageArrived(const QString &, int id, uint size, bool complete); | 141 | void messageArrived(const QString &, int id, uint size, bool complete); |
141 | 142 | ||
142 | private: | 143 | private: |
143 | MailAccount mailAccount; | 144 | MailAccount mailAccount; |
144 | SmtpClient *smtpClient; | 145 | SmtpClient *smtpClient; |
145 | PopClient *popClient; | 146 | PopClient *popClient; |
146 | bool headers; | 147 | bool headers; |
147 | }; | 148 | }; |
148 | 149 | ||
149 | #endif | 150 | #endif |