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