Diffstat (limited to 'noncore/unsupported/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 75 |
1 files changed, 31 insertions, 44 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 23059cf..dff1888 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -353,25 +353,25 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
353 | { | 353 | { |
354 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 354 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
355 | newMail.size = mailconf->readNumEntry("size"); | 355 | newMail.size = mailconf->readNumEntry("size"); |
356 | newMail.serverId = mailconf->readNumEntry("serverid"); | 356 | newMail.serverId = mailconf->readNumEntry("serverid"); |
357 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 357 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
358 | } | 358 | } |
359 | else | 359 | else |
360 | { //mail arrived from server | 360 | { //mail arrived from server |
361 | newMail.serverId = mail.serverId; | 361 | newMail.serverId = mail.serverId; |
362 | newMail.size = mail.size; | 362 | newMail.size = mail.size; |
363 | newMail.downloaded = mail.downloaded; | 363 | newMail.downloaded = mail.downloaded; |
364 | 364 | ||
365 | newMail.fromAccountId = currentAccount->id; | 365 | newMail.fromAccountId = emailHandler->getAccount()->id; |
366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
367 | } | 367 | } |
368 | 368 | ||
369 | //add if read or not | 369 | //add if read or not |
370 | newMail.read = mailconf->readBoolEntry("mailread"); | 370 | newMail.read = mailconf->readBoolEntry("mailread"); |
371 | 371 | ||
372 | //check if new mail | 372 | //check if new mail |
373 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { | 373 | if ( (thisMailId = mailconf->readNumEntry("internalmailid", -1)) == -1) { |
374 | thisMailId = mailIdCount; | 374 | thisMailId = mailIdCount; |
375 | mailIdCount++; | 375 | mailIdCount++; |
376 | 376 | ||
377 | //set server count, so that if the user aborts, the new | 377 | //set server count, so that if the user aborts, the new |
@@ -471,29 +471,29 @@ void EmailClient::allMailArrived(int count) | |||
471 | status1Label->setText("Idle"); | 471 | status1Label->setText("Idle"); |
472 | 472 | ||
473 | progressBar->reset(); | 473 | progressBar->reset(); |
474 | return; | 474 | return; |
475 | } | 475 | } |
476 | //} | 476 | //} |
477 | 477 | ||
478 | // all headers downloaded from server, start downloading remaining mails | 478 | // all headers downloaded from server, start downloading remaining mails |
479 | previewingMail = FALSE; | 479 | previewingMail = FALSE; |
480 | status1Label->setText(currentAccount->accountName); | 480 | status1Label->setText(currentAccount->accountName); |
481 | progressBar->reset(); | 481 | progressBar->reset(); |
482 | 482 | ||
483 | //emailHandler->getMailByList(&mailDownloadList); | 483 | |
484 | |||
485 | mailboxView->setCurrentTab(0); | 484 | mailboxView->setCurrentTab(0); |
486 | } | 485 | } |
487 | 486 | ||
487 | |||
488 | void EmailClient::moveMailFront(Email *mailPtr) | 488 | void EmailClient::moveMailFront(Email *mailPtr) |
489 | { | 489 | { |
490 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { | 490 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { |
491 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); | 491 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); |
492 | } | 492 | } |
493 | } | 493 | } |
494 | 494 | ||
495 | void EmailClient::smtpError(int code) | 495 | void EmailClient::smtpError(int code) |
496 | { | 496 | { |
497 | QString temp; | 497 | QString temp; |
498 | 498 | ||
499 | if (code == ErrUnknownResponse) | 499 | if (code == ErrUnknownResponse) |
@@ -655,25 +655,25 @@ QString EmailClient::getPath(bool enclosurePath) | |||
655 | 655 | ||
656 | if ( !dir.exists() ) | 656 | if ( !dir.exists() ) |
657 | dir.mkdir( dir.path() ); | 657 | dir.mkdir( dir.path() ); |
658 | 658 | ||
659 | return (dir.path() + "/"); | 659 | return (dir.path() + "/"); |
660 | 660 | ||
661 | } | 661 | } |
662 | return (dir.path() + "/"); | 662 | return (dir.path() + "/"); |
663 | } | 663 | } |
664 | 664 | ||
665 | void EmailClient::readSettings() | 665 | void EmailClient::readSettings() |
666 | { | 666 | { |
667 | int y,acc_count, accountPos=0; | 667 | int y,acc_count; |
668 | 668 | ||
669 | mailconf->setGroup("mailitglobal"); | 669 | mailconf->setGroup("mailitglobal"); |
670 | acc_count=mailconf->readNumEntry("Accounts",0); | 670 | acc_count=mailconf->readNumEntry("Accounts",0); |
671 | 671 | ||
672 | for (int accountPos = 0;accountPos<acc_count ; accountPos++) | 672 | for (int accountPos = 0;accountPos<acc_count ; accountPos++) |
673 | { | 673 | { |
674 | mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... | 674 | mailconf->setGroup("Account_"+QString::number(accountPos+1)); //Account numbers start at 1 ... |
675 | account.accountName = mailconf->readEntry("AccName",""); | 675 | account.accountName = mailconf->readEntry("AccName",""); |
676 | account.name = mailconf->readEntry("UserName",""); | 676 | account.name = mailconf->readEntry("UserName",""); |
677 | account.emailAddress = mailconf->readEntry("Email",""); | 677 | account.emailAddress = mailconf->readEntry("Email",""); |
678 | account.popUserName = mailconf->readEntry("POPUser",""); | 678 | account.popUserName = mailconf->readEntry("POPUser",""); |
679 | account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); | 679 | account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); |
@@ -882,31 +882,39 @@ void EmailClient::setDownloadedSize(int size) | |||
882 | int total = progressBar->totalSteps(); | 882 | int total = progressBar->totalSteps(); |
883 | 883 | ||
884 | if (size < total) { | 884 | if (size < total) { |
885 | progressBar->setProgress(size); | 885 | progressBar->setProgress(size); |
886 | } else { | 886 | } else { |
887 | progressBar->setProgress(total); | 887 | progressBar->setProgress(total); |
888 | } | 888 | } |
889 | } | 889 | } |
890 | 890 | ||
891 | void EmailClient::deleteItem() | 891 | void EmailClient::deleteItem() |
892 | { | 892 | { |
893 | bool inbox=mailboxView->currentTab()==0; | 893 | bool inbox=mailboxView->currentTab()==0; |
894 | QListView* box; | ||
894 | 895 | ||
895 | EmailListItem* eli; | 896 | EmailListItem* eli; |
897 | int pos; | ||
898 | |||
899 | inbox ? box=inboxView : box=outboxView; | ||
896 | 900 | ||
897 | inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); | 901 | eli=(EmailListItem*)box->selectedItem(); |
898 | 902 | ||
899 | if (eli) | 903 | if (eli) |
900 | deleteMail(eli,(bool&)inbox); | 904 | { |
905 | box->setSelected(eli->itemBelow(),true);//select the previous item | ||
906 | |||
907 | deleteMail(eli,(bool&)inbox); //remove mail entry | ||
908 | } | ||
901 | } | 909 | } |
902 | 910 | ||
903 | void EmailClient::inboxItemPressed() | 911 | void EmailClient::inboxItemPressed() |
904 | { | 912 | { |
905 | //timerID=startTimer(500); | 913 | //timerID=startTimer(500); |
906 | } | 914 | } |
907 | 915 | ||
908 | void EmailClient::inboxItemReleased() | 916 | void EmailClient::inboxItemReleased() |
909 | { | 917 | { |
910 | //killTimer(timerID); | 918 | //killTimer(timerID); |
911 | } | 919 | } |
912 | 920 | ||
@@ -930,52 +938,31 @@ void EmailClient::timerEvent(QTimerEvent *e) | |||
930 | */ | 938 | */ |
931 | } | 939 | } |
932 | 940 | ||
933 | Email* EmailClient::getCurrentMail() | 941 | Email* EmailClient::getCurrentMail() |
934 | { | 942 | { |
935 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); | 943 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); |
936 | if (eli!=NULL) | 944 | if (eli!=NULL) |
937 | return eli->getMail(); | 945 | return eli->getMail(); |
938 | else | 946 | else |
939 | return NULL; | 947 | return NULL; |
940 | } | 948 | } |
941 | 949 | ||
942 | /* | 950 | void EmailClient::download(Email* mail) |
943 | void EmailClient::reply() | ||
944 | { | ||
945 | Email* mail=getCurrentMail(); | ||
946 | |||
947 | if (mail!=NULL) | ||
948 | { | ||
949 | emit reply(*mail); | ||
950 | } | ||
951 | } | ||
952 | |||
953 | void EmailClient::replyAll() | ||
954 | { | ||
955 | Email* mail=getCurrentMail(); | ||
956 | |||
957 | if (mail!=NULL) | ||
958 | { | ||
959 | emit replyAll(*mail); | ||
960 | } | ||
961 | } | ||
962 | |||
963 | void EmailClient::forward() | ||
964 | { | 951 | { |
965 | Email* mail=getCurrentMail(); | 952 | MailAccount* acc=0; |
966 | 953 | ||
967 | if (mail!=NULL) | 954 | tempMailDownloadList.clear(); |
968 | { | 955 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
969 | emit reply(*mail); | 956 | if (accountList.count()>0) |
970 | } | 957 | qDebug("Accounts present"); |
958 | |||
959 | acc=accountList.at(mail->fromAccountId-1); | ||
960 | if (acc) | ||
961 | { | ||
962 | emailHandler->setAccount(*acc); | ||
963 | emailHandler->getMailByList(&tempMailDownloadList); | ||
964 | } | ||
965 | else | ||
966 | QMessageBox::warning(qApp->activeWindow(), | ||
967 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); | ||
971 | } | 968 | } |
972 | |||
973 | void EmailClient::remove() | ||
974 | { | ||
975 | Email* mail=getCurrentMail(); | ||
976 | |||
977 | if (mail!=NULL) | ||
978 | { | ||
979 | emit remove(*mail); | ||
980 | } | ||
981 | }*/ | ||