author | llornkcor <llornkcor> | 2003-05-24 01:20:33 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-24 01:20:33 (UTC) |
commit | 62d2ddfb5cd77e2637cdf7fe16d76aac04975984 (patch) (unidiff) | |
tree | 2157d57bab2d6e491226f5bc8468a4c2527e1456 /noncore/unsupported/mailit/emailclient.cpp | |
parent | 0c4b5288ccd4bcd1668816a0c4e12ce0a76b4e6e (diff) | |
download | opie-62d2ddfb5cd77e2637cdf7fe16d76aac04975984.zip opie-62d2ddfb5cd77e2637cdf7fe16d76aac04975984.tar.gz opie-62d2ddfb5cd77e2637cdf7fe16d76aac04975984.tar.bz2 |
QString to const QString
Diffstat (limited to 'noncore/unsupported/mailit/emailclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 177 |
1 files changed, 89 insertions, 88 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index b039cc4..2102ba7 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -356,25 +356,25 @@ void EmailClient::getNewMail() { | |||
356 | void EmailClient::getAllNewMail() | 356 | void 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 | ||
363 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 363 | void 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 |
@@ -452,35 +452,36 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
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)) { |
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 | ||
478 | mailboxView->setCurrentTab(0); | 479 | mailboxView->setCurrentTab(0); |
479 | 480 | ||
480 | } | 481 | } |
481 | 482 | ||
482 | void EmailClient::allMailArrived(int count) | 483 | void EmailClient::allMailArrived(int count) |
483 | { | 484 | { |
484 | // not previewing means all mailtransfer has been done | 485 | // not previewing means all mailtransfer has been done |
485 | /*if (!previewingMail) {*/ | 486 | /*if (!previewingMail) {*/ |
486 | if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { | 487 | if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { |
@@ -633,25 +634,25 @@ void EmailClient::readMail() | |||
633 | 634 | ||
634 | mail.rawMail = s.mid(start, stop + del.length() - start ); | 635 | mail.rawMail = s.mid(start, stop + del.length() - start ); |
635 | start = stop + del.length(); | 636 | start = stop + del.length(); |
636 | emailHandler->parse(mail.rawMail, lineShift, &mail); | 637 | emailHandler->parse(mail.rawMail, lineShift, &mail); |
637 | mail.sent = false; | 638 | mail.sent = false; |
638 | mail.received = false; | 639 | mail.received = false; |
639 | enqueMail(mail); | 640 | enqueMail(mail); |
640 | 641 | ||
641 | } | 642 | } |
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; |
649 | 650 | ||
650 | if (! f.open(IO_WriteOnly) ) { | 651 | if (! f.open(IO_WriteOnly) ) { |
651 | qWarning("could not open file"); | 652 | qWarning("could not open file"); |
652 | return; | 653 | return; |
653 | } | 654 | } |
654 | item = (EmailListItem *) view->firstChild(); | 655 | item = (EmailListItem *) view->firstChild(); |
655 | QTextStream t(&f); | 656 | QTextStream t(&f); |
656 | while (item != NULL) { | 657 | while (item != NULL) { |
657 | mail = item->getMail(); | 658 | mail = item->getMail(); |
@@ -703,25 +704,25 @@ void EmailClient::readSettings() | |||
703 | account.popUserName = mailconf->readEntry("POPUser",""); | 704 | account.popUserName = mailconf->readEntry("POPUser",""); |
704 | account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); | 705 | account.popPasswd = mailconf->readEntryCrypt("POPPassword",""); |
705 | account.popServer = mailconf->readEntry("POPServer",""); | 706 | account.popServer = mailconf->readEntry("POPServer",""); |
706 | account.smtpServer = mailconf->readEntry("SMTPServer",""); | 707 | account.smtpServer = mailconf->readEntry("SMTPServer",""); |
707 | account.id = mailconf->readNumEntry("AccountId",0); | 708 | account.id = mailconf->readNumEntry("AccountId",0); |
708 | account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); | 709 | account.syncLimit = mailconf->readNumEntry("HeaderLimit",0); |
709 | account.lastServerMailCount = 0; | 710 | account.lastServerMailCount = 0; |
710 | account.synchronize = FALSE; | 711 | account.synchronize = FALSE; |
711 | 712 | ||
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); |
719 | } | 720 | } |
720 | 721 | ||
721 | mailconf->setGroup("mailitglobal"); | 722 | mailconf->setGroup("mailitglobal"); |
722 | 723 | ||
723 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) | 724 | if ( (y = mailconf->readNumEntry("mailidcount", -1)) != -1) |
724 | { | 725 | { |
725 | mailIdCount = y; | 726 | mailIdCount = y; |
726 | } | 727 | } |
727 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) | 728 | if ( (y = mailconf->readNumEntry("accountidcount", -1)) != -1) |
@@ -906,131 +907,131 @@ void EmailClient::setDownloadedSize(int size) | |||
906 | { | 907 | { |
907 | int total = progressBar->totalSteps(); | 908 | int total = progressBar->totalSteps(); |
908 | 909 | ||
909 | if (size < total) { | 910 | if (size < total) { |
910 | progressBar->setProgress(size); | 911 | progressBar->setProgress(size); |
911 | } else { | 912 | } else { |
912 | progressBar->setProgress(total); | 913 | progressBar->setProgress(total); |
913 | } | 914 | } |
914 | } | 915 | } |
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) |
947 | { | 948 | { |
948 | /*killTimer(timerID); | 949 | /*killTimer(timerID); |
949 | 950 | ||
950 | 951 | ||
951 | QPopupMenu *action = new QPopupMenu(this); | 952 | QPopupMenu *action = new QPopupMenu(this); |
952 | 953 | ||
953 | int reply=0; | 954 | int reply=0; |
954 | 955 | ||
955 | action->insertItem(tr( "Reply To" ),this,SLOT(reply())); | 956 | action->insertItem(tr( "Reply To" ),this,SLOT(reply())); |
956 | action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); | 957 | action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); |
957 | action->insertItem( tr( "Forward" ), this,SLOT(forward())); | 958 | action->insertItem( tr( "Forward" ), this,SLOT(forward())); |
958 | action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); | 959 | action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); |
959 | 960 | ||
960 | action->exec(QCursor::pos()); | 961 | action->exec(QCursor::pos()); |
961 | 962 | ||
962 | if (action) delete action; | 963 | if (action) delete action; |
963 | 964 | ||
964 | }*/ | 965 | }*/ |
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 | } |