summaryrefslogtreecommitdiff
authorgroucho <groucho>2003-05-07 06:55:30 (UTC)
committer groucho <groucho>2003-05-07 06:55:30 (UTC)
commit00894537decf01c5a5cdc565b2740b5e67a2e90f (patch) (unidiff)
tree159404aa880f36961247287cdb42c19e4c4ef29f
parenta3c1989c0563c0b16c5a6e722cd8484611622499 (diff)
downloadopie-00894537decf01c5a5cdc565b2740b5e67a2e90f.zip
opie-00894537decf01c5a5cdc565b2740b5e67a2e90f.tar.gz
opie-00894537decf01c5a5cdc565b2740b5e67a2e90f.tar.bz2
Smaller fix which shows attachment icons also for downloaded mails
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp6
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index 2cedc51..b039cc4 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -342,257 +342,261 @@ void EmailClient::getNewMail() {
342 Email *mailPtr; 342 Email *mailPtr;
343 item = (EmailListItem *) inboxView->firstChild(); 343 item = (EmailListItem *) inboxView->firstChild();
344 while (item != NULL) { 344 while (item != NULL) {
345 mailPtr = item->getMail(); 345 mailPtr = item->getMail();
346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { 346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) {
347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); 347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size);
348 } 348 }
349 item = (EmailListItem *) item->nextSibling(); 349 item = (EmailListItem *) item->nextSibling();
350 }*/ 350 }*/
351 351
352 emailHandler->getMailHeaders(); 352 emailHandler->getMailHeaders();
353 353
354} 354}
355 355
356void EmailClient::getAllNewMail() 356void EmailClient::getAllNewMail()
357{ 357{
358 allAccounts = TRUE; 358 allAccounts = TRUE;
359 currentAccount = accountList.first(); 359 currentAccount = accountList.first();
360 getNewMail(); 360 getNewMail();
361} 361}
362 362
363void EmailClient::mailArrived(const Email &mail, bool fromDisk) 363void EmailClient::mailArrived(const Email &mail, bool fromDisk)
364{ 364{
365 Enclosure *ePtr; 365 Enclosure *ePtr;
366 Email newMail; 366 Email newMail;
367 int thisMailId; 367 int thisMailId;
368 emailHandler->parse(mail.rawMail, lineShift, &newMail); 368 emailHandler->parse(mail.rawMail, lineShift, &newMail);
369 mailconf->setGroup(newMail.id); 369 mailconf->setGroup(newMail.id);
370 370
371 if (fromDisk) 371 if (fromDisk)
372 { 372 {
373 373
374 newMail.downloaded = mailconf->readBoolEntry("downloaded"); 374 newMail.downloaded = mailconf->readBoolEntry("downloaded");
375 newMail.size = mailconf->readNumEntry("size"); 375 newMail.size = mailconf->readNumEntry("size");
376 newMail.serverId = mailconf->readNumEntry("serverid"); 376 newMail.serverId = mailconf->readNumEntry("serverid");
377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); 377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid");
378 } 378 }
379 else 379 else
380 { //mail arrived from server 380 { //mail arrived from server
381 381
382 newMail.serverId = mail.serverId; 382 newMail.serverId = mail.serverId;
383 newMail.size = mail.size; 383 newMail.size = mail.size;
384 newMail.downloaded = mail.downloaded; 384 newMail.downloaded = mail.downloaded;
385 385
386 newMail.fromAccountId = emailHandler->getAccount()->id; 386 newMail.fromAccountId = emailHandler->getAccount()->id;
387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId); 387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId);
388 } 388 }
389 389
390 //add if read or not 390 //add if read or not
391 newMail.read = mailconf->readBoolEntry("mailread"); 391 newMail.read = mailconf->readBoolEntry("mailread");
392 392
393 //check if new mail 393 //check if new mail
394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { 394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) {
395 thisMailId = mailIdCount; 395 thisMailId = mailIdCount;
396 mailIdCount++; 396 mailIdCount++;
397 397
398 //set server count, so that if the user aborts, the new 398 //set server count, so that if the user aborts, the new
399 //header is not reloaded 399 //header is not reloaded
400 if ((currentAccount)&&(currentAccount->synchronize)) 400 if ((currentAccount)&&(currentAccount->synchronize))
401 currentAccount->lastServerMailCount++; 401 currentAccount->lastServerMailCount++;
402 402
403 mailconf->writeEntry("internalmailid", thisMailId); 403 mailconf->writeEntry("internalmailid", thisMailId);
404 mailconf->writeEntry("downloaded", newMail.downloaded); 404 mailconf->writeEntry("downloaded", newMail.downloaded);
405 mailconf->writeEntry("size", (int) newMail.size); 405 mailconf->writeEntry("size", (int) newMail.size);
406 mailconf->writeEntry("serverid", newMail.serverId); 406 mailconf->writeEntry("serverid", newMail.serverId);
407 407
408 //addressList->addContact(newMail.fromMail, newMail.from); 408 //addressList->addContact(newMail.fromMail, newMail.from);
409 } 409 }
410 410
411 mailconf->writeEntry("downloaded", newMail.downloaded); 411 mailconf->writeEntry("downloaded", newMail.downloaded);
412 412
413 QString stringMailId; 413 QString stringMailId;
414 stringMailId.setNum(thisMailId); 414 stringMailId.setNum(thisMailId);
415 //see if any attatchments needs to be stored 415 //see if any attatchments needs to be stored
416 416
417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { 417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) {
418 QString stringId; 418 QString stringId;
419 stringId.setNum(ePtr->id); 419 stringId.setNum(ePtr->id);
420 420
421 int id = mailconf->readNumEntry("enclosureid_" + stringId); 421 int id = mailconf->readNumEntry("enclosureid_" + stringId);
422 if (id != ePtr->id) { //new entry 422 if (id != ePtr->id) { //new entry
423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); 423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id);
424 mailconf->writeEntry("name_" + stringId, ePtr->originalName); 424 mailconf->writeEntry("name_" + stringId, ePtr->originalName);
425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType); 425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType);
426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute); 426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute);
427 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 427 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
428 mailconf->writeEntry("installed_" + stringId, FALSE); 428 mailconf->writeEntry("installed_" + stringId, FALSE);
429 429
430 ePtr->name = stringMailId + "_" + stringId; 430 ePtr->name = stringMailId + "_" + stringId;
431 ePtr->path = getPath(TRUE); 431 ePtr->path = getPath(TRUE);
432 if (emailHandler->getEnclosure(ePtr)) { //file saved 432 if (emailHandler->getEnclosure(ePtr)) { //file saved
433 ePtr->saved = TRUE; 433 ePtr->saved = TRUE;
434 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 434 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
435 mailconf->writeEntry("filename_" + stringId, ePtr->name); 435 mailconf->writeEntry("filename_" + stringId, ePtr->name);
436 mailconf->writeEntry("path_" + stringId, ePtr->path); 436 mailconf->writeEntry("path_" + stringId, ePtr->path);
437 } else { 437 } else {
438 ePtr->saved = FALSE; 438 ePtr->saved = FALSE;
439 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 439 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
440 } 440 }
441 } else { 441 } else {
442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); 442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId);
443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); 443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId);
444 if (ePtr->saved) { 444 if (ePtr->saved) {
445 ePtr->name = mailconf->readEntry("filename_" + stringId); 445 ePtr->name = mailconf->readEntry("filename_" + stringId);
446 ePtr->path = mailconf->readEntry("path_" + stringId); 446 ePtr->path = mailconf->readEntry("path_" + stringId);
447 } 447 }
448 } 448 }
449 } 449 }
450 450
451 bool found=false; 451 bool found=false;
452 452
453 if (!fromDisk) 453 if (!fromDisk)
454 { 454 {
455 455
456 Email *mailPtr; 456 Email *mailPtr;
457 item = (EmailListItem *) inboxView->firstChild(); 457 item = (EmailListItem *) inboxView->firstChild();
458 while ((item != NULL)&&(!found)) 458 while ((item != NULL)&&(!found))
459 { 459 {
460 mailPtr = item->getMail(); 460 mailPtr = item->getMail();
461 if (mailPtr->id == newMail.id) { 461 if (mailPtr->id == newMail.id) {
462 item->setMail(newMail); 462 item->setMail(newMail);
463 emit mailUpdated(item->getMail()); 463 emit mailUpdated(item->getMail());
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)) item = new EmailListItem(inboxView, newMail, TRUE); 469 if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE);
470 470
471 if (item->getMail()->files.count()>0)
472 {
473 item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
474 }
471 /*if (!newMail.downloaded) 475 /*if (!newMail.downloaded)
472 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ 476 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
473 477
474 mailboxView->setCurrentTab(0); 478 mailboxView->setCurrentTab(0);
475 479
476} 480}
477 481
478void EmailClient::allMailArrived(int count) 482void EmailClient::allMailArrived(int count)
479{ 483{
480 // not previewing means all mailtransfer has been done 484 // not previewing means all mailtransfer has been done
481 /*if (!previewingMail) {*/ 485 /*if (!previewingMail) {*/
482 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { 486 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
483 emit newCaption("Mailit - " + currentAccount->accountName); 487 emit newCaption("Mailit - " + currentAccount->accountName);
484 getNewMail(); 488 getNewMail();
485 return; 489 return;
486 } else { 490 } else {
487 allAccounts = FALSE; 491 allAccounts = FALSE;
488 receiving = FALSE; 492 receiving = FALSE;
489 getMailButton->setEnabled(TRUE); 493 getMailButton->setEnabled(TRUE);
490 cancelButton->setEnabled(FALSE); 494 cancelButton->setEnabled(FALSE);
491 selectAccountMenu->setEnabled(TRUE); 495 selectAccountMenu->setEnabled(TRUE);
492 status1Label->setText("Idle"); 496 status1Label->setText("Idle");
493 497
494 progressBar->reset(); 498 progressBar->reset();
495 return; 499 return;
496 } 500 }
497 //} 501 //}
498 502
499 // all headers downloaded from server, start downloading remaining mails 503 // all headers downloaded from server, start downloading remaining mails
500 previewingMail = FALSE; 504 previewingMail = FALSE;
501 status1Label->setText(currentAccount->accountName); 505 status1Label->setText(currentAccount->accountName);
502 progressBar->reset(); 506 progressBar->reset();
503 507
504 508
505 mailboxView->setCurrentTab(0); 509 mailboxView->setCurrentTab(0);
506} 510}
507 511
508 512
509void EmailClient::moveMailFront(Email *mailPtr) 513void EmailClient::moveMailFront(Email *mailPtr)
510{ 514{
511 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 515 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
512 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 516 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
513 } 517 }
514} 518}
515 519
516void EmailClient::smtpError(int code) 520void EmailClient::smtpError(int code)
517{ 521{
518 QString temp; 522 QString temp;
519 523
520 if (code == ErrUnknownResponse) 524 if (code == ErrUnknownResponse)
521 temp = "Unknown response from server"; 525 temp = "Unknown response from server";
522 526
523 if (code == QSocket::ErrHostNotFound) 527 if (code == QSocket::ErrHostNotFound)
524 temp = "host not found"; 528 temp = "host not found";
525 if (code == QSocket::ErrConnectionRefused) 529 if (code == QSocket::ErrConnectionRefused)
526 temp = "connection refused"; 530 temp = "connection refused";
527 if (code == QSocket::ErrSocketRead) 531 if (code == QSocket::ErrSocketRead)
528 temp = "socket packet error"; 532 temp = "socket packet error";
529 533
530 if (code != ErrCancel) { 534 if (code != ErrCancel) {
531 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n"); 535 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
532 } else { 536 } else {
533 status2Label->setText("Aborted by user"); 537 status2Label->setText("Aborted by user");
534 } 538 }
535 539
536 sending = FALSE; 540 sending = FALSE;
537 sendMailButton->setEnabled(TRUE); 541 sendMailButton->setEnabled(TRUE);
538 cancelButton->setEnabled(FALSE); 542 cancelButton->setEnabled(FALSE);
539 quedMessages.clear(); 543 quedMessages.clear();
540} 544}
541 545
542void EmailClient::popError(int code) 546void EmailClient::popError(int code)
543{ 547{
544 QString temp; 548 QString temp;
545 549
546 if (code == ErrUnknownResponse) 550 if (code == ErrUnknownResponse)
547 temp = "Unknown response from server"; 551 temp = "Unknown response from server";
548 if (code == ErrLoginFailed) 552 if (code == ErrLoginFailed)
549 temp = "Login failed\nCheck user name and password"; 553 temp = "Login failed\nCheck user name and password";
550 554
551 if (code == QSocket::ErrHostNotFound) 555 if (code == QSocket::ErrHostNotFound)
552 temp = "host not found"; 556 temp = "host not found";
553 if (code == QSocket::ErrConnectionRefused) 557 if (code == QSocket::ErrConnectionRefused)
554 temp = "connection refused"; 558 temp = "connection refused";
555 if (code == QSocket::ErrSocketRead) 559 if (code == QSocket::ErrSocketRead)
556 temp = "socket packet error"; 560 temp = "socket packet error";
557 561
558 if (code != ErrCancel) { 562 if (code != ErrCancel) {
559 QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n"); 563 QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n");
560 } else { 564 } else {
561 status2Label->setText("Aborted by user"); 565 status2Label->setText("Aborted by user");
562 } 566 }
563 567
564 receiving = FALSE; 568 receiving = FALSE;
565 getMailButton->setEnabled(TRUE); 569 getMailButton->setEnabled(TRUE);
566 cancelButton->setEnabled(FALSE); 570 cancelButton->setEnabled(FALSE);
567 selectAccountMenu->setEnabled(TRUE); 571 selectAccountMenu->setEnabled(TRUE);
568} 572}
569 573
570void EmailClient::inboxItemSelected() 574void EmailClient::inboxItemSelected()
571{ 575{
572 //killTimer(timerID); 576 //killTimer(timerID);
573 577
574 item = (EmailListItem*) inboxView->selectedItem(); 578 item = (EmailListItem*) inboxView->selectedItem();
575 if (item != NULL) { 579 if (item != NULL) {
576 emit viewEmail(inboxView, item->getMail()); 580 emit viewEmail(inboxView, item->getMail());
577 } 581 }
578} 582}
579 583
580void EmailClient::outboxItemSelected() 584void EmailClient::outboxItemSelected()
581{ 585{
582 //killTimer(timerID); 586 //killTimer(timerID);
583 587
584 item = (EmailListItem*) outboxView->selectedItem(); 588 item = (EmailListItem*) outboxView->selectedItem();
585 if (item != NULL) { 589 if (item != NULL) {
586 emit viewEmail(outboxView, item->getMail()); 590 emit viewEmail(outboxView, item->getMail());
587 } 591 }
588 592
589} 593}
590 594
591void EmailClient::readMail() 595void EmailClient::readMail()
592{ 596{
593 Email mail; 597 Email mail;
594 int start, stop; 598 int start, stop;
595 QString s, del; 599 QString s, del;
596 600
597 QFile f(getPath(FALSE) + "inbox.txt"); 601 QFile f(getPath(FALSE) + "inbox.txt");
598 602
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index 2cedc51..b039cc4 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -342,257 +342,261 @@ void EmailClient::getNewMail() {
342 Email *mailPtr; 342 Email *mailPtr;
343 item = (EmailListItem *) inboxView->firstChild(); 343 item = (EmailListItem *) inboxView->firstChild();
344 while (item != NULL) { 344 while (item != NULL) {
345 mailPtr = item->getMail(); 345 mailPtr = item->getMail();
346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { 346 if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) {
347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); 347 mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size);
348 } 348 }
349 item = (EmailListItem *) item->nextSibling(); 349 item = (EmailListItem *) item->nextSibling();
350 }*/ 350 }*/
351 351
352 emailHandler->getMailHeaders(); 352 emailHandler->getMailHeaders();
353 353
354} 354}
355 355
356void EmailClient::getAllNewMail() 356void EmailClient::getAllNewMail()
357{ 357{
358 allAccounts = TRUE; 358 allAccounts = TRUE;
359 currentAccount = accountList.first(); 359 currentAccount = accountList.first();
360 getNewMail(); 360 getNewMail();
361} 361}
362 362
363void EmailClient::mailArrived(const Email &mail, bool fromDisk) 363void EmailClient::mailArrived(const Email &mail, bool fromDisk)
364{ 364{
365 Enclosure *ePtr; 365 Enclosure *ePtr;
366 Email newMail; 366 Email newMail;
367 int thisMailId; 367 int thisMailId;
368 emailHandler->parse(mail.rawMail, lineShift, &newMail); 368 emailHandler->parse(mail.rawMail, lineShift, &newMail);
369 mailconf->setGroup(newMail.id); 369 mailconf->setGroup(newMail.id);
370 370
371 if (fromDisk) 371 if (fromDisk)
372 { 372 {
373 373
374 newMail.downloaded = mailconf->readBoolEntry("downloaded"); 374 newMail.downloaded = mailconf->readBoolEntry("downloaded");
375 newMail.size = mailconf->readNumEntry("size"); 375 newMail.size = mailconf->readNumEntry("size");
376 newMail.serverId = mailconf->readNumEntry("serverid"); 376 newMail.serverId = mailconf->readNumEntry("serverid");
377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); 377 newMail.fromAccountId = mailconf->readNumEntry("fromaccountid");
378 } 378 }
379 else 379 else
380 { //mail arrived from server 380 { //mail arrived from server
381 381
382 newMail.serverId = mail.serverId; 382 newMail.serverId = mail.serverId;
383 newMail.size = mail.size; 383 newMail.size = mail.size;
384 newMail.downloaded = mail.downloaded; 384 newMail.downloaded = mail.downloaded;
385 385
386 newMail.fromAccountId = emailHandler->getAccount()->id; 386 newMail.fromAccountId = emailHandler->getAccount()->id;
387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId); 387 mailconf->writeEntry("fromaccountid", newMail.fromAccountId);
388 } 388 }
389 389
390 //add if read or not 390 //add if read or not
391 newMail.read = mailconf->readBoolEntry("mailread"); 391 newMail.read = mailconf->readBoolEntry("mailread");
392 392
393 //check if new mail 393 //check if new mail
394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { 394 if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) {
395 thisMailId = mailIdCount; 395 thisMailId = mailIdCount;
396 mailIdCount++; 396 mailIdCount++;
397 397
398 //set server count, so that if the user aborts, the new 398 //set server count, so that if the user aborts, the new
399 //header is not reloaded 399 //header is not reloaded
400 if ((currentAccount)&&(currentAccount->synchronize)) 400 if ((currentAccount)&&(currentAccount->synchronize))
401 currentAccount->lastServerMailCount++; 401 currentAccount->lastServerMailCount++;
402 402
403 mailconf->writeEntry("internalmailid", thisMailId); 403 mailconf->writeEntry("internalmailid", thisMailId);
404 mailconf->writeEntry("downloaded", newMail.downloaded); 404 mailconf->writeEntry("downloaded", newMail.downloaded);
405 mailconf->writeEntry("size", (int) newMail.size); 405 mailconf->writeEntry("size", (int) newMail.size);
406 mailconf->writeEntry("serverid", newMail.serverId); 406 mailconf->writeEntry("serverid", newMail.serverId);
407 407
408 //addressList->addContact(newMail.fromMail, newMail.from); 408 //addressList->addContact(newMail.fromMail, newMail.from);
409 } 409 }
410 410
411 mailconf->writeEntry("downloaded", newMail.downloaded); 411 mailconf->writeEntry("downloaded", newMail.downloaded);
412 412
413 QString stringMailId; 413 QString stringMailId;
414 stringMailId.setNum(thisMailId); 414 stringMailId.setNum(thisMailId);
415 //see if any attatchments needs to be stored 415 //see if any attatchments needs to be stored
416 416
417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) { 417 for ( ePtr=newMail.files.first(); ePtr != 0; ePtr=newMail.files.next() ) {
418 QString stringId; 418 QString stringId;
419 stringId.setNum(ePtr->id); 419 stringId.setNum(ePtr->id);
420 420
421 int id = mailconf->readNumEntry("enclosureid_" + stringId); 421 int id = mailconf->readNumEntry("enclosureid_" + stringId);
422 if (id != ePtr->id) { //new entry 422 if (id != ePtr->id) { //new entry
423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id); 423 mailconf->writeEntry("enclosureid_" + stringId, ePtr->id);
424 mailconf->writeEntry("name_" + stringId, ePtr->originalName); 424 mailconf->writeEntry("name_" + stringId, ePtr->originalName);
425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType); 425 mailconf->writeEntry("contenttype_" + stringId, ePtr->contentType);
426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute); 426 mailconf->writeEntry("contentattribute_" + stringId, ePtr->contentAttribute);
427 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 427 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
428 mailconf->writeEntry("installed_" + stringId, FALSE); 428 mailconf->writeEntry("installed_" + stringId, FALSE);
429 429
430 ePtr->name = stringMailId + "_" + stringId; 430 ePtr->name = stringMailId + "_" + stringId;
431 ePtr->path = getPath(TRUE); 431 ePtr->path = getPath(TRUE);
432 if (emailHandler->getEnclosure(ePtr)) { //file saved 432 if (emailHandler->getEnclosure(ePtr)) { //file saved
433 ePtr->saved = TRUE; 433 ePtr->saved = TRUE;
434 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 434 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
435 mailconf->writeEntry("filename_" + stringId, ePtr->name); 435 mailconf->writeEntry("filename_" + stringId, ePtr->name);
436 mailconf->writeEntry("path_" + stringId, ePtr->path); 436 mailconf->writeEntry("path_" + stringId, ePtr->path);
437 } else { 437 } else {
438 ePtr->saved = FALSE; 438 ePtr->saved = FALSE;
439 mailconf->writeEntry("saved_" + stringId, ePtr->saved); 439 mailconf->writeEntry("saved_" + stringId, ePtr->saved);
440 } 440 }
441 } else { 441 } else {
442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId); 442 ePtr->saved = mailconf->readBoolEntry("saved_" + stringId);
443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId); 443 ePtr->installed = mailconf->readBoolEntry("installed_" + stringId);
444 if (ePtr->saved) { 444 if (ePtr->saved) {
445 ePtr->name = mailconf->readEntry("filename_" + stringId); 445 ePtr->name = mailconf->readEntry("filename_" + stringId);
446 ePtr->path = mailconf->readEntry("path_" + stringId); 446 ePtr->path = mailconf->readEntry("path_" + stringId);
447 } 447 }
448 } 448 }
449 } 449 }
450 450
451 bool found=false; 451 bool found=false;
452 452
453 if (!fromDisk) 453 if (!fromDisk)
454 { 454 {
455 455
456 Email *mailPtr; 456 Email *mailPtr;
457 item = (EmailListItem *) inboxView->firstChild(); 457 item = (EmailListItem *) inboxView->firstChild();
458 while ((item != NULL)&&(!found)) 458 while ((item != NULL)&&(!found))
459 { 459 {
460 mailPtr = item->getMail(); 460 mailPtr = item->getMail();
461 if (mailPtr->id == newMail.id) { 461 if (mailPtr->id == newMail.id) {
462 item->setMail(newMail); 462 item->setMail(newMail);
463 emit mailUpdated(item->getMail()); 463 emit mailUpdated(item->getMail());
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)) item = new EmailListItem(inboxView, newMail, TRUE); 469 if ((!found)||(fromDisk)) item = new EmailListItem(inboxView, newMail, TRUE);
470 470
471 if (item->getMail()->files.count()>0)
472 {
473 item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
474 }
471 /*if (!newMail.downloaded) 475 /*if (!newMail.downloaded)
472 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ 476 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
473 477
474 mailboxView->setCurrentTab(0); 478 mailboxView->setCurrentTab(0);
475 479
476} 480}
477 481
478void EmailClient::allMailArrived(int count) 482void EmailClient::allMailArrived(int count)
479{ 483{
480 // not previewing means all mailtransfer has been done 484 // not previewing means all mailtransfer has been done
481 /*if (!previewingMail) {*/ 485 /*if (!previewingMail) {*/
482 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { 486 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
483 emit newCaption("Mailit - " + currentAccount->accountName); 487 emit newCaption("Mailit - " + currentAccount->accountName);
484 getNewMail(); 488 getNewMail();
485 return; 489 return;
486 } else { 490 } else {
487 allAccounts = FALSE; 491 allAccounts = FALSE;
488 receiving = FALSE; 492 receiving = FALSE;
489 getMailButton->setEnabled(TRUE); 493 getMailButton->setEnabled(TRUE);
490 cancelButton->setEnabled(FALSE); 494 cancelButton->setEnabled(FALSE);
491 selectAccountMenu->setEnabled(TRUE); 495 selectAccountMenu->setEnabled(TRUE);
492 status1Label->setText("Idle"); 496 status1Label->setText("Idle");
493 497
494 progressBar->reset(); 498 progressBar->reset();
495 return; 499 return;
496 } 500 }
497 //} 501 //}
498 502
499 // all headers downloaded from server, start downloading remaining mails 503 // all headers downloaded from server, start downloading remaining mails
500 previewingMail = FALSE; 504 previewingMail = FALSE;
501 status1Label->setText(currentAccount->accountName); 505 status1Label->setText(currentAccount->accountName);
502 progressBar->reset(); 506 progressBar->reset();
503 507
504 508
505 mailboxView->setCurrentTab(0); 509 mailboxView->setCurrentTab(0);
506} 510}
507 511
508 512
509void EmailClient::moveMailFront(Email *mailPtr) 513void EmailClient::moveMailFront(Email *mailPtr)
510{ 514{
511 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 515 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
512 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 516 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
513 } 517 }
514} 518}
515 519
516void EmailClient::smtpError(int code) 520void EmailClient::smtpError(int code)
517{ 521{
518 QString temp; 522 QString temp;
519 523
520 if (code == ErrUnknownResponse) 524 if (code == ErrUnknownResponse)
521 temp = "Unknown response from server"; 525 temp = "Unknown response from server";
522 526
523 if (code == QSocket::ErrHostNotFound) 527 if (code == QSocket::ErrHostNotFound)
524 temp = "host not found"; 528 temp = "host not found";
525 if (code == QSocket::ErrConnectionRefused) 529 if (code == QSocket::ErrConnectionRefused)
526 temp = "connection refused"; 530 temp = "connection refused";
527 if (code == QSocket::ErrSocketRead) 531 if (code == QSocket::ErrSocketRead)
528 temp = "socket packet error"; 532 temp = "socket packet error";
529 533
530 if (code != ErrCancel) { 534 if (code != ErrCancel) {
531 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n"); 535 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
532 } else { 536 } else {
533 status2Label->setText("Aborted by user"); 537 status2Label->setText("Aborted by user");
534 } 538 }
535 539
536 sending = FALSE; 540 sending = FALSE;
537 sendMailButton->setEnabled(TRUE); 541 sendMailButton->setEnabled(TRUE);
538 cancelButton->setEnabled(FALSE); 542 cancelButton->setEnabled(FALSE);
539 quedMessages.clear(); 543 quedMessages.clear();
540} 544}
541 545
542void EmailClient::popError(int code) 546void EmailClient::popError(int code)
543{ 547{
544 QString temp; 548 QString temp;
545 549
546 if (code == ErrUnknownResponse) 550 if (code == ErrUnknownResponse)
547 temp = "Unknown response from server"; 551 temp = "Unknown response from server";
548 if (code == ErrLoginFailed) 552 if (code == ErrLoginFailed)
549 temp = "Login failed\nCheck user name and password"; 553 temp = "Login failed\nCheck user name and password";
550 554
551 if (code == QSocket::ErrHostNotFound) 555 if (code == QSocket::ErrHostNotFound)
552 temp = "host not found"; 556 temp = "host not found";
553 if (code == QSocket::ErrConnectionRefused) 557 if (code == QSocket::ErrConnectionRefused)
554 temp = "connection refused"; 558 temp = "connection refused";
555 if (code == QSocket::ErrSocketRead) 559 if (code == QSocket::ErrSocketRead)
556 temp = "socket packet error"; 560 temp = "socket packet error";
557 561
558 if (code != ErrCancel) { 562 if (code != ErrCancel) {
559 QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n"); 563 QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n");
560 } else { 564 } else {
561 status2Label->setText("Aborted by user"); 565 status2Label->setText("Aborted by user");
562 } 566 }
563 567
564 receiving = FALSE; 568 receiving = FALSE;
565 getMailButton->setEnabled(TRUE); 569 getMailButton->setEnabled(TRUE);
566 cancelButton->setEnabled(FALSE); 570 cancelButton->setEnabled(FALSE);
567 selectAccountMenu->setEnabled(TRUE); 571 selectAccountMenu->setEnabled(TRUE);
568} 572}
569 573
570void EmailClient::inboxItemSelected() 574void EmailClient::inboxItemSelected()
571{ 575{
572 //killTimer(timerID); 576 //killTimer(timerID);
573 577
574 item = (EmailListItem*) inboxView->selectedItem(); 578 item = (EmailListItem*) inboxView->selectedItem();
575 if (item != NULL) { 579 if (item != NULL) {
576 emit viewEmail(inboxView, item->getMail()); 580 emit viewEmail(inboxView, item->getMail());
577 } 581 }
578} 582}
579 583
580void EmailClient::outboxItemSelected() 584void EmailClient::outboxItemSelected()
581{ 585{
582 //killTimer(timerID); 586 //killTimer(timerID);
583 587
584 item = (EmailListItem*) outboxView->selectedItem(); 588 item = (EmailListItem*) outboxView->selectedItem();
585 if (item != NULL) { 589 if (item != NULL) {
586 emit viewEmail(outboxView, item->getMail()); 590 emit viewEmail(outboxView, item->getMail());
587 } 591 }
588 592
589} 593}
590 594
591void EmailClient::readMail() 595void EmailClient::readMail()
592{ 596{
593 Email mail; 597 Email mail;
594 int start, stop; 598 int start, stop;
595 QString s, del; 599 QString s, del;
596 600
597 QFile f(getPath(FALSE) + "inbox.txt"); 601 QFile f(getPath(FALSE) + "inbox.txt");
598 602