summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mail2/libmail/mailfactory.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mail2/libmail/mailfactory.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/libmail/mailfactory.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/unsupported/mail2/libmail/mailfactory.cpp b/noncore/unsupported/mail2/libmail/mailfactory.cpp
index 58cf5f8..427e72c 100644
--- a/noncore/unsupported/mail2/libmail/mailfactory.cpp
+++ b/noncore/unsupported/mail2/libmail/mailfactory.cpp
@@ -79,49 +79,49 @@ MailFactory::MailFactory(SendMail &smail, QWidget *parent)
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";
102 } else { 102 } else {
103 int ret = QMessageBox::critical(_parent, tr("Error"), tr("<p>Couldn't attach file '%1'. Continue anyway or abort?</p>"), tr("Continue"), tr("Abort")); 103 int ret = QMessageBox::critical(_parent, tr("Error"), tr("<p>Couldn't attach file '%1'. Continue anyway or abort?</p>").arg((*it).fileName()), tr("Continue"), tr("Abort"));
104 if (ret == 1) { 104 if (ret == 1) {
105 it = attachments.end(); 105 it = attachments.end();
106 _abort = true; 106 _abort = true;
107 } 107 }
108 } 108 }
109 } 109 }
110 _body += "\n--" + boundary + "--"; 110 _body += "\n--" + boundary + "--";
111 } 111 }
112 112
113 if (_abort) { 113 if (_abort) {
114 _body = QString(0); 114 _body = QString(0);
115 _header = QString(0); 115 _header = QString(0);
116 } 116 }
117} 117}
118 118
119// Unfinished GPG code. 119// Unfinished GPG code.
120/* 120/*
121void MailFactory::openPgpEncrypt(const QString &text, QString &header, QString &body) 121void MailFactory::openPgpEncrypt(const QString &text, QString &header, QString &body)
122{ 122{
123 QString boundary = MiscFunctions::uniqueString(); 123 QString boundary = MiscFunctions::uniqueString();
124 124
125 header += "Content-Type: multipart/encrypted; boundary=\"" + boundary + "\"; protocol=\"application/pgp-encrypted\"\n"; 125 header += "Content-Type: multipart/encrypted; boundary=\"" + boundary + "\"; protocol=\"application/pgp-encrypted\"\n";
126 126
127 body += "--" + boundary + "\n"; 127 body += "--" + boundary + "\n";