author | leseb <leseb> | 2002-06-17 20:52:48 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-06-17 20:52:48 (UTC) |
commit | b177eb4a659c674d1bc3ab82d6d980aade7c0959 (patch) (unidiff) | |
tree | 4ba2aee9db13423e37ae0a8051d80c010f815666 /noncore/unsupported/mail2/libmail | |
parent | 7ba6590093fb86fe4bf64839d3a517dd396853a3 (diff) | |
download | opie-b177eb4a659c674d1bc3ab82d6d980aade7c0959.zip opie-b177eb4a659c674d1bc3ab82d6d980aade7c0959.tar.gz opie-b177eb4a659c674d1bc3ab82d6d980aade7c0959.tar.bz2 |
Fix some bugs when dealing with attachments
Diffstat (limited to 'noncore/unsupported/mail2/libmail') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/mail2/libmail/mailfactory.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/mail2/libmail/mailfactory.h | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/mail2/libmail/mailfactory.cpp b/noncore/unsupported/mail2/libmail/mailfactory.cpp index 6602919..e02f80f 100644 --- a/noncore/unsupported/mail2/libmail/mailfactory.cpp +++ b/noncore/unsupported/mail2/libmail/mailfactory.cpp | |||
@@ -77,25 +77,25 @@ MailFactory::MailFactory(SendMail &smail, QWidget *parent) | |||
77 | _body += _smail.message() + "\n"; | 77 | _body += _smail.message() + "\n"; |
78 | // } | 78 | // } |
79 | 79 | ||
80 | QValueList<Attachment> attachments = _smail.attachments(); | 80 | QValueList<Attachment> attachments = _smail.attachments(); |
81 | QValueList<Attachment>::Iterator it; | 81 | QValueList<Attachment>::Iterator it; |
82 | for (it = attachments.begin(); it != attachments.end(); it++) { | 82 | for (it = attachments.begin(); it != attachments.end(); it++) { |
83 | QFile f((*it).fileName()); | 83 | QFile f((*it).fileName()); |
84 | if (f.open(IO_ReadOnly)) { | 84 | if (f.open(IO_ReadOnly)) { |
85 | QTextStream t(&f); | 85 | QTextStream t(&f); |
86 | QString file; | 86 | QString file; |
87 | while (!t.atEnd()) file += t.readLine() + "\n"; | 87 | while (!t.atEnd()) file += t.readLine() + "\n"; |
88 | f.close(); | 88 | f.close(); |
89 | QString mimetype = (new MimeType(*(*it).docLnk()))->id(); | 89 | QString mimetype = (new MimeType((*it).docLnk()))->id(); |
90 | 90 | ||
91 | _body += "\n--" + boundary + "\n"; | 91 | _body += "\n--" + boundary + "\n"; |
92 | _body += "Content-Type: " + mimetype + "; name=\"" + (*it).newName() + "\"\n"; | 92 | _body += "Content-Type: " + mimetype + "; name=\"" + (*it).newName() + "\"\n"; |
93 | 93 | ||
94 | // TODO: Decide which content transfer encoding is best. B64 for binary, QP for text. | 94 | // TODO: Decide which content transfer encoding is best. B64 for binary, QP for text. |
95 | _body += "Content-Transfer-Encoding: base64\n"; | 95 | _body += "Content-Transfer-Encoding: base64\n"; |
96 | 96 | ||
97 | _body += "Content-Disposition: attachment; filename=\"" + (*it).newName() + "\"\n"; | 97 | _body += "Content-Disposition: attachment; filename=\"" + (*it).newName() + "\"\n"; |
98 | if (!(*it).description().isEmpty()) | 98 | if (!(*it).description().isEmpty()) |
99 | _body += "Content-Description: " + (*it).description() + "\n"; | 99 | _body += "Content-Description: " + (*it).description() + "\n"; |
100 | 100 | ||
101 | _body += "\n" + MiscFunctions::encodeBase64(file) + "\n"; | 101 | _body += "\n" + MiscFunctions::encodeBase64(file) + "\n"; |
diff --git a/noncore/unsupported/mail2/libmail/mailfactory.h b/noncore/unsupported/mail2/libmail/mailfactory.h index 8f67447..c938c27 100644 --- a/noncore/unsupported/mail2/libmail/mailfactory.h +++ b/noncore/unsupported/mail2/libmail/mailfactory.h | |||
@@ -4,34 +4,34 @@ | |||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | 5 | ||
6 | #include <qpe/applnk.h> | 6 | #include <qpe/applnk.h> |
7 | 7 | ||
8 | #include "configfile.h" | 8 | #include "configfile.h" |
9 | 9 | ||
10 | class Attachment | 10 | class Attachment |
11 | { | 11 | { |
12 | public: | 12 | public: |
13 | void setFileName(QString fileName) { _fileName = fileName; } | 13 | void setFileName(QString fileName) { _fileName = fileName; } |
14 | void setNewName(QString newName) { _newName = newName; } | 14 | void setNewName(QString newName) { _newName = newName; } |
15 | void setDescription(QString description) { _description = description; } | 15 | void setDescription(QString description) { _description = description; } |
16 | void setDocLnk(DocLnk *docLnk) { _docLnk = docLnk; } | 16 | void setDocLnk(DocLnk docLnk) { _docLnk = docLnk; } |
17 | 17 | ||
18 | QString fileName() { return _fileName; } | 18 | QString fileName() { return _fileName; } |
19 | QString newName() { return _newName; } | 19 | QString newName() { return _newName; } |
20 | QString description() { return _description; } | 20 | QString description() { return _description; } |
21 | DocLnk *docLnk() { return _docLnk; } | 21 | DocLnk docLnk() { return _docLnk; } |
22 | 22 | ||
23 | protected: | 23 | protected: |
24 | QString _fileName, _newName, _description; | 24 | QString _fileName, _newName, _description; |
25 | DocLnk *_docLnk; | 25 | DocLnk _docLnk; |
26 | 26 | ||
27 | }; | 27 | }; |
28 | 28 | ||
29 | class SendMail | 29 | class SendMail |
30 | { | 30 | { |
31 | public: | 31 | public: |
32 | SendMail() { _needsMime = false; } | 32 | SendMail() { _needsMime = false; } |
33 | 33 | ||
34 | void setAccount(Account account) { _account = account; } | 34 | void setAccount(Account account) { _account = account; } |
35 | 35 | ||
36 | void setFrom(QString from) { _from = from; } | 36 | void setFrom(QString from) { _from = from; } |
37 | void setReplyTo(QString replyTo) { _replyTo = replyTo; } | 37 | void setReplyTo(QString replyTo) { _replyTo = replyTo; } |