-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.cpp | 22 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 22 |
6 files changed, 42 insertions, 34 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 2102ba7..da1226c 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -464,20 +464,20 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
464 | found = true; | 464 | found = true; |
465 | } | 465 | } |
466 | item = (EmailListItem *) item->nextSibling(); | 466 | item = (EmailListItem *) item->nextSibling(); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | if ((!found)||(fromDisk)) { | 469 | if ((!found)||(fromDisk)) { |
470 | item = new EmailListItem(inboxView, newMail, TRUE); | 470 | item = new EmailListItem(inboxView, newMail, TRUE); |
471 | } | 471 | } |
472 | if (item->getMail()->files.count()>0) | 472 | // if (item->getMail()->files.count()>0) |
473 | { | 473 | // { |
474 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); | 474 | // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); |
475 | } | 475 | // } |
476 | /*if (!newMail.downloaded) | 476 | /*if (!newMail.downloaded) |
477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | 477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ |
478 | 478 | ||
479 | mailboxView->setCurrentTab(0); | 479 | mailboxView->setCurrentTab(0); |
480 | 480 | ||
481 | } | 481 | } |
482 | 482 | ||
483 | void EmailClient::allMailArrived(int count) | 483 | void EmailClient::allMailArrived(int count) |
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index 59ccd90..39f693d 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -170,18 +170,20 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
170 | 170 | ||
171 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" | 171 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" |
172 | pos = in.find(delimiter, 0, FALSE); | 172 | pos = in.find(delimiter, 0, FALSE); |
173 | header = in.left(pos); | 173 | header = in.left(pos); |
174 | body = in.right(in.length() - pos - delimiter.length()); | 174 | body = in.right(in.length() - pos - delimiter.length()); |
175 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) | 175 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) |
176 | body.truncate(body.length()-2); | 176 | body.truncate(body.length()-2); |
177 | 177 | ||
178 | TextParser p(header, lineShift); | 178 | // TextParser p(header, lineShift); |
179 | 179 | TextParser * lp = new TextParser(header, lineShift); | |
180 | #define p (*lp) | ||
181 | |||
180 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { | 182 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { |
181 | pos++; | 183 | pos++; |
182 | if (p.separatorAt(pos) == ' ') { | 184 | if (p.separatorAt(pos) == ' ') { |
183 | mail->from = p.getString(&pos, '<', false); | 185 | mail->from = p.getString(&pos, '<', false); |
184 | mail->from = mail->from.stripWhiteSpace(); | 186 | mail->from = mail->from.stripWhiteSpace(); |
185 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 187 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
186 | mail->from = mail->from.left(mail->from.length() - 1); | 188 | mail->from = mail->from.left(mail->from.length() - 1); |
187 | mail->from = mail->from.right(mail->from.length() - 1); | 189 | mail->from = mail->from.right(mail->from.length() - 1); |
@@ -265,16 +267,17 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
265 | boundary = boundary.right(boundary.length() - 1); //strip " | 267 | boundary = boundary.right(boundary.length() - 1); //strip " |
266 | } | 268 | } |
267 | boundary = "--" + boundary; //create boundary field | 269 | boundary = "--" + boundary; //create boundary field |
268 | } | 270 | } |
269 | 271 | ||
270 | if (boundary == "") { //fooled by Mime-Version | 272 | if (boundary == "") { //fooled by Mime-Version |
271 | mail->body = body; | 273 | mail->body = body; |
272 | mail->bodyPlain = body; | 274 | mail->bodyPlain = body; |
275 | delete lp; | ||
273 | return mail; | 276 | return mail; |
274 | } | 277 | } |
275 | 278 | ||
276 | while (body.length() > 0) { | 279 | while (body.length() > 0) { |
277 | pos = body.find(boundary, 0, FALSE); | 280 | pos = body.find(boundary, 0, FALSE); |
278 | pos = body.find(delimiter, pos, FALSE); | 281 | pos = body.find(delimiter, pos, FALSE); |
279 | mimeHeader = body.left(pos); | 282 | mimeHeader = body.left(pos); |
280 | mimeBody = body.right(body.length() - pos - delimiter.length()); | 283 | mimeBody = body.right(body.length() - pos - delimiter.length()); |
@@ -333,16 +336,17 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
333 | mail->body = mimeBody; | 336 | mail->body = mimeBody; |
334 | } | 337 | } |
335 | } | 338 | } |
336 | } | 339 | } |
337 | } else { | 340 | } else { |
338 | mail->bodyPlain = body; | 341 | mail->bodyPlain = body; |
339 | mail->body = body; | 342 | mail->body = body; |
340 | } | 343 | } |
344 | delete lp; | ||
341 | return TRUE; | 345 | return TRUE; |
342 | } | 346 | } |
343 | 347 | ||
344 | bool EmailHandler::getEnclosure(Enclosure *ePtr) | 348 | bool EmailHandler::getEnclosure(Enclosure *ePtr) |
345 | { | 349 | { |
346 | QFile f(ePtr->path + ePtr->name); | 350 | QFile f(ePtr->path + ePtr->name); |
347 | char src[4]; | 351 | char src[4]; |
348 | char *destPtr; | 352 | char *destPtr; |
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp index a111241..f945a0f 100644 --- a/noncore/net/mailit/mailitwindow.cpp +++ b/noncore/net/mailit/mailitwindow.cpp | |||
@@ -117,35 +117,35 @@ void MailItWindow::viewMail(QListView *view, Email *mail) | |||
117 | { | 117 | { |
118 | viewingMail = TRUE; | 118 | viewingMail = TRUE; |
119 | emailClient->hide(); | 119 | emailClient->hide(); |
120 | 120 | ||
121 | int result=0; | 121 | int result=0; |
122 | 122 | ||
123 | if ((mail->received)&&(!mail->downloaded)) | 123 | if ((mail->received)&&(!mail->downloaded)) |
124 | { | 124 | { |
125 | QMessageBox mb( tr("Mail not downloaded"), | 125 | QMessageBox mb( tr("Mail not downloaded"), |
126 | tr("The mail you have clicked \n" | 126 | tr("The mail you have clicked \n" |
127 | "has not been downloaded yet.\n " | 127 | "has not been downloaded yet.\n " |
128 | "Would you like to do it now ?"), | 128 | "Would you like to do it now ?"), |
129 | QMessageBox::Information, | 129 | QMessageBox::Information, |
130 | QMessageBox::Yes | QMessageBox::Default, | 130 | QMessageBox::Yes | QMessageBox::Default, |
131 | QMessageBox::No | QMessageBox::Escape,0 ); | 131 | QMessageBox::No | QMessageBox::Escape,0 ); |
132 | 132 | ||
133 | result=mb.exec(); | 133 | result=mb.exec(); |
134 | 134 | ||
135 | if (result==QMessageBox::Yes) | 135 | if (result==QMessageBox::Yes) |
136 | { | 136 | { |
137 | emailClient->download(mail); | 137 | emailClient->download(mail); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | readMail->update(view, mail); | 141 | readMail->update(view, mail); |
142 | views->raiseWidget(readMail); | 142 | views->raiseWidget(readMail); |
143 | setCaption( tr( "Examine mail" ) ); | 143 | setCaption( tr( "Read Mail" ) ); |
144 | } | 144 | } |
145 | 145 | ||
146 | void MailItWindow::updateMailView(Email *mail) | 146 | void MailItWindow::updateMailView(Email *mail) |
147 | { | 147 | { |
148 | if (viewingMail) { | 148 | if (viewingMail) { |
149 | readMail->mailUpdated(mail); | 149 | readMail->mailUpdated(mail); |
150 | } | 150 | } |
151 | } | 151 | } |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 2102ba7..da1226c 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -464,20 +464,20 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
464 | found = true; | 464 | found = true; |
465 | } | 465 | } |
466 | item = (EmailListItem *) item->nextSibling(); | 466 | item = (EmailListItem *) item->nextSibling(); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | if ((!found)||(fromDisk)) { | 469 | if ((!found)||(fromDisk)) { |
470 | item = new EmailListItem(inboxView, newMail, TRUE); | 470 | item = new EmailListItem(inboxView, newMail, TRUE); |
471 | } | 471 | } |
472 | if (item->getMail()->files.count()>0) | 472 | // if (item->getMail()->files.count()>0) |
473 | { | 473 | // { |
474 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); | 474 | // item->setPixmap(0, Resource::loadPixmap("mailit/attach")); |
475 | } | 475 | // } |
476 | /*if (!newMail.downloaded) | 476 | /*if (!newMail.downloaded) |
477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | 477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ |
478 | 478 | ||
479 | mailboxView->setCurrentTab(0); | 479 | mailboxView->setCurrentTab(0); |
480 | 480 | ||
481 | } | 481 | } |
482 | 482 | ||
483 | void EmailClient::allMailArrived(int count) | 483 | void EmailClient::allMailArrived(int count) |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index 59ccd90..39f693d 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -170,18 +170,20 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
170 | 170 | ||
171 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" | 171 | delimiter = lineShift + lineShift; // "\n\n" or "\r\n\r\n" |
172 | pos = in.find(delimiter, 0, FALSE); | 172 | pos = in.find(delimiter, 0, FALSE); |
173 | header = in.left(pos); | 173 | header = in.left(pos); |
174 | body = in.right(in.length() - pos - delimiter.length()); | 174 | body = in.right(in.length() - pos - delimiter.length()); |
175 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) | 175 | if ((body.at(body.length()-2) == '.') && (body.at(body.length()-3) == '\n')) |
176 | body.truncate(body.length()-2); | 176 | body.truncate(body.length()-2); |
177 | 177 | ||
178 | TextParser p(header, lineShift); | 178 | // TextParser p(header, lineShift); |
179 | 179 | TextParser * lp = new TextParser(header, lineShift); | |
180 | #define p (*lp) | ||
181 | |||
180 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { | 182 | if ((pos = p.find("FROM",':', 0, TRUE)) != -1) { |
181 | pos++; | 183 | pos++; |
182 | if (p.separatorAt(pos) == ' ') { | 184 | if (p.separatorAt(pos) == ' ') { |
183 | mail->from = p.getString(&pos, '<', false); | 185 | mail->from = p.getString(&pos, '<', false); |
184 | mail->from = mail->from.stripWhiteSpace(); | 186 | mail->from = mail->from.stripWhiteSpace(); |
185 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { | 187 | if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { |
186 | mail->from = mail->from.left(mail->from.length() - 1); | 188 | mail->from = mail->from.left(mail->from.length() - 1); |
187 | mail->from = mail->from.right(mail->from.length() - 1); | 189 | mail->from = mail->from.right(mail->from.length() - 1); |
@@ -265,16 +267,17 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
265 | boundary = boundary.right(boundary.length() - 1); //strip " | 267 | boundary = boundary.right(boundary.length() - 1); //strip " |
266 | } | 268 | } |
267 | boundary = "--" + boundary; //create boundary field | 269 | boundary = "--" + boundary; //create boundary field |
268 | } | 270 | } |
269 | 271 | ||
270 | if (boundary == "") { //fooled by Mime-Version | 272 | if (boundary == "") { //fooled by Mime-Version |
271 | mail->body = body; | 273 | mail->body = body; |
272 | mail->bodyPlain = body; | 274 | mail->bodyPlain = body; |
275 | delete lp; | ||
273 | return mail; | 276 | return mail; |
274 | } | 277 | } |
275 | 278 | ||
276 | while (body.length() > 0) { | 279 | while (body.length() > 0) { |
277 | pos = body.find(boundary, 0, FALSE); | 280 | pos = body.find(boundary, 0, FALSE); |
278 | pos = body.find(delimiter, pos, FALSE); | 281 | pos = body.find(delimiter, pos, FALSE); |
279 | mimeHeader = body.left(pos); | 282 | mimeHeader = body.left(pos); |
280 | mimeBody = body.right(body.length() - pos - delimiter.length()); | 283 | mimeBody = body.right(body.length() - pos - delimiter.length()); |
@@ -333,16 +336,17 @@ bool EmailHandler::parse(const QString &in, const QString &lineShift, Email *mai | |||
333 | mail->body = mimeBody; | 336 | mail->body = mimeBody; |
334 | } | 337 | } |
335 | } | 338 | } |
336 | } | 339 | } |
337 | } else { | 340 | } else { |
338 | mail->bodyPlain = body; | 341 | mail->bodyPlain = body; |
339 | mail->body = body; | 342 | mail->body = body; |
340 | } | 343 | } |
344 | delete lp; | ||
341 | return TRUE; | 345 | return TRUE; |
342 | } | 346 | } |
343 | 347 | ||
344 | bool EmailHandler::getEnclosure(Enclosure *ePtr) | 348 | bool EmailHandler::getEnclosure(Enclosure *ePtr) |
345 | { | 349 | { |
346 | QFile f(ePtr->path + ePtr->name); | 350 | QFile f(ePtr->path + ePtr->name); |
347 | char src[4]; | 351 | char src[4]; |
348 | char *destPtr; | 352 | char *destPtr; |
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index a111241..f945a0f 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp | |||
@@ -117,35 +117,35 @@ void MailItWindow::viewMail(QListView *view, Email *mail) | |||
117 | { | 117 | { |
118 | viewingMail = TRUE; | 118 | viewingMail = TRUE; |
119 | emailClient->hide(); | 119 | emailClient->hide(); |
120 | 120 | ||
121 | int result=0; | 121 | int result=0; |
122 | 122 | ||
123 | if ((mail->received)&&(!mail->downloaded)) | 123 | if ((mail->received)&&(!mail->downloaded)) |
124 | { | 124 | { |
125 | QMessageBox mb( tr("Mail not downloaded"), | 125 | QMessageBox mb( tr("Mail not downloaded"), |
126 | tr("The mail you have clicked \n" | 126 | tr("The mail you have clicked \n" |
127 | "has not been downloaded yet.\n " | 127 | "has not been downloaded yet.\n " |
128 | "Would you like to do it now ?"), | 128 | "Would you like to do it now ?"), |
129 | QMessageBox::Information, | 129 | QMessageBox::Information, |
130 | QMessageBox::Yes | QMessageBox::Default, | 130 | QMessageBox::Yes | QMessageBox::Default, |
131 | QMessageBox::No | QMessageBox::Escape,0 ); | 131 | QMessageBox::No | QMessageBox::Escape,0 ); |
132 | 132 | ||
133 | result=mb.exec(); | 133 | result=mb.exec(); |
134 | 134 | ||
135 | if (result==QMessageBox::Yes) | 135 | if (result==QMessageBox::Yes) |
136 | { | 136 | { |
137 | emailClient->download(mail); | 137 | emailClient->download(mail); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | readMail->update(view, mail); | 141 | readMail->update(view, mail); |
142 | views->raiseWidget(readMail); | 142 | views->raiseWidget(readMail); |
143 | setCaption( tr( "Examine mail" ) ); | 143 | setCaption( tr( "Read Mail" ) ); |
144 | } | 144 | } |
145 | 145 | ||
146 | void MailItWindow::updateMailView(Email *mail) | 146 | void MailItWindow::updateMailView(Email *mail) |
147 | { | 147 | { |
148 | if (viewingMail) { | 148 | if (viewingMail) { |
149 | readMail->mailUpdated(mail); | 149 | readMail->mailUpdated(mail); |
150 | } | 150 | } |
151 | } | 151 | } |