summaryrefslogtreecommitdiff
path: root/noncore/unsupported/mailit/writemail.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/mailit/writemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mailit/writemail.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp
index dcf0c6e..c75494e 100644
--- a/noncore/unsupported/mailit/writemail.cpp
+++ b/noncore/unsupported/mailit/writemail.cpp
@@ -19,14 +19,13 @@
19**********************************************************************/ 19**********************************************************************/
20#include <qmessagebox.h> 20#include <qmessagebox.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include "writemail.h" 22#include "writemail.h"
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24 24
25WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) 25WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl )
26 : QMainWindow( parent, name, fl )
27{ 26{
28 showingAddressList = FALSE; 27 showingAddressList = FALSE;
29 init(); 28 init();
30 29
31 addAtt = new AddAtt(0, "Add Attachments"); 30 addAtt = new AddAtt(0, "Add Attachments");
32} 31}
@@ -256,34 +255,40 @@ void WriteMail::reply(Email replyMail, bool replyAll)
256 mail = replyMail; 255 mail = replyMail;
257 mail.files.clear(); 256 mail.files.clear();
258 257
259 toInput->setText(mail.fromMail); 258 toInput->setText(mail.fromMail);
260 259
261 if (replyAll) 260 if (replyAll)
262 { 261 {
263 for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) 262 for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it)
264 { 263 {
265 ccRecipients.append(*it); 264 ccRecipients.append(*it);
266 ccRecipients.append(";"); 265 ccRecipients.append(";");
267 } 266 }
268 ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end 267 ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end
269 ccInput->setText(ccRecipients); 268 ccInput->setText(ccRecipients);
270 } 269 }
271 270 else ccInput->clear();
272 addRecipients(replyAll);
273 271
274 subjectInput->setText(tr("Re: ") + mail.subject); 272 subjectInput->setText(tr("Re: ") + mail.subject);
275 273
274 QString citation=mail.fromMail;
275 citation.append(tr(" wrote on "));
276 citation.append(mail.date);
277 citation.append(":\n");
278
279
280 //mail.body.insert(0,tr("On"));
276 pos = 0; 281 pos = 0;
277 mail.body.insert(pos, ">"); 282 mail.body.insert(pos, ">");
278 while (pos != -1) { 283 while (pos != -1) {
279 pos = mail.body.find('\n', pos); 284 pos = mail.body.find('\n', pos);
280 if (pos != -1) 285 if (pos != -1)
281 mail.body.insert(++pos, ">>"); 286 mail.body.insert(++pos, ">>");
282 } 287 }
283 288 mail.body.insert(0,citation);
284 emailInput->setText(mail.body); 289 emailInput->setText(mail.body);
285} 290}
286 291
287void WriteMail::forward(Email forwMail) 292void WriteMail::forward(Email forwMail)
288{ 293{
289 int pos=0; 294 int pos=0;
@@ -305,29 +310,36 @@ void WriteMail::forward(Email forwMail)
305 310
306bool WriteMail::getRecipients(bool ccField) 311bool WriteMail::getRecipients(bool ccField)
307{ 312{
308 QString str, temp; 313 QString str, temp;
309 int pos = 0; 314 int pos = 0;
310 315
311 mail.recipients.clear(); 316 if (ccField)
312 317 {
313 ccField ? temp = ccInput->text() : temp=toInput->text() ; 318 mail.carbonCopies.clear();
319 temp = ccInput->text();
320 }
321 else
322 {
323 mail.recipients.clear();
324 temp=toInput->text() ;
325 }
314 326
315 while ( (pos = temp.find(';')) != -1) { 327 while ( (pos = temp.find(';')) != -1) {
316 str = temp.left(pos).stripWhiteSpace(); 328 str = temp.left(pos).stripWhiteSpace();
317 temp = temp.right(temp.length() - (pos + 1)); 329 temp = temp.right(temp.length() - (pos + 1));
318 if ( str.find('@') == -1) 330 if ( str.find('@') == -1)
319 return false; 331 return false;
320 ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); 332 ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str);
321 addressList->addContact(str, ""); 333 //addressList->addContact(str, "");
322 } 334 }
323 temp = temp.stripWhiteSpace(); 335 temp = temp.stripWhiteSpace();
324 if ( temp.find('@') == -1) 336 if ( temp.find('@') == -1)
325 return false; 337 return false;
326 ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); 338 ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp);
327 addressList->addContact(temp, ""); 339 //addressList->addContact(temp, "");
328 340
329 return TRUE; 341 return TRUE;
330} 342}
331 343
332void WriteMail::addRecipients() 344void WriteMail::addRecipients()
333{ 345{
@@ -380,10 +392,11 @@ void WriteMail::setRecipient(const QString &recipient)
380 toInput->setText(recipient); 392 toInput->setText(recipient);
381} 393}
382 394
383void WriteMail::newMail() 395void WriteMail::newMail()
384{ 396{
385 toInput->clear(); 397 toInput->clear();
398 ccInput->clear();
386 subjectInput->clear(); 399 subjectInput->clear();
387 emailInput->clear(); 400 emailInput->clear();
388 setAddressList(addressList); 401 setAddressList(addressList);
389} 402}