Diffstat (limited to 'noncore/net/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 177 |
1 files changed, 89 insertions, 88 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index b039cc4..2102ba7 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -365,7 +365,7 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
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) |
@@ -461,17 +461,18 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
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)) { |
470 | 470 | item = new EmailListItem(inboxView, newMail, TRUE); | |
471 | if (item->getMail()->files.count()>0) | 471 | } |
472 | { | 472 | if (item->getMail()->files.count()>0) |
473 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); | 473 | { |
474 | } | 474 | item->setPixmap(0, Resource::loadPixmap("mailit/attach")); |
475 | } | ||
475 | /*if (!newMail.downloaded) | 476 | /*if (!newMail.downloaded) |
476 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ | 477 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ |
477 | 478 | ||
@@ -642,7 +643,7 @@ void EmailClient::readMail() | |||
642 | } | 643 | } |
643 | } | 644 | } |
644 | 645 | ||
645 | void EmailClient::saveMail(QString fileName, QListView *view) | 646 | void EmailClient::saveMail(const QString &fileName, QListView *view) |
646 | { | 647 | { |
647 | QFile f(fileName); | 648 | QFile f(fileName); |
648 | Email *mail; | 649 | Email *mail; |
@@ -712,7 +713,7 @@ void EmailClient::readSettings() | |||
712 | account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); | 713 | account.synchronize = (mailconf->readEntry("Synchronize","No")=="Yes"); |
713 | if (account.synchronize) | 714 | if (account.synchronize) |
714 | { | 715 | { |
715 | mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); | 716 | mailconf->readNumEntry("LASTSERVERMAILCOUNT",0); |
716 | } | 717 | } |
717 | 718 | ||
718 | accountList.append(&account); | 719 | accountList.append(&account); |
@@ -915,32 +916,32 @@ void EmailClient::setDownloadedSize(int size) | |||
915 | 916 | ||
916 | void EmailClient::deleteItem() | 917 | void EmailClient::deleteItem() |
917 | { | 918 | { |
918 | bool inbox=mailboxView->currentTab()==0; | 919 | bool inbox=mailboxView->currentTab()==0; |
919 | QListView* box; | 920 | QListView* box; |
920 | 921 | ||
921 | EmailListItem* eli; | 922 | EmailListItem* eli; |
922 | int pos; | 923 | int pos; |
923 | 924 | ||
924 | inbox ? box=inboxView : box=outboxView; | 925 | inbox ? box=inboxView : box=outboxView; |
925 | 926 | ||
926 | eli=(EmailListItem*)box->selectedItem(); | 927 | eli=(EmailListItem*)box->selectedItem(); |
927 | 928 | ||
928 | if (eli) | 929 | if (eli) |
929 | { | 930 | { |
930 | box->setSelected(eli->itemBelow(),true);//select the previous item | 931 | box->setSelected(eli->itemBelow(),true); //select the previous item |
931 | 932 | ||
932 | deleteMail(eli,(bool&)inbox); //remove mail entry | 933 | deleteMail(eli,(bool&)inbox); //remove mail entry |
933 | } | 934 | } |
934 | } | 935 | } |
935 | 936 | ||
936 | void EmailClient::inboxItemPressed() | 937 | void EmailClient::inboxItemPressed() |
937 | { | 938 | { |
938 | //timerID=startTimer(500); | 939 | // timerID=startTimer(500); |
939 | } | 940 | } |
940 | 941 | ||
941 | void EmailClient::inboxItemReleased() | 942 | void EmailClient::inboxItemReleased() |
942 | { | 943 | { |
943 | //killTimer(timerID); | 944 | // killTimer(timerID); |
944 | } | 945 | } |
945 | 946 | ||
946 | /*void EmailClient::timerEvent(QTimerEvent *e) | 947 | /*void EmailClient::timerEvent(QTimerEvent *e) |
@@ -965,72 +966,72 @@ void EmailClient::inboxItemReleased() | |||
965 | 966 | ||
966 | Email* EmailClient::getCurrentMail() | 967 | Email* EmailClient::getCurrentMail() |
967 | { | 968 | { |
968 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); | 969 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); |
969 | if (eli!=NULL) | 970 | if (eli!=NULL) |
970 | return eli->getMail(); | 971 | return eli->getMail(); |
971 | else | 972 | else |
972 | return NULL; | 973 | return NULL; |
973 | } | 974 | } |
974 | 975 | ||
975 | void EmailClient::download(Email* mail) | 976 | void EmailClient::download(Email* mail) |
976 | { | 977 | { |
977 | MailAccount* acc=0; | 978 | MailAccount* acc=0; |
978 | 979 | ||
979 | tempMailDownloadList.clear(); | 980 | tempMailDownloadList.clear(); |
980 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); | 981 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
981 | 982 | ||
982 | acc=accountList.at(mail->fromAccountId-1); | 983 | acc=accountList.at(mail->fromAccountId-1); |
983 | if (acc) | 984 | if (acc) |
984 | { | 985 | { |
985 | emailHandler->setAccount(*acc); | 986 | emailHandler->setAccount(*acc); |
986 | emailHandler->getMailByList(&tempMailDownloadList); | 987 | emailHandler->getMailByList(&tempMailDownloadList); |
987 | } | 988 | } |
988 | else | 989 | else |
989 | QMessageBox::warning(qApp->activeWindow(), | 990 | QMessageBox::warning(qApp->activeWindow(), |
990 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); | 991 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); |
991 | } | 992 | } |
992 | 993 | ||
993 | void EmailClient::receive(const QCString& msg, const QByteArray& data) | 994 | void EmailClient::receive(const QCString& msg, const QByteArray& data) |
994 | { | 995 | { |
995 | /*if (msg=="getMail()") | 996 | /*if (msg=="getMail()") |
996 | { | 997 | { |
997 | /*QDialog qd(qApp->activeWindow(),"Getting mail",true); | 998 | /*QDialog qd(qApp->activeWindow(),"Getting mail",true); |
998 | QVBoxLayout *vbProg = new QVBoxLayout( &qd ); | 999 | QVBoxLayout *vbProg = new QVBoxLayout( &qd ); |
999 | 1000 | ||
1000 | initStatusBar(&qd); | 1001 | initStatusBar(&qd); |
1001 | 1002 | ||
1002 | if (statusBar==0) | 1003 | if (statusBar==0) |
1003 | { | 1004 | { |
1004 | qDebug("No Bar ..."); | 1005 | qDebug("No Bar ..."); |
1005 | //statusBar=new ProgressBar(&qd); | 1006 | //statusBar=new ProgressBar(&qd); |
1006 | } | 1007 | } |
1007 | statusBar->show(); | 1008 | statusBar->show(); |
1008 | vbProg->addWidget(statusBar); | 1009 | vbProg->addWidget(statusBar); |
1009 | qd.showMaximized(); | 1010 | qd.showMaximized(); |
1010 | qd.show(); | 1011 | qd.show(); |
1011 | emit getAllNewMail(); | 1012 | emit getAllNewMail(); |
1012 | //qd.exec(); | 1013 | //qd.exec(); |
1013 | } | 1014 | } |
1014 | else if (msg=="compose()") | 1015 | else if (msg=="compose()") |
1015 | { | 1016 | { |
1016 | QDialog qd(qApp->activeWindow(),"Getting mail",true); | 1017 | QDialog qd(qApp->activeWindow(),"Getting mail",true); |
1017 | 1018 | ||
1018 | WriteMail wm(&qd,"write new mail"); | 1019 | WriteMail wm(&qd,"write new mail"); |
1019 | QVBoxLayout vbProg( &qd ); | 1020 | QVBoxLayout vbProg( &qd ); |
1020 | 1021 | ||
1021 | wm.showMaximized(); | 1022 | wm.showMaximized(); |
1022 | vbProg.addWidget(&wm); | 1023 | vbProg.addWidget(&wm); |
1023 | 1024 | ||
1024 | qd.showMaximized(); | 1025 | qd.showMaximized(); |
1025 | 1026 | ||
1026 | emit composeRequested(); | 1027 | emit composeRequested(); |
1027 | qd.exec(); | 1028 | qd.exec(); |
1028 | 1029 | ||
1029 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | 1030 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); |
1030 | } | 1031 | } |
1031 | 1032 | ||
1032 | else if (msg=="dialog()") | 1033 | else if (msg=="dialog()") |
1033 | { | 1034 | { |
1034 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | 1035 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); |
1035 | }*/ | 1036 | }*/ |
1036 | } | 1037 | } |