summaryrefslogtreecommitdiff
path: root/noncore
authorllornkcor <llornkcor>2003-06-09 01:37:23 (UTC)
committer llornkcor <llornkcor>2003-06-09 01:37:23 (UTC)
commit364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560 (patch) (unidiff)
tree1be5d3150c2bda4b3a55f9e7d2529d73fe6d72db /noncore
parent5ee1c7dff5679454d46e3c5bd5747c60ea63c959 (diff)
downloadopie-364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560.zip
opie-364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560.tar.gz
opie-364e6e65b4c3b4ceec2b1b6688f2ca2b3dce4560.tar.bz2
patch from wim delvaux. fix from me
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mailit/addatt.cpp4
-rw-r--r--noncore/net/mailit/emailclient.cpp71
-rw-r--r--noncore/net/mailit/emailclient.h4
-rw-r--r--noncore/net/mailit/emailhandler.cpp8
-rw-r--r--noncore/net/mailit/emailhandler.h4
-rw-r--r--noncore/net/mailit/mailit.pro1
-rw-r--r--noncore/net/mailit/mailitwindow.cpp4
-rw-r--r--noncore/net/mailit/maillist.cpp6
-rw-r--r--noncore/net/mailit/popclient.cpp16
-rw-r--r--noncore/net/mailit/popclient.h3
-rw-r--r--noncore/net/mailit/smtpclient.cpp33
-rw-r--r--noncore/net/mailit/smtpclient.h3
-rw-r--r--noncore/net/mailit/viewatt.cpp14
-rw-r--r--noncore/net/mailit/writemail.cpp10
-rw-r--r--noncore/unsupported/mailit/addatt.cpp4
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp71
-rw-r--r--noncore/unsupported/mailit/emailclient.h4
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp8
-rw-r--r--noncore/unsupported/mailit/emailhandler.h4
-rw-r--r--noncore/unsupported/mailit/mailit.pro1
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp4
-rw-r--r--noncore/unsupported/mailit/maillist.cpp6
-rw-r--r--noncore/unsupported/mailit/popclient.cpp16
-rw-r--r--noncore/unsupported/mailit/popclient.h3
-rw-r--r--noncore/unsupported/mailit/smtpclient.cpp33
-rw-r--r--noncore/unsupported/mailit/smtpclient.h3
-rw-r--r--noncore/unsupported/mailit/viewatt.cpp14
-rw-r--r--noncore/unsupported/mailit/writemail.cpp10
28 files changed, 200 insertions, 162 deletions
diff --git a/noncore/net/mailit/addatt.cpp b/noncore/net/mailit/addatt.cpp
index daefac6..19ac58f 100644
--- a/noncore/net/mailit/addatt.cpp
+++ b/noncore/net/mailit/addatt.cpp
@@ -35,49 +35,49 @@ FileItem::FileItem(QListView *parent, DocLnk* dl)
35 setText(0, doclnk->name()); 35 setText(0, doclnk->name());
36 36
37 /*if (fileType == "Picture") { 37 /*if (fileType == "Picture") {
38 setPixmap(0, Resource::loadPixmap("pixmap")); 38 setPixmap(0, Resource::loadPixmap("pixmap"));
39 } else if (fileType == "Document") { 39 } else if (fileType == "Document") {
40 setPixmap(0, Resource::loadPixmap("txt")); 40 setPixmap(0, Resource::loadPixmap("txt"));
41 } else if (fileType == "Sound") { 41 } else if (fileType == "Sound") {
42 setPixmap(0, Resource::loadPixmap("play")); 42 setPixmap(0, Resource::loadPixmap("play"));
43 } else if (fileType == "Movie") { 43 } else if (fileType == "Movie") {
44 setPixmap(0, Resource::loadPixmap("MPEGPlayer")); 44 setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
45 } else if (fileType == "File") { 45 } else if (fileType == "File") {
46 setPixmap(0, Resource::loadPixmap("exec")); 46 setPixmap(0, Resource::loadPixmap("exec"));
47 }*/ 47 }*/
48} 48}
49 49
50FileItem::~FileItem() 50FileItem::~FileItem()
51{ 51{
52 if (doclnk!=NULL) delete doclnk; 52 if (doclnk!=NULL) delete doclnk;
53 doclnk=NULL; 53 doclnk=NULL;
54} 54}
55 55
56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) 56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
57 : QDialog(parent, name, f) 57 : QDialog(parent, name, f)
58{ 58{
59 setCaption("Adding attachments"); 59 setCaption(tr("Adding attachments") );
60 60
61 QGridLayout *top = new QGridLayout(this, 1,1 ); 61 QGridLayout *top = new QGridLayout(this, 1,1 );
62 62
63 QHBox *buttons=new QHBox(this); 63 QHBox *buttons=new QHBox(this);
64 /*fileCategoryButton = new QPushButton(this);*/ 64 /*fileCategoryButton = new QPushButton(this);*/
65 attachButton = new QPushButton(tr("attach..."), buttons); 65 attachButton = new QPushButton(tr("attach..."), buttons);
66 removeButton = new QPushButton(tr("Remove"), buttons); 66 removeButton = new QPushButton(tr("Remove"), buttons);
67 67
68 /*fileCategories = new QPopupMenu(fileCategoryButton); 68 /*fileCategories = new QPopupMenu(fileCategoryButton);
69 fileCategoryButton->setPopup(fileCategories); 69 fileCategoryButton->setPopup(fileCategories);
70 fileCategories->insertItem("Document"); 70 fileCategories->insertItem("Document");
71 fileCategories->insertItem("Picture"); 71 fileCategories->insertItem("Picture");
72 fileCategories->insertItem("Sound"); 72 fileCategories->insertItem("Sound");
73 fileCategories->insertItem("Movie"); 73 fileCategories->insertItem("Movie");
74 fileCategories->insertItem("File"); 74 fileCategories->insertItem("File");
75 75
76 fileCategoryButton->setText("Document"); 76 fileCategoryButton->setText("Document");
77 top->addWidget(fileCategoryButton, 0, 0);*/ 77 top->addWidget(fileCategoryButton, 0, 0);*/
78 78
79 79
80 top->addWidget(buttons,1,0); 80 top->addWidget(buttons,1,0);
81 //buttons->addWidget(attachButton,0,0); 81 //buttons->addWidget(attachButton,0,0);
82 //buttons->addWidget(removeButton,0,1); 82 //buttons->addWidget(removeButton,0,1);
83 83
@@ -101,49 +101,49 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
101 SLOT(removeattachment()) ); 101 SLOT(removeattachment()) );
102 102
103 //top->addWidget(ofs, 0,0); 103 //top->addWidget(ofs, 0,0);
104 top->addWidget(attView, 0,0); 104 top->addWidget(attView, 0,0);
105 105
106 clear(); 106 clear();
107 107
108 108
109} 109}
110 110
111void AddAtt::clear() 111void AddAtt::clear()
112{ 112{
113 attView->clear(); 113 attView->clear();
114 //getFiles(); 114 //getFiles();
115 modified = FALSE; 115 modified = FALSE;
116} 116}
117 117
118/*void AddAtt::fileCategorySelected(int id) 118/*void AddAtt::fileCategorySelected(int id)
119{ 119{
120 fileCategoryButton->setText(fileCategories->text(id)); 120 fileCategoryButton->setText(fileCategories->text(id));
121 getFiles(); 121 getFiles();
122}*/ 122}*/
123 123
124void AddAtt::addattachment() 124void AddAtt::addattachment()
125 { 125 {// ### FIXME wrong use -zecke
126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); 126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
127 127
128 ofs.showMaximized(); 128 ofs.showMaximized();
129 129
130 if (ofs.exec()==QDialog::Accepted) 130 if (ofs.exec()==QDialog::Accepted)
131 { 131 {
132 DocLnk* dl=new DocLnk(ofs.selectedDocument()); 132 DocLnk* dl=new DocLnk(ofs.selectedDocument());
133 FileItem* fi=new FileItem(attView,dl); 133 FileItem* fi=new FileItem(attView,dl);
134 fi->setPixmap(0,dl->pixmap()); 134 fi->setPixmap(0,dl->pixmap());
135 fi->setText(1,dl->type()); 135 fi->setText(1,dl->type());
136 attView->insertItem(fi); 136 attView->insertItem(fi);
137 modified = TRUE; 137 modified = TRUE;
138 } 138 }
139} 139}
140 140
141void AddAtt::removeattachment() 141void AddAtt::removeattachment()
142{ 142{
143 if (attView->selectedItem() != NULL) 143 if (attView->selectedItem() != NULL)
144 { 144 {
145 attView->takeItem(attView->selectedItem()); 145 attView->takeItem(attView->selectedItem());
146 } 146 }
147 modified = TRUE; 147 modified = TRUE;
148} 148}
149 149
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp
index da1226c..749a4e9 100644
--- a/noncore/net/mailit/emailclient.cpp
+++ b/noncore/net/mailit/emailclient.cpp
@@ -38,52 +38,52 @@ MailAccount* AccountList::dupl(MailAccount *in)
38{ 38{
39 ac = new MailAccount(*in); 39 ac = new MailAccount(*in);
40 return ac; 40 return ac;
41} 41}
42 42
43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
44 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
45{ 45{
46 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
47 addressList = new AddressList(); 47 addressList = new AddressList();
48 48
49 sending = FALSE; 49 sending = FALSE;
50 receiving = FALSE; 50 receiving = FALSE;
51 previewingMail = FALSE; 51 previewingMail = FALSE;
52 mailIdCount = 1; 52 mailIdCount = 1;
53 accountIdCount = 1; 53 accountIdCount = 1;
54 allAccounts = FALSE; 54 allAccounts = FALSE;
55 55
56 init(); 56 init();
57 57
58 58
59 59
60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
61 61
62 connect(emailHandler, SIGNAL(smtpError(int)), this, 62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this,
63 SLOT(smtpError(int)) ); 63 SLOT(smtpError(int,const QString &)) );
64 connect(emailHandler, SIGNAL(popError(int)), this, 64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this,
65 SLOT(popError(int)) ); 65 SLOT(popError(int,const QString &)) );
66 66
67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
69 69
70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
72 72
73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
74 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email &, bool)) );
75 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 75 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
76 SLOT(allMailArrived(int)) ); 76 SLOT(allMailArrived(int)) );
77 77
78 mailconf = new Config("mailit"); 78 mailconf = new Config("mailit");
79 //In case Synchronize is not defined in settings.txt 79 //In case Synchronize is not defined in settings.txt
80 80
81 readSettings(); 81 readSettings();
82 82
83 updateAccounts(); 83 updateAccounts();
84 84
85 lineShift = "\n"; 85 lineShift = "\n";
86 readMail(); 86 readMail();
87 lineShift = "\r\n"; 87 lineShift = "\r\n";
88 88
89 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
@@ -459,130 +459,135 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
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)) { 469 if ((!found)||(fromDisk)) {
470 item = new EmailListItem(inboxView, newMail, TRUE); 470 item = new EmailListItem(inboxView, newMail, TRUE);
471 } 471 }
472// if (item->getMail()->files.count()>0) 472// if (item->getMail()->files.count()>0)
473// { 473// {
474// item->setPixmap(0, Resource::loadPixmap("mailit/attach")); 474// item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
475// } 475// }
476 /*if (!newMail.downloaded) 476 /*if (!newMail.downloaded)
477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ 477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
478 478
479 mailboxView->setCurrentTab(0); 479 mailboxView->setCurrentTab(0);
480 480
481} 481}
482 482
483void EmailClient::allMailArrived(int count) 483void EmailClient::allMailArrived(int /*count*/)
484{ 484{
485 // not previewing means all mailtransfer has been done 485 // not previewing means all mailtransfer has been done
486 /*if (!previewingMail) {*/ 486 /*if (!previewingMail) {*/
487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { 487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
488 emit newCaption("Mailit - " + currentAccount->accountName); 488 emit newCaption("Mailit - " + currentAccount->accountName);
489 getNewMail(); 489 getNewMail();
490 return; 490 return;
491 } else { 491 } else {
492 allAccounts = FALSE; 492 allAccounts = FALSE;
493 receiving = FALSE; 493 receiving = FALSE;
494 getMailButton->setEnabled(TRUE); 494 getMailButton->setEnabled(TRUE);
495 cancelButton->setEnabled(FALSE); 495 cancelButton->setEnabled(FALSE);
496 selectAccountMenu->setEnabled(TRUE); 496 selectAccountMenu->setEnabled(TRUE);
497 status1Label->setText("Idle"); 497 status1Label->setText("Idle");
498 498
499 progressBar->reset(); 499 progressBar->reset();
500 return; 500 return;
501 } 501 }
502 //} 502 //}
503 503
504 // all headers downloaded from server, start downloading remaining mails 504 // all headers downloaded from server, start downloading remaining mails
505 previewingMail = FALSE; 505 previewingMail = FALSE;
506 status1Label->setText(currentAccount->accountName); 506 status1Label->setText(currentAccount->accountName);
507 progressBar->reset(); 507 progressBar->reset();
508 508
509 509
510 mailboxView->setCurrentTab(0); 510 mailboxView->setCurrentTab(0);
511} 511}
512 512
513 513
514void EmailClient::moveMailFront(Email *mailPtr) 514void EmailClient::moveMailFront(Email *mailPtr)
515{ 515{
516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
518 } 518 }
519} 519}
520 520
521void EmailClient::smtpError(int code) 521void EmailClient::smtpError(int code, const QString & Msg)
522{ 522{
523 QString temp; 523 QString temp;
524 524
525 if (code == ErrUnknownResponse) 525 if (code == ErrUnknownResponse) {
526 temp = "Unknown response from server"; 526 temp = tr("<qt>Unknown response from server</qt>");
527 527 if( ! Msg.isEmpty() )
528 if (code == QSocket::ErrHostNotFound) 528 temp += Msg;
529 temp = "host not found"; 529 } else if (code == QSocket::ErrHostNotFound) {
530 if (code == QSocket::ErrConnectionRefused) 530 temp = tr("<qt>host not found</qt>");
531 temp = "connection refused"; 531 } else if (code == QSocket::ErrConnectionRefused) {
532 if (code == QSocket::ErrSocketRead) 532 temp = tr("<qt>connection refused</qt>");
533 temp = "socket packet error"; 533 } else if (code == QSocket::ErrSocketRead) {
534 temp = tr("<qt>socket packet error</qt>");
535 }
534 536
535 if (code != ErrCancel) { 537 if (code != ErrCancel) {
536 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n"); 538 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
537 } else { 539 } else {
538 status2Label->setText("Aborted by user"); 540 status2Label->setText("Aborted by user");
539 } 541 }
540 542
541 sending = FALSE; 543 sending = FALSE;
542 sendMailButton->setEnabled(TRUE); 544 sendMailButton->setEnabled(TRUE);
543 cancelButton->setEnabled(FALSE); 545 cancelButton->setEnabled(FALSE);
544 quedMessages.clear(); 546 quedMessages.clear();
545} 547}
546 548
547void EmailClient::popError(int code) 549void EmailClient::popError(int code, const QString & Msg)
548{ 550{
549 QString temp; 551 QString temp;
550 552
551 if (code == ErrUnknownResponse) 553 if (code == ErrUnknownResponse) {
552 temp = "Unknown response from server"; 554 temp = tr("<qt>Unknown response from server</qt>");
553 if (code == ErrLoginFailed) 555 if( ! Msg.isEmpty() )
554 temp = "Login failed\nCheck user name and password"; 556 temp += Msg;
555 557 } else if (code == ErrLoginFailed) {
556 if (code == QSocket::ErrHostNotFound) 558 temp = tr("<qt>Login failed\nCheck user name and password</qt>");
557 temp = "host not found"; 559 } else if (code == QSocket::ErrHostNotFound) {
558 if (code == QSocket::ErrConnectionRefused) 560 temp = tr("<qt>host not found</qt>");
559 temp = "connection refused"; 561 } else if (code == QSocket::ErrConnectionRefused) {
560 if (code == QSocket::ErrSocketRead) 562 temp = tr("<qt>connection refused</qt>");
561 temp = "socket packet error"; 563 } else if (code == QSocket::ErrSocketRead) {
564 temp = tr("<qt>socket packet error</qt>");
565 }
562 566
563 if (code != ErrCancel) { 567 if (code != ErrCancel) {
564 QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n"); 568 QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n"));
569
565 } else { 570 } else {
566 status2Label->setText("Aborted by user"); 571 status2Label->setText("Aborted by user");
567 } 572 }
568 573
569 receiving = FALSE; 574 receiving = FALSE;
570 getMailButton->setEnabled(TRUE); 575 getMailButton->setEnabled(TRUE);
571 cancelButton->setEnabled(FALSE); 576 cancelButton->setEnabled(FALSE);
572 selectAccountMenu->setEnabled(TRUE); 577 selectAccountMenu->setEnabled(TRUE);
573} 578}
574 579
575void EmailClient::inboxItemSelected() 580void EmailClient::inboxItemSelected()
576{ 581{
577 //killTimer(timerID); 582 //killTimer(timerID);
578 583
579 item = (EmailListItem*) inboxView->selectedItem(); 584 item = (EmailListItem*) inboxView->selectedItem();
580 if (item != NULL) { 585 if (item != NULL) {
581 emit viewEmail(inboxView, item->getMail()); 586 emit viewEmail(inboxView, item->getMail());
582 } 587 }
583} 588}
584 589
585void EmailClient::outboxItemSelected() 590void EmailClient::outboxItemSelected()
586{ 591{
587 //killTimer(timerID); 592 //killTimer(timerID);
588 593
@@ -877,146 +882,146 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
877 882
878 mailconf->setGroup(mPtr->id); 883 mailconf->setGroup(mPtr->id);
879 mailconf->clearGroup(); 884 mailconf->clearGroup();
880 885
881 //delete any temporary attatchemnts storing 886 //delete any temporary attatchemnts storing
882 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { 887 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) {
883 if (ePtr->saved) { 888 if (ePtr->saved) {
884 QFile::remove( (ePtr->path + ePtr->name) ); 889 QFile::remove( (ePtr->path + ePtr->name) );
885 } 890 }
886 } 891 }
887 inboxView->takeItem(mailItem); 892 inboxView->takeItem(mailItem);
888 } 893 }
889 else 894 else
890 { 895 {
891 outboxView->takeItem(mailItem); 896 outboxView->takeItem(mailItem);
892 } 897 }
893} 898}
894 899
895void EmailClient::setMailSize(int size) 900void EmailClient::setMailSize(int size)
896{ 901{
897 progressBar->reset(); 902 progressBar->reset();
898 progressBar->setTotalSteps(size); 903 progressBar->setTotalSteps(size);
899} 904}
900 905
901void EmailClient::setTotalSize(int size) 906void EmailClient::setTotalSize(int /*size*/)
902{ 907{
903 908
904} 909}
905 910
906void EmailClient::setDownloadedSize(int size) 911void EmailClient::setDownloadedSize(int size)
907{ 912{
908 int total = progressBar->totalSteps(); 913 int total = progressBar->totalSteps();
909 914
910 if (size < total) { 915 if (size < total) {
911 progressBar->setProgress(size); 916 progressBar->setProgress(size);
912 } else { 917 } else {
913 progressBar->setProgress(total); 918 progressBar->setProgress(total);
914 } 919 }
915} 920}
916 921
917void EmailClient::deleteItem() 922void EmailClient::deleteItem()
918{ 923{
919 bool inbox=mailboxView->currentTab()==0; 924 bool inbox=mailboxView->currentTab()==0;
920 QListView* box; 925 QListView* box;
921 926
922 EmailListItem* eli; 927 EmailListItem* eli;
923 int pos; 928 // int pos;
924 929
925 inbox ? box=inboxView : box=outboxView; 930 inbox ? box=inboxView : box=outboxView;
926 931
927 eli=(EmailListItem*)box->selectedItem(); 932 eli=(EmailListItem*)box->selectedItem();
928 933
929 if (eli) 934 if (eli)
930 { 935 {
931 box->setSelected(eli->itemBelow(),true); //select the previous item 936 box->setSelected(eli->itemBelow(),true); //select the previous item
932 937
933 deleteMail(eli,(bool&)inbox); //remove mail entry 938 deleteMail(eli,(bool&)inbox); //remove mail entry
934 } 939 }
935} 940}
936 941
937void EmailClient::inboxItemPressed() 942void EmailClient::inboxItemPressed()
938{ 943{
939// timerID=startTimer(500); 944// timerID=startTimer(500);
940} 945}
941 946
942void EmailClient::inboxItemReleased() 947void EmailClient::inboxItemReleased()
943{ 948{
944 // killTimer(timerID); 949 // killTimer(timerID);
945} 950}
946 951
947/*void EmailClient::timerEvent(QTimerEvent *e) 952/*void EmailClient::timerEvent(QTimerEvent *e)
948{ 953{
949 /*killTimer(timerID); 954 //killTimer(timerID);
950 955
951 956
952 QPopupMenu *action = new QPopupMenu(this); 957 QPopupMenu *action = new QPopupMenu(this);
953 958
954 int reply=0; 959 int reply=0;
955 960
956 action->insertItem(tr( "Reply To" ),this,SLOT(reply())); 961 action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
957 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); 962 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
958 action->insertItem( tr( "Forward" ), this,SLOT(forward())); 963 action->insertItem( tr( "Forward" ), this,SLOT(forward()));
959 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); 964 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
960 965
961 action->exec(QCursor::pos()); 966 action->exec(QCursor::pos());
962 967
963 if (action) delete action; 968 if (action) delete action;
964 969
965}*/ 970}*/
966 971
967Email* EmailClient::getCurrentMail() 972Email* EmailClient::getCurrentMail()
968{ 973{
969 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); 974 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem());
970 if (eli!=NULL) 975 if (eli!=NULL)
971 return eli->getMail(); 976 return eli->getMail();
972 else 977 else
973 return NULL; 978 return NULL;
974} 979}
975 980
976void EmailClient::download(Email* mail) 981void EmailClient::download(Email* mail)
977{ 982{
978 MailAccount* acc=0; 983 MailAccount* acc=0;
979 984
980 tempMailDownloadList.clear(); 985 tempMailDownloadList.clear();
981 tempMailDownloadList.sizeInsert(mail->serverId, mail->size); 986 tempMailDownloadList.sizeInsert(mail->serverId, mail->size);
982 987
983 acc=accountList.at(mail->fromAccountId-1); 988 acc=accountList.at(mail->fromAccountId-1);
984 if (acc) 989 if (acc)
985 { 990 {
986 emailHandler->setAccount(*acc); 991 emailHandler->setAccount(*acc);
987 emailHandler->getMailByList(&tempMailDownloadList); 992 emailHandler->getMailByList(&tempMailDownloadList);
988 } 993 }
989 else 994 else
990 QMessageBox::warning(qApp->activeWindow(), 995 QMessageBox::warning(qApp->activeWindow(),
991 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); 996 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n");
992} 997}
993 998
994void EmailClient::receive(const QCString& msg, const QByteArray& data) 999void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/)
995{ 1000{
996 /*if (msg=="getMail()") 1001 /*if (msg=="getMail()")
997 { 1002 {
998 /*QDialog qd(qApp->activeWindow(),"Getting mail",true); 1003 //QDialog qd(qApp->activeWindow(),"Getting mail",true);
999 QVBoxLayout *vbProg = new QVBoxLayout( &qd ); 1004 QVBoxLayout *vbProg = new QVBoxLayout( &qd );
1000 1005
1001 initStatusBar(&qd); 1006 initStatusBar(&qd);
1002 1007
1003 if (statusBar==0) 1008 if (statusBar==0)
1004 { 1009 {
1005 qDebug("No Bar ..."); 1010 qDebug("No Bar ...");
1006 //statusBar=new ProgressBar(&qd); 1011 //statusBar=new ProgressBar(&qd);
1007 } 1012 }
1008 statusBar->show(); 1013 statusBar->show();
1009 vbProg->addWidget(statusBar); 1014 vbProg->addWidget(statusBar);
1010 qd.showMaximized(); 1015 qd.showMaximized();
1011 qd.show(); 1016 qd.show();
1012 emit getAllNewMail(); 1017 emit getAllNewMail();
1013 //qd.exec(); 1018 //qd.exec();
1014 } 1019 }
1015 else if (msg=="compose()") 1020 else if (msg=="compose()")
1016 { 1021 {
1017 QDialog qd(qApp->activeWindow(),"Getting mail",true); 1022 QDialog qd(qApp->activeWindow(),"Getting mail",true);
1018 1023
1019 WriteMail wm(&qd,"write new mail"); 1024 WriteMail wm(&qd,"write new mail");
1020 QVBoxLayout vbProg( &qd ); 1025 QVBoxLayout vbProg( &qd );
1021 1026
1022 wm.showMaximized(); 1027 wm.showMaximized();
diff --git a/noncore/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h
index c98cfce..80c6d31 100644
--- a/noncore/net/mailit/emailclient.h
+++ b/noncore/net/mailit/emailclient.h
@@ -77,50 +77,50 @@ protected:
77 77
78signals: 78signals:
79 void composeRequested(); 79 void composeRequested();
80 void viewEmail(QListView *, Email *); 80 void viewEmail(QListView *, Email *);
81 void mailUpdated(Email *); 81 void mailUpdated(Email *);
82 void newCaption(const QString &); 82 void newCaption(const QString &);
83 void replyRequested(Email&, bool&); 83 void replyRequested(Email&, bool&);
84 void forwardRequested(Email&); 84 void forwardRequested(Email&);
85 void removeItem(EmailListItem*, bool&); 85 void removeItem(EmailListItem*, bool&);
86 /*void reply(Email&); 86 /*void reply(Email&);
87 void replyAll(Email&); 87 void replyAll(Email&);
88 void remove(Email&); 88 void remove(Email&);
89 void forward(Email&);*/ 89 void forward(Email&);*/
90 90
91public slots: 91public slots:
92 void compose(); 92 void compose();
93 void cancel(); 93 void cancel();
94 void enqueMail(const Email &mail); 94 void enqueMail(const Email &mail);
95 void setMailAccount(); 95 void setMailAccount();
96 void sendQuedMail(); 96 void sendQuedMail();
97 void mailSent(); 97 void mailSent();
98 void deleteItem(); 98 void deleteItem();
99 void getNewMail(); 99 void getNewMail();
100 void getAllNewMail(); 100 void getAllNewMail();
101 void smtpError(int code); 101 void smtpError(int code, const QString & Msg );
102 void popError(int code); 102 void popError(int code, const QString & Msg);
103 void inboxItemSelected(); 103 void inboxItemSelected();
104 void outboxItemSelected(); 104 void outboxItemSelected();
105 void inboxItemPressed(); 105 void inboxItemPressed();
106 void inboxItemReleased(); 106 void inboxItemReleased();
107 void mailArrived(const Email &mail, bool fromDisk); 107 void mailArrived(const Email &mail, bool fromDisk);
108 void allMailArrived(int); 108 void allMailArrived(int);
109 void saveMail(const QString &fileName, QListView *view); 109 void saveMail(const QString &fileName, QListView *view);
110 void selectAccount(int); 110 void selectAccount(int);
111 void editAccount(int); 111 void editAccount(int);
112 void updateAccounts(); 112 void updateAccounts();
113 void deleteAccount(int); 113 void deleteAccount(int);
114 void deleteMail(EmailListItem *mailItem, bool &inbox); 114 void deleteMail(EmailListItem *mailItem, bool &inbox);
115 void setTotalSize(int); 115 void setTotalSize(int);
116 void setMailSize(int); 116 void setMailSize(int);
117 void setDownloadedSize(int); 117 void setDownloadedSize(int);
118 void moveMailFront(Email *mailPtr); 118 void moveMailFront(Email *mailPtr);
119 void download(Email*); 119 void download(Email*);
120/* void reply(); 120/* void reply();
121 void replyAll(); 121 void replyAll();
122 void forward(); 122 void forward();
123 void remove();*/ 123 void remove();*/
124 124
125private slots: 125private slots:
126 void receive(const QCString&, const QByteArray&); 126 void receive(const QCString&, const QByteArray&);
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp
index 39f693d..5b8bda1 100644
--- a/noncore/net/mailit/emailhandler.cpp
+++ b/noncore/net/mailit/emailhandler.cpp
@@ -23,56 +23,56 @@
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qcstring.h> 24#include <qcstring.h>
25#include "emailhandler.h" 25#include "emailhandler.h"
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/filemanager.h> 27#include <qpe/filemanager.h>
28 28
29QCollection::Item EnclosureList::newItem(QCollection::Item d) 29QCollection::Item EnclosureList::newItem(QCollection::Item d)
30{ 30{
31 return dupl( (Enclosure *) d); 31 return dupl( (Enclosure *) d);
32} 32}
33 33
34Enclosure* EnclosureList::dupl(Enclosure *in) 34Enclosure* EnclosureList::dupl(Enclosure *in)
35{ 35{
36 ac = new Enclosure(*in); 36 ac = new Enclosure(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailHandler::EmailHandler() 40EmailHandler::EmailHandler()
41{ 41{
42 qDebug("EMailHandler::EmailHandler"); 42 qDebug("EMailHandler::EmailHandler");
43 43
44 smtpClient = new SmtpClient(); 44 smtpClient = new SmtpClient();
45 popClient = new PopClient(); 45 popClient = new PopClient();
46 46
47 connect(smtpClient, SIGNAL(errorOccurred(int)), this, 47 connect(smtpClient, SIGNAL(errorOccurred(int, const QString &)), this,
48 SIGNAL(smtpError(int)) ); 48 SIGNAL(smtpError(int, const QString &)) );
49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) ); 49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) );
50 connect(smtpClient, SIGNAL(updateStatus(const QString &)), this, 50 connect(smtpClient, SIGNAL(updateStatus(const QString &)), this,
51 SIGNAL(updateSmtpStatus(const QString &)) ); 51 SIGNAL(updateSmtpStatus(const QString &)) );
52 52
53 connect(popClient, SIGNAL(errorOccurred(int)), this, 53 connect(popClient, SIGNAL(errorOccurred(int, const QString &)), this,
54 SIGNAL(popError(int)) ); 54 SIGNAL(popError(int, const QString &)) );
55 connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)), 55 connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)),
56 this, SLOT(messageArrived(const QString &, int, uint, bool)) ); 56 this, SLOT(messageArrived(const QString &, int, uint, bool)) );
57 connect(popClient, SIGNAL(updateStatus(const QString &)), this, 57 connect(popClient, SIGNAL(updateStatus(const QString &)), this,
58 SIGNAL(updatePopStatus(const QString &)) ); 58 SIGNAL(updatePopStatus(const QString &)) );
59 connect(popClient, SIGNAL(mailTransfered(int)), this, 59 connect(popClient, SIGNAL(mailTransfered(int)), this,
60 SIGNAL(mailTransfered(int)) ); 60 SIGNAL(mailTransfered(int)) );
61 61
62 62
63 //relaying size information 63 //relaying size information
64 connect(popClient, SIGNAL(currentMailSize(int)), 64 connect(popClient, SIGNAL(currentMailSize(int)),
65 this, SIGNAL(currentMailSize(int)) ); 65 this, SIGNAL(currentMailSize(int)) );
66 connect(popClient, SIGNAL(downloadedSize(int)), 66 connect(popClient, SIGNAL(downloadedSize(int)),
67 this, SIGNAL(downloadedSize(int)) ); 67 this, SIGNAL(downloadedSize(int)) );
68} 68}
69 69
70void EmailHandler::sendMail(QList<Email> *mailList) 70void EmailHandler::sendMail(QList<Email> *mailList)
71{ 71{
72 Email *currentMail; 72 Email *currentMail;
73 QString temp; 73 QString temp;
74 QString userName = mailAccount.name; 74 QString userName = mailAccount.name;
75 userName += " <" + mailAccount.emailAddress + ">"; 75 userName += " <" + mailAccount.emailAddress + ">";
76 76
77 for (currentMail = mailList->first(); currentMail != 0; 77 for (currentMail = mailList->first(); currentMail != 0;
78 currentMail = mailList->next()) { 78 currentMail = mailList->next()) {
diff --git a/noncore/net/mailit/emailhandler.h b/noncore/net/mailit/emailhandler.h
index e4e7f46..74a8e4c 100644
--- a/noncore/net/mailit/emailhandler.h
+++ b/noncore/net/mailit/emailhandler.h
@@ -106,45 +106,45 @@ struct MailAccount
106 106
107 107
108class EmailHandler : public QObject 108class EmailHandler : public QObject
109{ 109{
110 Q_OBJECT 110 Q_OBJECT
111 111
112public: 112public:
113 EmailHandler(); 113 EmailHandler();
114 void setAccount(MailAccount account); 114 void setAccount(MailAccount account);
115 MailAccount* getAccount(){return &mailAccount;} 115 MailAccount* getAccount(){return &mailAccount;}
116 void sendMail(QList<Email> *mailList); 116 void sendMail(QList<Email> *mailList);
117 void getMail(); 117 void getMail();
118 void getMailHeaders(); 118 void getMailHeaders();
119 void getMailByList(MailList *mailList); 119 void getMailByList(MailList *mailList);
120 bool parse(const QString &in, const QString &lineShift, Email *mail); 120 bool parse(const QString &in, const QString &lineShift, Email *mail);
121 bool getEnclosure(Enclosure *ePtr); 121 bool getEnclosure(Enclosure *ePtr);
122 int parse64base(char *src, char *dest); 122 int parse64base(char *src, char *dest);
123 int encodeMime(Email *mail); 123 int encodeMime(Email *mail);
124 int encodeFile(const QString &fileName, QString *toBody); 124 int encodeFile(const QString &fileName, QString *toBody);
125 void encode64base(char *src, QString *dest, int len); 125 void encode64base(char *src, QString *dest, int len);
126 void cancel(); 126 void cancel();
127 127
128signals: 128signals:
129 void mailSent(); 129 void mailSent();
130 void smtpError(int); 130 void smtpError(int, const QString & Msg );
131 void popError(int); 131 void popError(int, const QString & Msg );
132 void mailArrived(const Email &, bool); 132 void mailArrived(const Email &, bool);
133 void updatePopStatus(const QString &); 133 void updatePopStatus(const QString &);
134 void updateSmtpStatus(const QString &); 134 void updateSmtpStatus(const QString &);
135 void mailTransfered(int); 135 void mailTransfered(int);
136 void mailboxSize(int); 136 void mailboxSize(int);
137 void currentMailSize(int); 137 void currentMailSize(int);
138 void downloadedSize(int); 138 void downloadedSize(int);
139 139
140public slots: 140public slots:
141 void messageArrived(const QString &, int id, uint size, bool complete); 141 void messageArrived(const QString &, int id, uint size, bool complete);
142 142
143private: 143private:
144 MailAccount mailAccount; 144 MailAccount mailAccount;
145 SmtpClient *smtpClient; 145 SmtpClient *smtpClient;
146 PopClient *popClient; 146 PopClient *popClient;
147 bool headers; 147 bool headers;
148}; 148};
149 149
150#endif 150#endif
diff --git a/noncore/net/mailit/mailit.pro b/noncore/net/mailit/mailit.pro
index cfbda36..5e9a83a 100644
--- a/noncore/net/mailit/mailit.pro
+++ b/noncore/net/mailit/mailit.pro
@@ -1,25 +1,26 @@
1TEMPLATE = app 1TEMPLATE = app
2TARGET = mailit
2CONFIG = qt warn_on release 3CONFIG = qt warn_on release
3HEADERS = emailclient.h \ 4HEADERS = emailclient.h \
4 emailhandler.h \ 5 emailhandler.h \
5 emaillistitem.h \ 6 emaillistitem.h \
6 mailitwindow.h \ 7 mailitwindow.h \
7 md5.h \ 8 md5.h \
8 popclient.h \ 9 popclient.h \
9 readmail.h \ 10 readmail.h \
10 smtpclient.h \ 11 smtpclient.h \
11 writemail.h \ 12 writemail.h \
12 textparser.h \ 13 textparser.h \
13 viewatt.h \ 14 viewatt.h \
14 addatt.h \ 15 addatt.h \
15 editaccount.h \ 16 editaccount.h \
16 maillist.h \ 17 maillist.h \
17 addresslist.h 18 addresslist.h
18SOURCES = emailclient.cpp \ 19SOURCES = emailclient.cpp \
19 emailhandler.cpp \ 20 emailhandler.cpp \
20 emaillistitem.cpp \ 21 emaillistitem.cpp \
21 mailitwindow.cpp \ 22 mailitwindow.cpp \
22 main.cpp \ 23 main.cpp \
23 md5.c \ 24 md5.c \
24 popclient.cpp \ 25 popclient.cpp \
25 readmail.cpp \ 26 readmail.cpp \
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp
index f945a0f..6e298c7 100644
--- a/noncore/net/mailit/mailitwindow.cpp
+++ b/noncore/net/mailit/mailitwindow.cpp
@@ -1,51 +1,51 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include "mailitwindow.h" 22#include "mailitwindow.h"
23 23
24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) 24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/)
25 : QMainWindow(parent, name, WStyle_ContextHelp) 25 : QMainWindow(parent, name, WStyle_ContextHelp)
26{ 26{
27 currentCaption = "Mailit"; 27 currentCaption = tr("Mailit");
28 setCaption(tr(currentCaption)); 28 setCaption(tr(currentCaption));
29 views = new QWidgetStack(this); 29 views = new QWidgetStack(this);
30 setCentralWidget(views); 30 setCentralWidget(views);
31 QWhatsThis::add(views,tr("Central view area")); 31 QWhatsThis::add(views,tr("Central view area"));
32 emailClient = new EmailClient(views, "client"); 32 emailClient = new EmailClient(views, "client");
33 writeMail = new WriteMail(views, "writing"); 33 writeMail = new WriteMail(views, "writing");
34 readMail = new ReadMail(views, "reading"); 34 readMail = new ReadMail(views, "reading");
35 35
36 views->raiseWidget(emailClient); 36 views->raiseWidget(emailClient);
37 37
38 connect(emailClient, SIGNAL(composeRequested()), 38 connect(emailClient, SIGNAL(composeRequested()),
39 this, SLOT(compose()) ); 39 this, SLOT(compose()) );
40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, 40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
41 SLOT(viewMail(QListView *, Email *)) ); 41 SLOT(viewMail(QListView *, Email *)) );
42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this, 42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
43 SLOT(updateMailView(Email *)) ); 43 SLOT(updateMailView(Email *)) );
44 44
45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); 45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, 46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
47 SLOT(showEmailClient()) ); 47 SLOT(showEmailClient()) );
48 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, 48 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient,
49 SLOT(enqueMail(const Email &)) ); 49 SLOT(enqueMail(const Email &)) );
50 50
51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); 51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
diff --git a/noncore/net/mailit/maillist.cpp b/noncore/net/mailit/maillist.cpp
index b5325a9..8c34295 100644
--- a/noncore/net/mailit/maillist.cpp
+++ b/noncore/net/mailit/maillist.cpp
@@ -53,79 +53,79 @@ int* MailList::next()
53 mPtr = sortedList.at(currentPos); 53 mPtr = sortedList.at(currentPos);
54 currentPos++; 54 currentPos++;
55 return &(mPtr->serverId); 55 return &(mPtr->serverId);
56} 56}
57 57
58void MailList::sizeInsert(int serverId, uint size) 58void MailList::sizeInsert(int serverId, uint size)
59{ 59{
60 dList *tempPtr; 60 dList *tempPtr;
61 int x; 61 int x;
62 62
63 dList *newEntry = new dList; 63 dList *newEntry = new dList;
64 newEntry->serverId = serverId; 64 newEntry->serverId = serverId;
65 newEntry->size = size; 65 newEntry->size = size;
66 66
67 for (tempPtr = sortedList.first(); tempPtr != NULL; tempPtr = sortedList.next() ) { 67 for (tempPtr = sortedList.first(); tempPtr != NULL; tempPtr = sortedList.next() ) {
68 if (newEntry->size < tempPtr->size) { 68 if (newEntry->size < tempPtr->size) {
69 x = sortedList.at(); 69 x = sortedList.at();
70 sortedList.insert(x, newEntry); 70 sortedList.insert(x, newEntry);
71 return; 71 return;
72 } 72 }
73 } 73 }
74 sortedList.append(newEntry); 74 sortedList.append(newEntry);
75} 75}
76 76
77void MailList::moveFront(int serverId, uint size) 77void MailList::moveFront(int serverId, uint/* size*/)
78{ 78{
79 dList *currentPtr; 79 dList *currentPtr;
80 uint tempPos; 80 uint tempPos;
81 QString temp; 81 QString temp;
82 82
83 tempPos = currentPos; 83 tempPos = currentPos;
84 if ( tempPos >= sortedList.count() ) 84 if ( tempPos >= sortedList.count() )
85 return; 85 return;
86 currentPtr = sortedList.at(tempPos); 86 currentPtr = sortedList.at(tempPos);
87 while ( ((tempPos+1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { 87 while ( ((tempPos+1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) {
88 tempPos++; 88 tempPos++;
89 currentPtr = sortedList.at(tempPos); 89 currentPtr = sortedList.at(tempPos);
90 } 90 }
91 91
92 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { 92 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) {
93 temp.setNum(currentPtr->serverId); 93 temp.setNum(currentPtr->serverId);
94 qWarning("moved to front, message: " + temp); 94 qWarning("moved to front, message: " + temp);
95 95
96 dList *itemPtr = sortedList.take(tempPos); 96 dList *itemPtr = sortedList.take(tempPos);
97 sortedList.insert(currentPos, itemPtr); 97 sortedList.insert(currentPos, itemPtr);
98 } 98 }
99 99
100} 100}
101 101
102//only works if mail is not already in download 102//only works if mail is not already in download
103bool MailList::remove(int serverId, uint size) 103bool MailList::remove(int serverId, uint /*size*/)
104{ 104{
105 dList *currentPtr; 105 dList *currentPtr;
106 uint tempPos; 106 uint tempPos;
107 QString temp; 107 QString temp;
108 108
109 tempPos = currentPos; 109 tempPos = currentPos;
110 if ( tempPos >=sortedList.count() ) 110 if ( tempPos >=sortedList.count() )
111 return FALSE; 111 return FALSE;
112 currentPtr = sortedList.at(tempPos); 112 currentPtr = sortedList.at(tempPos);
113 while ( ((tempPos + 1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { 113 while ( ((tempPos + 1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) {
114 tempPos++; 114 tempPos++;
115 currentPtr = sortedList.at(tempPos); 115 currentPtr = sortedList.at(tempPos);
116 } 116 }
117 117
118 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { 118 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) {
119 temp.setNum(currentPtr->serverId); 119 temp.setNum(currentPtr->serverId);
120 qWarning("deleted message: " + temp); 120 qWarning("deleted message: " + temp);
121 sortedList.remove(tempPos); 121 sortedList.remove(tempPos);
122 122
123 return TRUE; 123 return TRUE;
124 } 124 }
125 return FALSE; 125 return FALSE;
126} 126}
127 127
128void MailList::insert(int pos, int serverId, uint size) 128void MailList::insert(int /*pos*/, int /*serverId*/, uint/* size*/)
129{ 129{
130 //sortedList.insert(pos, mPtr); 130 //sortedList.insert(pos, mPtr);
131} 131}
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp
index dc0116d..5da3bcb 100644
--- a/noncore/net/mailit/popclient.cpp
+++ b/noncore/net/mailit/popclient.cpp
@@ -42,90 +42,94 @@ PopClient::PopClient()
42 lastSync = 0; 42 lastSync = 0;
43 headerLimit = 0; 43 headerLimit = 0;
44 preview = FALSE; 44 preview = FALSE;
45} 45}
46 46
47PopClient::~PopClient() 47PopClient::~PopClient()
48{ 48{
49 delete socket; 49 delete socket;
50 delete stream; 50 delete stream;
51} 51}
52 52
53void PopClient::newConnection(const QString &target, int port) 53void PopClient::newConnection(const QString &target, int port)
54{ 54{
55 if (receiving) { 55 if (receiving) {
56 qWarning("socket in use, connection refused"); 56 qWarning("socket in use, connection refused");
57 return; 57 return;
58 } 58 }
59 59
60 status = Init; 60 status = Init;
61 61
62 socket->connectToHost(target, port); 62 socket->connectToHost(target, port);
63 receiving = TRUE; 63 receiving = TRUE;
64 //selected = FALSE; 64 //selected = FALSE;
65 65
66 emit updateStatus("DNS lookup"); 66 emit updateStatus(tr("DNS lookup"));
67} 67}
68 68
69void PopClient::setAccount(const QString &popUser, const QString &popPasswd) 69void PopClient::setAccount(const QString &popUser, const QString &popPasswd)
70{ 70{
71 popUserName = popUser; 71 popUserName = popUser;
72 popPassword = popPasswd; 72 popPassword = popPasswd;
73} 73}
74 74
75void PopClient::setSynchronize(int lastCount) 75void PopClient::setSynchronize(int lastCount)
76{ 76{
77 synchronize = TRUE; 77 synchronize = TRUE;
78 lastSync = lastCount; 78 lastSync = lastCount;
79} 79}
80 80
81void PopClient::removeSynchronize() 81void PopClient::removeSynchronize()
82{ 82{
83 synchronize = FALSE; 83 synchronize = FALSE;
84 lastSync = 0; 84 lastSync = 0;
85} 85}
86 86
87void PopClient::headersOnly(bool headers, int limit) 87void PopClient::headersOnly(bool headers, int limit)
88{ 88{
89 preview = headers; 89 preview = headers;
90 headerLimit = limit; 90 headerLimit = limit;
91} 91}
92 92
93void PopClient::setSelectedMails(MailList *list) 93void PopClient::setSelectedMails(MailList *list)
94{ 94{
95 selected = TRUE; 95 selected = TRUE;
96 mailList = list; 96 mailList = list;
97} 97}
98 98
99void PopClient::connectionEstablished() 99void PopClient::connectionEstablished()
100{ 100{
101 emit updateStatus(tr("Connection established")); 101 emit updateStatus(tr("Connection established"));
102} 102}
103 103
104void PopClient::errorHandling(int status) 104void PopClient::errorHandling(int status)
105{ 105{
106 errorHandlingWithMsg( status, QString::null );
107}
108void PopClient::errorHandlingWithMsg(int status, const QString & Msg )
109{
106 emit updateStatus(tr("Error Occured")); 110 emit updateStatus(tr("Error Occured"));
107 emit errorOccurred(status); 111 emit errorOccurred(status, Msg);
108 socket->close(); 112 socket->close();
109 receiving = FALSE; 113 receiving = FALSE;
110} 114}
111 115
112void PopClient::incomingData() 116void PopClient::incomingData()
113{ 117{
114 QString response, temp, temp2, timeStamp; 118 QString response, temp, temp2, timeStamp;
115 QString md5Source; 119 QString md5Source;
116 int start, end; 120 int start, end;
117// char *md5Digest; 121// char *md5Digest;
118 char md5Digest[16]; 122 char md5Digest[16];
119// if ( !socket->canReadLine() ) 123// if ( !socket->canReadLine() )
120// return; 124// return;
121 125
122 126
123 response = socket->readLine(); 127 response = socket->readLine();
124 128
125 switch(status) { 129 switch(status) {
126 //logging in 130 //logging in
127 case Init: { 131 case Init: {
128#ifdef APOP_TEST 132#ifdef APOP_TEST
129 start = response.find('<',0); 133 start = response.find('<',0);
130 end = response.find('>', start); 134 end = response.find('>', start);
131 if( start >= 0 && end > start ) 135 if( start >= 0 && end > start )
@@ -146,141 +150,141 @@ void PopClient::incomingData()
146 status = Stat; 150 status = Stat;
147 } 151 }
148 else 152 else
149#endif 153#endif
150 { 154 {
151 timeStamp = ""; 155 timeStamp = "";
152 *stream << "USER " << popUserName << "\r\n"; 156 *stream << "USER " << popUserName << "\r\n";
153 status = Pass; 157 status = Pass;
154 } 158 }
155 159
156 break; 160 break;
157 } 161 }
158 162
159 case Pass: { 163 case Pass: {
160 *stream << "PASS " << popPassword << "\r\n"; 164 *stream << "PASS " << popPassword << "\r\n";
161 status = Stat; 165 status = Stat;
162 166
163 break; 167 break;
164 } 168 }
165 //ask for number of messages 169 //ask for number of messages
166 case Stat: { 170 case Stat: {
167 if (response[0] == '+') { 171 if (response[0] == '+') {
168 *stream << "STAT" << "\r\n"; 172 *stream << "STAT" << "\r\n";
169 status = Mcnt; 173 status = Mcnt;
170 } else errorHandling(ErrLoginFailed); 174 } else errorHandlingWithMsg(ErrLoginFailed, response);
171 break; 175 break;
172 } 176 }
173 //get count of messages, eg "+OK 4 900.." -> int 4 177 //get count of messages, eg "+OK 4 900.." -> int 4
174 case Mcnt: { 178 case Mcnt: {
175 if (response[0] == '+') { 179 if (response[0] == '+') {
176 temp = response.replace(0, 4, ""); 180 temp = response.replace(0, 4, "");
177 int x = temp.find(" ", 0); 181 int x = temp.find(" ", 0);
178 temp.truncate((uint) x); 182 temp.truncate((uint) x);
179 newMessages = temp.toInt(); 183 newMessages = temp.toInt();
180 messageCount = 1; 184 messageCount = 1;
181 status = List; 185 status = List;
182 186
183 if (synchronize) { 187 if (synchronize) {
184 //messages deleted from server, reload all 188 //messages deleted from server, reload all
185 if (newMessages < lastSync) 189 if (newMessages < lastSync)
186 lastSync = 0; 190 lastSync = 0;
187 messageCount = 1; 191 messageCount = 1;
188 } 192 }
189 193
190 if (selected) { 194 if (selected) {
191 int *ptr = mailList->first(); 195 int *ptr = mailList->first();
192 if (ptr != 0) { 196 if (ptr != 0) {
193 newMessages++; //to ensure no early jumpout 197 newMessages++; //to ensure no early jumpout
194 messageCount = *ptr; 198 messageCount = *ptr;
195 } else newMessages = 0; 199 } else newMessages = 0;
196 } 200 }
197 201
198 } else errorHandling(ErrUnknownResponse); 202 } else errorHandlingWithMsg(ErrUnknownResponse, response);
199 } 203 }
200 //Read message number x, count upwards to messageCount 204 //Read message number x, count upwards to messageCount
201 case List: { 205 case List: {
202 if (messageCount <= newMessages) { 206 if (messageCount <= newMessages) {
203 *stream << "LIST " << messageCount << "\r\n"; 207 *stream << "LIST " << messageCount << "\r\n";
204 status = Size; 208 status = Size;
205 temp2.setNum(newMessages - lastSync); 209 temp2.setNum(newMessages - lastSync);
206 temp.setNum(messageCount - lastSync); 210 temp.setNum(messageCount - lastSync);
207 if (!selected) { 211 if (!selected) {
208 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 212 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
209 } else { 213 } else {
210 //completing a previously closed transfer 214 //completing a previously closed transfer
211 /* if ( (messageCount - lastSync) <= 0) { 215 /* if ( (messageCount - lastSync) <= 0) {
212 temp.setNum(messageCount); 216 temp.setNum(messageCount);
213 emit updateStatus(tr("Previous message ") + temp); 217 emit updateStatus(tr("Previous message ") + temp);
214 } else {*/ 218 } else {*/
215 emit updateStatus(tr("Completing message ") + temp); 219 emit updateStatus(tr("Completing message ") + temp);
216 //} 220 //}
217 } 221 }
218 break; 222 break;
219 } else { 223 } else {
220 emit updateStatus(tr("No new Messages")); 224 emit updateStatus(tr("No new Messages"));
221 status = Quit; 225 status = Quit;
222 } 226 }
223 } 227 }
224 //get size of message, eg "500 characters in message.." -> int 500 228 //get size of message, eg "500 characters in message.." -> int 500
225 case Size: { 229 case Size: {
226 if (status != Quit) { //because of idiotic switch 230 if (status != Quit) { //because of idiotic switch
227 if (response[0] == '+') { 231 if (response[0] == '+') {
228 temp = response.replace(0, 4, ""); 232 temp = response.replace(0, 4, "");
229 int x = temp.find(" ", 0); 233 int x = temp.find(" ", 0);
230 temp = temp.right(temp.length() - ((uint) x + 1) ); 234 temp = temp.right(temp.length() - ((uint) x + 1) );
231 mailSize = temp.toInt(); 235 mailSize = temp.toInt();
232 emit currentMailSize(mailSize); 236 emit currentMailSize(mailSize);
233 237
234 status = Retr; 238 status = Retr;
235 } else { 239 } else {
236 //qWarning(response); 240 //qWarning(response);
237 errorHandling(ErrUnknownResponse); 241 errorHandlingWithMsg(ErrUnknownResponse, response);
238 } 242 }
239 } 243 }
240 } 244 }
241 //Read message number x, count upwards to messageCount 245 //Read message number x, count upwards to messageCount
242 case Retr: { 246 case Retr: {
243 if (status != Quit) { 247 if (status != Quit) {
244 if ((selected)||(mailSize <= headerLimit)) 248 if ((selected)||(mailSize <= headerLimit))
245 { 249 {
246 *stream << "RETR " << messageCount << "\r\n"; 250 *stream << "RETR " << messageCount << "\r\n";
247 } else { //only header 251 } else { //only header
248 *stream << "TOP " << messageCount << " 0\r\n"; 252 *stream << "TOP " << messageCount << " 0\r\n";
249 } 253 }
250 messageCount++; 254 messageCount++;
251 status = Ignore; 255 status = Ignore;
252 break; 256 break;
253 } } 257 } }
254 case Ignore: { 258 case Ignore: {
255 if (status != Quit) { //because of idiotic switch 259 if (status != Quit) { //because of idiotic switch
256 if (response[0] == '+') { 260 if (response[0] == '+') {
257 message = ""; 261 message = "";
258 status = Read; 262 status = Read;
259 if (!socket->canReadLine()) //sync. problems 263 if (!socket->canReadLine()) //sync. problems
260 break; 264 break;
261 response = socket->readLine(); 265 response = socket->readLine();
262 } else errorHandling(ErrUnknownResponse); 266 } else errorHandlingWithMsg(ErrUnknownResponse, response);
263 } 267 }
264 } 268 }
265 //add all incoming lines to body. When size is reached, send 269 //add all incoming lines to body. When size is reached, send
266 //message, and go back to read new message 270 //message, and go back to read new message
267 case Read: { 271 case Read: {
268 if (status != Quit) { //because of idiotic switch 272 if (status != Quit) { //because of idiotic switch
269 message += response; 273 message += response;
270 while ( socket->canReadLine() ) { 274 while ( socket->canReadLine() ) {
271 response = socket->readLine(); 275 response = socket->readLine();
272 message += response; 276 message += response;
273 } 277 }
274 emit downloadedSize(message.length()); 278 emit downloadedSize(message.length());
275 int x = message.find("\r\n.\r\n",-5); 279 int x = message.find("\r\n.\r\n",-5);
276 if (x == -1) { 280 if (x == -1) {
277 break; 281 break;
278 } else { //message reach entire size 282 } else { //message reach entire size
279 if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active 283 if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active
280 { 284 {
281 emit newMessage(message, messageCount-1, mailSize, TRUE); 285 emit newMessage(message, messageCount-1, mailSize, TRUE);
282 } else { //incomplete mail downloaded 286 } else { //incomplete mail downloaded
283 emit newMessage(message, messageCount-1, mailSize, FALSE); 287 emit newMessage(message, messageCount-1, mailSize, FALSE);
284 } 288 }
285 289
286 if ((messageCount > newMessages)||(selected)) //last message ? 290 if ((messageCount > newMessages)||(selected)) //last message ?
diff --git a/noncore/net/mailit/popclient.h b/noncore/net/mailit/popclient.h
index c58bc48..6774ceb 100644
--- a/noncore/net/mailit/popclient.h
+++ b/noncore/net/mailit/popclient.h
@@ -23,54 +23,55 @@
23#include <stdio.h> 23#include <stdio.h>
24#include <qsocket.h> 24#include <qsocket.h>
25#include <qstring.h> 25#include <qstring.h>
26#include <qobject.h> 26#include <qobject.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28#include <qlist.h> 28#include <qlist.h>
29#include "maillist.h" 29#include "maillist.h"
30 30
31class PopClient: public QObject 31class PopClient: public QObject
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 PopClient(); 36 PopClient();
37 ~PopClient(); 37 ~PopClient();
38 void newConnection(const QString &target, int port); 38 void newConnection(const QString &target, int port);
39 void setAccount(const QString &popUser, const QString &popPasswd); 39 void setAccount(const QString &popUser, const QString &popPasswd);
40 void setSynchronize(int lastCount); 40 void setSynchronize(int lastCount);
41 void removeSynchronize(); 41 void removeSynchronize();
42 void headersOnly(bool headers, int limit); 42 void headersOnly(bool headers, int limit);
43 void setSelectedMails(MailList *list); 43 void setSelectedMails(MailList *list);
44 44
45signals: 45signals:
46 void newMessage(const QString &, int, uint, bool); 46 void newMessage(const QString &, int, uint, bool);
47 void errorOccurred(int status); 47 void errorOccurred(int status, const QString & Msg );
48 void updateStatus(const QString &); 48 void updateStatus(const QString &);
49 void mailTransfered(int); 49 void mailTransfered(int);
50 void mailboxSize(int); 50 void mailboxSize(int);
51 void currentMailSize(int); 51 void currentMailSize(int);
52 void downloadedSize(int); 52 void downloadedSize(int);
53 53
54public slots: 54public slots:
55 void errorHandling(int); 55 void errorHandling(int);
56 void errorHandlingWithMsg(int, const QString & );
56 57
57protected slots: 58protected slots:
58 void connectionEstablished(); 59 void connectionEstablished();
59 void incomingData(); 60 void incomingData();
60 61
61private: 62private:
62 QSocket *socket; 63 QSocket *socket;
63 QTextStream *stream; 64 QTextStream *stream;
64 enum transferStatus 65 enum transferStatus
65 { 66 {
66 Init, Pass, Stat, Mcnt, Read, List, Size, Retr, Acks, 67 Init, Pass, Stat, Mcnt, Read, List, Size, Retr, Acks,
67 Quit, Done, Ignore 68 Quit, Done, Ignore
68 }; 69 };
69 int status, lastSync; 70 int status, lastSync;
70 int messageCount, newMessages, mailSize, headerLimit; 71 int messageCount, newMessages, mailSize, headerLimit;
71 bool receiving, synchronize, preview, selected; 72 bool receiving, synchronize, preview, selected;
72 QString popUserName, popPassword, message; 73 QString popUserName, popPassword, message;
73 MailList *mailList; 74 MailList *mailList;
74}; 75};
75 76
76#endif 77#endif
diff --git a/noncore/net/mailit/smtpclient.cpp b/noncore/net/mailit/smtpclient.cpp
index 2916f45..5b5ef52 100644
--- a/noncore/net/mailit/smtpclient.cpp
+++ b/noncore/net/mailit/smtpclient.cpp
@@ -52,112 +52,119 @@ void SmtpClient::newConnection(const QString &target, int port)
52 52
53 emit updateStatus(tr("DNS lookup")); 53 emit updateStatus(tr("DNS lookup"));
54} 54}
55 55
56void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body) 56void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body)
57{ 57{
58 RawEmail *mail = new RawEmail; 58 RawEmail *mail = new RawEmail;
59 59
60 mail->from = from; 60 mail->from = from;
61 mail->subject = subject; 61 mail->subject = subject;
62 mail->to = to; 62 mail->to = to;
63 mail->body = body; 63 mail->body = body;
64 64
65 mailList.append(mail); 65 mailList.append(mail);
66} 66}
67 67
68void SmtpClient::connectionEstablished() 68void SmtpClient::connectionEstablished()
69{ 69{
70 emit updateStatus(tr("Connection established")); 70 emit updateStatus(tr("Connection established"));
71 71
72} 72}
73 73
74void SmtpClient::errorHandling(int status) 74void SmtpClient::errorHandling(int status)
75{ 75{
76 emit errorOccurred(status); 76 errorHandlingWithMsg( status, QString::null );
77}
78
79void SmtpClient::errorHandlingWithMsg(int status, const QString & EMsg )
80{
81 emit errorOccurred(status, EMsg );
77 socket->close(); 82 socket->close();
78 mailList.clear(); 83 mailList.clear();
79 sending = FALSE; 84 sending = FALSE;
80} 85}
81 86
82void SmtpClient::incomingData() 87void SmtpClient::incomingData()
83{ 88{
84 QString response; 89 QString response;
85 90
86 if (!socket->canReadLine()) 91 if (!socket->canReadLine())
87 return; 92 return;
88 93
89 response = socket->readLine(); 94 response = socket->readLine();
90
91 switch(status) { 95 switch(status) {
92 case Init: { 96 case Init: {
93 if (response[0] == '2') { 97 if (response[0] == '2') {
94 status = From; 98 status = From;
95 mailPtr = mailList.first(); 99 mailPtr = mailList.first();
96 *stream << "HELO there\r\n"; 100 *stream << "HELO there\r\n";
97 } else errorHandling(ErrUnknownResponse); 101 } else errorHandlingWithMsg(ErrUnknownResponse,response);
98 break; 102 break;
99 } 103 }
100 case From: { 104 case From: {
101 if (response[0] == '2') { 105 if (response[0] == '2') {
102 *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; 106 qDebug(mailPtr->from);
107 *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n";
103 status = Recv; 108 status = Recv;
104 } else errorHandling(ErrUnknownResponse); 109 } else errorHandlingWithMsg(ErrUnknownResponse, response );
105 break; 110 break;
106 } 111 }
107 case Recv: { 112 case Recv: {
108 if (response[0] == '2') { 113 if (response[0] == '2') {
109 it = mailPtr->to.begin(); 114 it = mailPtr->to.begin();
110 if (it == NULL) 115 if (it == NULL) {
111 errorHandling(ErrUnknownResponse); 116 errorHandlingWithMsg(ErrUnknownResponse,response);
112 *stream << "RCPT TO: " << *it << ">\r\n"; 117 }
118 *stream << "RCPT TO: <" << *it << ">\r\n";
113 status = MRcv; 119 status = MRcv;
114 } else errorHandling(ErrUnknownResponse); 120 } else errorHandlingWithMsg(ErrUnknownResponse,response);
115 break; 121 break;
116 } 122 }
117 case MRcv: { 123 case MRcv: {
118 if (response[0] == '2') { 124 if (response[0] == '2') {
119 it++; 125 it++;
120 if ( it != mailPtr->to.end() ) { 126 if ( it != mailPtr->to.end() ) {
121 *stream << "RCPT TO: <" << *it << ">\r\n"; 127 *stream << "RCPT TO: <" << *it << ">\r\n";
122 break; 128 break;
123 } else { 129 } else {
124 status = Data; 130 status = Data;
125 } 131 }
126 } else errorHandling(ErrUnknownResponse); 132 } else errorHandlingWithMsg(ErrUnknownResponse,response);
127 } 133 }
128 case Data: { 134 case Data: {
129 if (response[0] == '2') { 135 if (response[0] == '2') {
130 *stream << "DATA\r\n"; 136 *stream << "DATA\r\n";
131 status = Body; 137 status = Body;
132 emit updateStatus(tr("Sending: ") + mailPtr->subject); 138 emit updateStatus(tr("Sending: ") + mailPtr->subject);
133 } else errorHandling(ErrUnknownResponse); 139
140 } else errorHandlingWithMsg(ErrUnknownResponse,response);
134 break; 141 break;
135 } 142 }
136 case Body: { 143 case Body: {
137 if (response[0] == '3') { 144 if (response[0] == '3') {
138 *stream << mailPtr->body << "\r\n.\r\n"; 145 *stream << mailPtr->body << "\r\n.\r\n";
139 mailPtr = mailList.next(); 146 mailPtr = mailList.next();
140 if (mailPtr != NULL) { 147 if (mailPtr != NULL) {
141 status = From; 148 status = From;
142 } else { 149 } else {
143 status = Quit; 150 status = Quit;
144 } 151 }
145 } else errorHandling(ErrUnknownResponse); 152 } else errorHandlingWithMsg(ErrUnknownResponse,response);
146 break; 153 break;
147 } 154 }
148 case Quit: { 155 case Quit: {
149 if (response[0] == '2') { 156 if (response[0] == '2') {
150 *stream << "QUIT\r\n"; 157 *stream << "QUIT\r\n";
151 status = Done; 158 status = Done;
152 QString temp; 159 QString temp;
153 temp.setNum(mailList.count()); 160 temp.setNum(mailList.count());
154 emit updateStatus(tr("Sent ") + temp + tr(" messages")); 161 emit updateStatus(tr("Sent ") + temp + tr(" messages"));
155 emit mailSent(); 162 emit mailSent();
156 mailList.clear(); 163 mailList.clear();
157 sending = FALSE; 164 sending = FALSE;
158 socket->close(); 165 socket->close();
159 } else errorHandling(ErrUnknownResponse); 166 } else errorHandlingWithMsg(ErrUnknownResponse,response);
160 break; 167 break;
161 } 168 }
162 } 169 }
163} 170}
diff --git a/noncore/net/mailit/smtpclient.h b/noncore/net/mailit/smtpclient.h
index 45c0703..554ba3f 100644
--- a/noncore/net/mailit/smtpclient.h
+++ b/noncore/net/mailit/smtpclient.h
@@ -26,50 +26,51 @@
26#include <qobject.h> 26#include <qobject.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qlist.h> 29#include <qlist.h>
30 30
31struct RawEmail 31struct RawEmail
32{ 32{
33 QString from; 33 QString from;
34 QString subject; 34 QString subject;
35 QStringList to; 35 QStringList to;
36 QString body; 36 QString body;
37}; 37};
38 38
39class SmtpClient: public QObject 39class SmtpClient: public QObject
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43public: 43public:
44 SmtpClient(); 44 SmtpClient();
45 ~SmtpClient(); 45 ~SmtpClient();
46 void newConnection(const QString &target, int port); 46 void newConnection(const QString &target, int port);
47 void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body); 47 void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body);
48 48
49signals: 49signals:
50 void errorOccurred(int); 50 void errorOccurred(int, const QString & LR );
51 void updateStatus(const QString &); 51 void updateStatus(const QString &);
52 void mailSent(); 52 void mailSent();
53 53
54public slots: 54public slots:
55 void errorHandling(int); 55 void errorHandling(int);
56 void errorHandlingWithMsg(int, const QString & LastResponse );
56 57
57protected slots: 58protected slots:
58 void connectionEstablished(); 59 void connectionEstablished();
59 void incomingData(); 60 void incomingData();
60 61
61private: 62private:
62 QSocket *socket; 63 QSocket *socket;
63 QTextStream *stream; 64 QTextStream *stream;
64 enum transferStatus 65 enum transferStatus
65 { 66 {
66 Init, From, Recv, MRcv, Data, Body, Quit, Done 67 Init, From, Recv, MRcv, Data, Body, Quit, Done
67 }; 68 };
68 int status; 69 int status;
69 QList<RawEmail> mailList; 70 QList<RawEmail> mailList;
70 RawEmail *mailPtr; 71 RawEmail *mailPtr;
71 bool sending; 72 bool sending;
72 QStringList::Iterator it; 73 QStringList::Iterator it;
73}; 74};
74 75
75#endif 76#endif
diff --git a/noncore/net/mailit/viewatt.cpp b/noncore/net/mailit/viewatt.cpp
index 21885c2..293e137 100644
--- a/noncore/net/mailit/viewatt.cpp
+++ b/noncore/net/mailit/viewatt.cpp
@@ -5,86 +5,86 @@
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "resource.h" 20#include "resource.h"
21#include "viewatt.h" 21#include "viewatt.h"
22#include <qwhatsthis.h> 22#include <qwhatsthis.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/mimetype.h> 24#include <qpe/mimetype.h>
25 25
26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) 26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
27 : QMainWindow(parent, name, f) 27 : QMainWindow(parent, name, f)
28{ 28{
29 setCaption("Exploring attatchments"); 29 setCaption(tr("Exploring attatchments"));
30 30
31 setToolBarsMovable( FALSE ); 31 setToolBarsMovable( FALSE );
32 bar = new QToolBar(this); 32 bar = new QToolBar(this);
33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); 33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 );
34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); 34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) );
35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); 35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents"));
36 36
37 listView = new QListView(this, "AttView"); 37 listView = new QListView(this, "AttView");
38 listView->addColumn( "Attatchment" ); 38 listView->addColumn( tr("Attatchment") );
39 listView->addColumn( "Type" ); 39 listView->addColumn( tr("Type") );
40 listView->addColumn( "Installed" ); 40 listView->addColumn( tr("Installed") );
41 setCentralWidget(listView); 41 setCentralWidget(listView);
42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); 42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail"));
43} 43}
44 44
45void ViewAtt::update(Email *mailIn, bool inbox) 45void ViewAtt::update(Email *mailIn, bool inbox)
46{ 46{
47 QListViewItem *item; 47 QListViewItem *item;
48 Enclosure *ePtr; 48 Enclosure *ePtr;
49 49
50 50
51 51
52 listView->clear(); 52 listView->clear();
53 if (inbox) { 53 if (inbox) {
54 bar->clear(); 54 bar->clear();
55 installButton->addTo( bar ); 55 installButton->addTo( bar );
56 bar->show(); 56 bar->show();
57 } else { 57 } else {
58 bar->hide(); 58 bar->hide();
59 } 59 }
60 60
61 mail = mailIn; 61 mail = mailIn;
62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
63 63
64 QString isInstalled = "No"; 64 QString isInstalled = tr("No");
65 if (ePtr->installed) 65 if (ePtr->installed)
66 isInstalled = "Yes"; 66 isInstalled = tr("Yes");
67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); 67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
68 68
69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute; 69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
70 70
71 MimeType mt(mtypeDef); 71 MimeType mt(mtypeDef);
72 72
73 item->setPixmap(0, mt.pixmap()); 73 item->setPixmap(0, mt.pixmap());
74 74
75 /* 75 /*
76 if (ePtr->contentType == "TEXT") { 76 if (ePtr->contentType == "TEXT") {
77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0); 77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
78 actions->addTo(bar); 78 actions->addTo(bar);
79 } 79 }
80 if (ePtr->contentType == "AUDIO") { 80 if (ePtr->contentType == "AUDIO") {
81 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0); 81 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0);
82 actions->addTo(bar); 82 actions->addTo(bar);
83 item->setPixmap(0, Resource::loadPixmap("play")); 83 item->setPixmap(0, Resource::loadPixmap("play"));
84 } 84 }
85 if (ePtr->contentType == "IMAGE") { 85 if (ePtr->contentType == "IMAGE") {
86 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0); 86 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0);
87 actions->addTo(bar); 87 actions->addTo(bar);
88 item->setPixmap(0, Resource::loadPixmap("pixmap")); 88 item->setPixmap(0, Resource::loadPixmap("pixmap"));
89 }*/ 89 }*/
90 } 90 }
@@ -95,27 +95,27 @@ void ViewAtt::install()
95 Enclosure *ePtr, *selPtr; 95 Enclosure *ePtr, *selPtr;
96 QListViewItem *item; 96 QListViewItem *item;
97 QString filename; 97 QString filename;
98 DocLnk d; 98 DocLnk d;
99 99
100 item = listView->selectedItem(); 100 item = listView->selectedItem();
101 if (item != NULL) { 101 if (item != NULL) {
102 filename = item->text(0); 102 filename = item->text(0);
103 selPtr = NULL; 103 selPtr = NULL;
104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
105 if (ePtr->originalName == filename) 105 if (ePtr->originalName == filename)
106 selPtr = ePtr; 106 selPtr = ePtr;
107 } 107 }
108 108
109 if (selPtr == NULL) { 109 if (selPtr == NULL) {
110 qWarning("Internal error, file is not installed to documents"); 110 qWarning("Internal error, file is not installed to documents");
111 return; 111 return;
112 } 112 }
113 113
114 d.setName(selPtr->originalName); 114 d.setName(selPtr->originalName);
115 d.setFile(selPtr->path + selPtr->name); 115 d.setFile(selPtr->path + selPtr->name);
116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute); 116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute);
117 d.writeLink(); 117 d.writeLink();
118 selPtr->installed = TRUE; 118 selPtr->installed = TRUE;
119 item->setText(2, "Yes"); 119 item->setText(2, tr("Yes"));
120 } 120 }
121} 121}
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp
index 0298cb3..26b9660 100644
--- a/noncore/net/mailit/writemail.cpp
+++ b/noncore/net/mailit/writemail.cpp
@@ -97,57 +97,57 @@ void WriteMail::init()
97 grid->addWidget( subjetLabel, 1, 0 ); 97 grid->addWidget( subjetLabel, 1, 0 );
98 98
99 ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); 99 ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" );
100 ToolButton13_2->setText( tr( "..." ) ); 100 ToolButton13_2->setText( tr( "..." ) );
101 grid->addWidget( ToolButton13_2, 1, 2 ); 101 grid->addWidget( ToolButton13_2, 1, 2 );
102 102
103 subjectInput = new QLineEdit( widget, "subjectInput" ); 103 subjectInput = new QLineEdit( widget, "subjectInput" );
104 grid->addWidget( subjectInput, 1, 1 ); 104 grid->addWidget( subjectInput, 1, 1 );
105 QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); 105 QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here"));
106 106
107 toInput = new QLineEdit( widget, "toInput" ); 107 toInput = new QLineEdit( widget, "toInput" );
108 grid->addWidget( toInput, 0, 1 ); 108 grid->addWidget( toInput, 0, 1 );
109 QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); 109 QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here"));
110 110
111 ccInput = new QLineEdit( widget, "ccInput" ); 111 ccInput = new QLineEdit( widget, "ccInput" );
112 ccInput->hide(); 112 ccInput->hide();
113 grid->addWidget( ccInput, 0, 1 ); 113 grid->addWidget( ccInput, 0, 1 );
114 QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); 114 QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here"));
115 115
116 addressButton = new QToolButton( widget, "addressButton" ); 116 addressButton = new QToolButton( widget, "addressButton" );
117 addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); 117 addressButton->setPixmap( Resource::loadPixmap("AddressBook") );
118 addressButton->setToggleButton(TRUE); 118 addressButton->setToggleButton(TRUE);
119 grid->addWidget( addressButton, 0, 2 ); 119 grid->addWidget( addressButton, 0, 2 );
120 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); 120 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) );
121 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); 121 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your Opie addressbook"));
122 122
123 emailInput = new QMultiLineEdit( widget, "emailInput" ); 123 emailInput = new QMultiLineEdit( widget, "emailInput" );
124 grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); 124 grid->addMultiCellWidget( emailInput, 2, 2, 0, 2);
125 QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); 125 QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here"));
126 126
127 addressView = new QListView( widget, "addressView"); 127 addressView = new QListView( widget, "addressView");
128 addressView->addColumn("Name"); 128 addressView->addColumn(tr("Name"));
129 addressView->addColumn("EMail"); 129 addressView->addColumn(tr("EMail") );
130 addressView->setAllColumnsShowFocus(TRUE); 130 addressView->setAllColumnsShowFocus(TRUE);
131 addressView->setMultiSelection(TRUE); 131 addressView->setMultiSelection(TRUE);
132 addressView->hide(); 132 addressView->hide();
133 grid->addMultiCellWidget( addressView, 3, 3, 0, 2); 133 grid->addMultiCellWidget( addressView, 3, 3, 0, 2);
134 QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); 134 QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list"));
135 135
136 okButton = new QToolButton(bar, "ok"); 136 okButton = new QToolButton(bar, "ok");
137 okButton->setPixmap( Resource::loadPixmap("enter") ); 137 okButton->setPixmap( Resource::loadPixmap("enter") );
138 okButton->hide(); 138 okButton->hide();
139 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); 139 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) );
140 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); 140 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here"));
141 141
142 setCentralWidget(widget); 142 setCentralWidget(widget);
143} 143}
144 144
145void WriteMail::reject() 145void WriteMail::reject()
146{ 146{
147 emit cancelMail(); 147 emit cancelMail();
148} 148}
149 149
150void WriteMail::accept() 150void WriteMail::accept()
151{ 151{
152 QStringList attachedFiles, attachmentsType; 152 QStringList attachedFiles, attachmentsType;
153 int idCount = 0; 153 int idCount = 0;
@@ -262,57 +262,57 @@ void WriteMail::reply(Email replyMail, bool replyAll)
262 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)
263 { 263 {
264 ccRecipients.append(*it); 264 ccRecipients.append(*it);
265 ccRecipients.append(";"); 265 ccRecipients.append(";");
266 } 266 }
267 ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end 267 ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end
268 ccInput->setText(ccRecipients); 268 ccInput->setText(ccRecipients);
269 } 269 }
270 else ccInput->clear(); 270 else ccInput->clear();
271 271
272 subjectInput->setText(tr("Re: ") + mail.subject); 272 subjectInput->setText(tr("Re: ") + mail.subject);
273 273
274 QString citation=mail.fromMail; 274 QString citation=mail.fromMail;
275 citation.append(tr(" wrote on ")); 275 citation.append(tr(" wrote on "));
276 citation.append(mail.date); 276 citation.append(mail.date);
277 citation.append(":\n"); 277 citation.append(":\n");
278 278
279 279
280 //mail.body.insert(0,tr("On")); 280 //mail.body.insert(0,tr("On"));
281 pos = 0; 281 pos = 0;
282 mail.body.insert(pos, ">"); 282 mail.body.insert(pos, ">");
283 while (pos != -1) { 283 while (pos != -1) {
284 pos = mail.body.find('\n', pos); 284 pos = mail.body.find('\n', pos);
285 if (pos != -1) 285 if (pos != -1)
286 mail.body.insert(++pos, ">>"); 286 mail.body.insert(++pos, ">");
287 } 287 }
288 mail.body.insert(0,citation); 288 mail.body.insert(0,citation);
289 emailInput->setText(mail.body); 289 emailInput->setText(mail.body);
290} 290}
291 291
292void WriteMail::forward(Email forwMail) 292void WriteMail::forward(Email forwMail)
293{ 293{
294 int pos=0; 294 // int pos=0;
295 295
296 QString fwdBody=tr("======forwarded message from "); 296 QString fwdBody=tr("======forwarded message from ");
297 fwdBody.append(forwMail.fromMail); 297 fwdBody.append(forwMail.fromMail);
298 fwdBody.append(tr(" starts======\n\n")); 298 fwdBody.append(tr(" starts======\n\n"));
299 299
300 mail=forwMail; 300 mail=forwMail;
301 toInput->setText(""); 301 toInput->setText("");
302 ccInput->setText(""); 302 ccInput->setText("");
303 subjectInput->setText(tr("FWD: ") + mail.subject); 303 subjectInput->setText(tr("FWD: ") + mail.subject);
304 304
305 fwdBody+=mail.body; 305 fwdBody+=mail.body;
306 fwdBody+=QString(tr("======end of forwarded message======\n\n")); 306 fwdBody+=QString(tr("======end of forwarded message======\n\n"));
307 307
308 emailInput->setText(fwdBody); 308 emailInput->setText(fwdBody);
309} 309}
310 310
311bool WriteMail::getRecipients(bool ccField) 311bool WriteMail::getRecipients(bool ccField)
312{ 312{
313 QString str, temp; 313 QString str, temp;
314 int pos = 0; 314 int pos = 0;
315 315
316 if (ccField) 316 if (ccField)
317 { 317 {
318 mail.carbonCopies.clear(); 318 mail.carbonCopies.clear();
diff --git a/noncore/unsupported/mailit/addatt.cpp b/noncore/unsupported/mailit/addatt.cpp
index daefac6..19ac58f 100644
--- a/noncore/unsupported/mailit/addatt.cpp
+++ b/noncore/unsupported/mailit/addatt.cpp
@@ -35,49 +35,49 @@ FileItem::FileItem(QListView *parent, DocLnk* dl)
35 setText(0, doclnk->name()); 35 setText(0, doclnk->name());
36 36
37 /*if (fileType == "Picture") { 37 /*if (fileType == "Picture") {
38 setPixmap(0, Resource::loadPixmap("pixmap")); 38 setPixmap(0, Resource::loadPixmap("pixmap"));
39 } else if (fileType == "Document") { 39 } else if (fileType == "Document") {
40 setPixmap(0, Resource::loadPixmap("txt")); 40 setPixmap(0, Resource::loadPixmap("txt"));
41 } else if (fileType == "Sound") { 41 } else if (fileType == "Sound") {
42 setPixmap(0, Resource::loadPixmap("play")); 42 setPixmap(0, Resource::loadPixmap("play"));
43 } else if (fileType == "Movie") { 43 } else if (fileType == "Movie") {
44 setPixmap(0, Resource::loadPixmap("MPEGPlayer")); 44 setPixmap(0, Resource::loadPixmap("MPEGPlayer"));
45 } else if (fileType == "File") { 45 } else if (fileType == "File") {
46 setPixmap(0, Resource::loadPixmap("exec")); 46 setPixmap(0, Resource::loadPixmap("exec"));
47 }*/ 47 }*/
48} 48}
49 49
50FileItem::~FileItem() 50FileItem::~FileItem()
51{ 51{
52 if (doclnk!=NULL) delete doclnk; 52 if (doclnk!=NULL) delete doclnk;
53 doclnk=NULL; 53 doclnk=NULL;
54} 54}
55 55
56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f) 56AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
57 : QDialog(parent, name, f) 57 : QDialog(parent, name, f)
58{ 58{
59 setCaption("Adding attachments"); 59 setCaption(tr("Adding attachments") );
60 60
61 QGridLayout *top = new QGridLayout(this, 1,1 ); 61 QGridLayout *top = new QGridLayout(this, 1,1 );
62 62
63 QHBox *buttons=new QHBox(this); 63 QHBox *buttons=new QHBox(this);
64 /*fileCategoryButton = new QPushButton(this);*/ 64 /*fileCategoryButton = new QPushButton(this);*/
65 attachButton = new QPushButton(tr("attach..."), buttons); 65 attachButton = new QPushButton(tr("attach..."), buttons);
66 removeButton = new QPushButton(tr("Remove"), buttons); 66 removeButton = new QPushButton(tr("Remove"), buttons);
67 67
68 /*fileCategories = new QPopupMenu(fileCategoryButton); 68 /*fileCategories = new QPopupMenu(fileCategoryButton);
69 fileCategoryButton->setPopup(fileCategories); 69 fileCategoryButton->setPopup(fileCategories);
70 fileCategories->insertItem("Document"); 70 fileCategories->insertItem("Document");
71 fileCategories->insertItem("Picture"); 71 fileCategories->insertItem("Picture");
72 fileCategories->insertItem("Sound"); 72 fileCategories->insertItem("Sound");
73 fileCategories->insertItem("Movie"); 73 fileCategories->insertItem("Movie");
74 fileCategories->insertItem("File"); 74 fileCategories->insertItem("File");
75 75
76 fileCategoryButton->setText("Document"); 76 fileCategoryButton->setText("Document");
77 top->addWidget(fileCategoryButton, 0, 0);*/ 77 top->addWidget(fileCategoryButton, 0, 0);*/
78 78
79 79
80 top->addWidget(buttons,1,0); 80 top->addWidget(buttons,1,0);
81 //buttons->addWidget(attachButton,0,0); 81 //buttons->addWidget(attachButton,0,0);
82 //buttons->addWidget(removeButton,0,1); 82 //buttons->addWidget(removeButton,0,1);
83 83
@@ -101,49 +101,49 @@ AddAtt::AddAtt(QWidget *parent, const char *name, WFlags f)
101 SLOT(removeattachment()) ); 101 SLOT(removeattachment()) );
102 102
103 //top->addWidget(ofs, 0,0); 103 //top->addWidget(ofs, 0,0);
104 top->addWidget(attView, 0,0); 104 top->addWidget(attView, 0,0);
105 105
106 clear(); 106 clear();
107 107
108 108
109} 109}
110 110
111void AddAtt::clear() 111void AddAtt::clear()
112{ 112{
113 attView->clear(); 113 attView->clear();
114 //getFiles(); 114 //getFiles();
115 modified = FALSE; 115 modified = FALSE;
116} 116}
117 117
118/*void AddAtt::fileCategorySelected(int id) 118/*void AddAtt::fileCategorySelected(int id)
119{ 119{
120 fileCategoryButton->setText(fileCategories->text(id)); 120 fileCategoryButton->setText(fileCategories->text(id));
121 getFiles(); 121 getFiles();
122}*/ 122}*/
123 123
124void AddAtt::addattachment() 124void AddAtt::addattachment()
125 { 125 {// ### FIXME wrong use -zecke
126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents"); 126 OFileDialog ofs("Attachments",this,0,0,"/root/Documents");
127 127
128 ofs.showMaximized(); 128 ofs.showMaximized();
129 129
130 if (ofs.exec()==QDialog::Accepted) 130 if (ofs.exec()==QDialog::Accepted)
131 { 131 {
132 DocLnk* dl=new DocLnk(ofs.selectedDocument()); 132 DocLnk* dl=new DocLnk(ofs.selectedDocument());
133 FileItem* fi=new FileItem(attView,dl); 133 FileItem* fi=new FileItem(attView,dl);
134 fi->setPixmap(0,dl->pixmap()); 134 fi->setPixmap(0,dl->pixmap());
135 fi->setText(1,dl->type()); 135 fi->setText(1,dl->type());
136 attView->insertItem(fi); 136 attView->insertItem(fi);
137 modified = TRUE; 137 modified = TRUE;
138 } 138 }
139} 139}
140 140
141void AddAtt::removeattachment() 141void AddAtt::removeattachment()
142{ 142{
143 if (attView->selectedItem() != NULL) 143 if (attView->selectedItem() != NULL)
144 { 144 {
145 attView->takeItem(attView->selectedItem()); 145 attView->takeItem(attView->selectedItem());
146 } 146 }
147 modified = TRUE; 147 modified = TRUE;
148} 148}
149 149
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp
index da1226c..749a4e9 100644
--- a/noncore/unsupported/mailit/emailclient.cpp
+++ b/noncore/unsupported/mailit/emailclient.cpp
@@ -38,52 +38,52 @@ MailAccount* AccountList::dupl(MailAccount *in)
38{ 38{
39 ac = new MailAccount(*in); 39 ac = new MailAccount(*in);
40 return ac; 40 return ac;
41} 41}
42 42
43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) 43EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl )
44 : QMainWindow( parent, name, fl ) 44 : QMainWindow( parent, name, fl )
45{ 45{
46 emailHandler = new EmailHandler(); 46 emailHandler = new EmailHandler();
47 addressList = new AddressList(); 47 addressList = new AddressList();
48 48
49 sending = FALSE; 49 sending = FALSE;
50 receiving = FALSE; 50 receiving = FALSE;
51 previewingMail = FALSE; 51 previewingMail = FALSE;
52 mailIdCount = 1; 52 mailIdCount = 1;
53 accountIdCount = 1; 53 accountIdCount = 1;
54 allAccounts = FALSE; 54 allAccounts = FALSE;
55 55
56 init(); 56 init();
57 57
58 58
59 59
60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); 60 connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) );
61 61
62 connect(emailHandler, SIGNAL(smtpError(int)), this, 62 connect(emailHandler, SIGNAL(smtpError(int,const QString &)), this,
63 SLOT(smtpError(int)) ); 63 SLOT(smtpError(int,const QString &)) );
64 connect(emailHandler, SIGNAL(popError(int)), this, 64 connect(emailHandler, SIGNAL(popError(int,const QString &)), this,
65 SLOT(popError(int)) ); 65 SLOT(popError(int,const QString &)) );
66 66
67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); 67 connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) );
68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); 68 connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) );
69 69
70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); 70 connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) );
71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); 71 connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) );
72 72
73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, 73 connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this,
74 SLOT(mailArrived(const Email &, bool)) ); 74 SLOT(mailArrived(const Email &, bool)) );
75 connect(emailHandler, SIGNAL(mailTransfered(int)), this, 75 connect(emailHandler, SIGNAL(mailTransfered(int)), this,
76 SLOT(allMailArrived(int)) ); 76 SLOT(allMailArrived(int)) );
77 77
78 mailconf = new Config("mailit"); 78 mailconf = new Config("mailit");
79 //In case Synchronize is not defined in settings.txt 79 //In case Synchronize is not defined in settings.txt
80 80
81 readSettings(); 81 readSettings();
82 82
83 updateAccounts(); 83 updateAccounts();
84 84
85 lineShift = "\n"; 85 lineShift = "\n";
86 readMail(); 86 readMail();
87 lineShift = "\r\n"; 87 lineShift = "\r\n";
88 88
89 mailboxView->setCurrentTab(0); //ensure that inbox has focus 89 mailboxView->setCurrentTab(0); //ensure that inbox has focus
@@ -459,130 +459,135 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
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)) { 469 if ((!found)||(fromDisk)) {
470 item = new EmailListItem(inboxView, newMail, TRUE); 470 item = new EmailListItem(inboxView, newMail, TRUE);
471 } 471 }
472// if (item->getMail()->files.count()>0) 472// if (item->getMail()->files.count()>0)
473// { 473// {
474// item->setPixmap(0, Resource::loadPixmap("mailit/attach")); 474// item->setPixmap(0, Resource::loadPixmap("mailit/attach"));
475// } 475// }
476 /*if (!newMail.downloaded) 476 /*if (!newMail.downloaded)
477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/ 477 mailDownloadList.sizeInsert(newMail.serverId, newMail.size);*/
478 478
479 mailboxView->setCurrentTab(0); 479 mailboxView->setCurrentTab(0);
480 480
481} 481}
482 482
483void EmailClient::allMailArrived(int count) 483void EmailClient::allMailArrived(int /*count*/)
484{ 484{
485 // not previewing means all mailtransfer has been done 485 // not previewing means all mailtransfer has been done
486 /*if (!previewingMail) {*/ 486 /*if (!previewingMail) {*/
487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) { 487 if ( (allAccounts) && ( (currentAccount = accountList.next()) !=0 ) ) {
488 emit newCaption("Mailit - " + currentAccount->accountName); 488 emit newCaption("Mailit - " + currentAccount->accountName);
489 getNewMail(); 489 getNewMail();
490 return; 490 return;
491 } else { 491 } else {
492 allAccounts = FALSE; 492 allAccounts = FALSE;
493 receiving = FALSE; 493 receiving = FALSE;
494 getMailButton->setEnabled(TRUE); 494 getMailButton->setEnabled(TRUE);
495 cancelButton->setEnabled(FALSE); 495 cancelButton->setEnabled(FALSE);
496 selectAccountMenu->setEnabled(TRUE); 496 selectAccountMenu->setEnabled(TRUE);
497 status1Label->setText("Idle"); 497 status1Label->setText("Idle");
498 498
499 progressBar->reset(); 499 progressBar->reset();
500 return; 500 return;
501 } 501 }
502 //} 502 //}
503 503
504 // all headers downloaded from server, start downloading remaining mails 504 // all headers downloaded from server, start downloading remaining mails
505 previewingMail = FALSE; 505 previewingMail = FALSE;
506 status1Label->setText(currentAccount->accountName); 506 status1Label->setText(currentAccount->accountName);
507 progressBar->reset(); 507 progressBar->reset();
508 508
509 509
510 mailboxView->setCurrentTab(0); 510 mailboxView->setCurrentTab(0);
511} 511}
512 512
513 513
514void EmailClient::moveMailFront(Email *mailPtr) 514void EmailClient::moveMailFront(Email *mailPtr)
515{ 515{
516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 516 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 517 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
518 } 518 }
519} 519}
520 520
521void EmailClient::smtpError(int code) 521void EmailClient::smtpError(int code, const QString & Msg)
522{ 522{
523 QString temp; 523 QString temp;
524 524
525 if (code == ErrUnknownResponse) 525 if (code == ErrUnknownResponse) {
526 temp = "Unknown response from server"; 526 temp = tr("<qt>Unknown response from server</qt>");
527 527 if( ! Msg.isEmpty() )
528 if (code == QSocket::ErrHostNotFound) 528 temp += Msg;
529 temp = "host not found"; 529 } else if (code == QSocket::ErrHostNotFound) {
530 if (code == QSocket::ErrConnectionRefused) 530 temp = tr("<qt>host not found</qt>");
531 temp = "connection refused"; 531 } else if (code == QSocket::ErrConnectionRefused) {
532 if (code == QSocket::ErrSocketRead) 532 temp = tr("<qt>connection refused</qt>");
533 temp = "socket packet error"; 533 } else if (code == QSocket::ErrSocketRead) {
534 temp = tr("<qt>socket packet error</qt>");
535 }
534 536
535 if (code != ErrCancel) { 537 if (code != ErrCancel) {
536 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n"); 538 QMessageBox::warning(qApp->activeWindow(), "Sending error", temp, "OK\n");
537 } else { 539 } else {
538 status2Label->setText("Aborted by user"); 540 status2Label->setText("Aborted by user");
539 } 541 }
540 542
541 sending = FALSE; 543 sending = FALSE;
542 sendMailButton->setEnabled(TRUE); 544 sendMailButton->setEnabled(TRUE);
543 cancelButton->setEnabled(FALSE); 545 cancelButton->setEnabled(FALSE);
544 quedMessages.clear(); 546 quedMessages.clear();
545} 547}
546 548
547void EmailClient::popError(int code) 549void EmailClient::popError(int code, const QString & Msg)
548{ 550{
549 QString temp; 551 QString temp;
550 552
551 if (code == ErrUnknownResponse) 553 if (code == ErrUnknownResponse) {
552 temp = "Unknown response from server"; 554 temp = tr("<qt>Unknown response from server</qt>");
553 if (code == ErrLoginFailed) 555 if( ! Msg.isEmpty() )
554 temp = "Login failed\nCheck user name and password"; 556 temp += Msg;
555 557 } else if (code == ErrLoginFailed) {
556 if (code == QSocket::ErrHostNotFound) 558 temp = tr("<qt>Login failed\nCheck user name and password</qt>");
557 temp = "host not found"; 559 } else if (code == QSocket::ErrHostNotFound) {
558 if (code == QSocket::ErrConnectionRefused) 560 temp = tr("<qt>host not found</qt>");
559 temp = "connection refused"; 561 } else if (code == QSocket::ErrConnectionRefused) {
560 if (code == QSocket::ErrSocketRead) 562 temp = tr("<qt>connection refused</qt>");
561 temp = "socket packet error"; 563 } else if (code == QSocket::ErrSocketRead) {
564 temp = tr("<qt>socket packet error</qt>");
565 }
562 566
563 if (code != ErrCancel) { 567 if (code != ErrCancel) {
564 QMessageBox::warning(qApp->activeWindow(), "Receiving error", temp, "OK\n"); 568 QMessageBox::warning(qApp->activeWindow(), tr("Receiving error"), temp, tr("OK\n"));
569
565 } else { 570 } else {
566 status2Label->setText("Aborted by user"); 571 status2Label->setText("Aborted by user");
567 } 572 }
568 573
569 receiving = FALSE; 574 receiving = FALSE;
570 getMailButton->setEnabled(TRUE); 575 getMailButton->setEnabled(TRUE);
571 cancelButton->setEnabled(FALSE); 576 cancelButton->setEnabled(FALSE);
572 selectAccountMenu->setEnabled(TRUE); 577 selectAccountMenu->setEnabled(TRUE);
573} 578}
574 579
575void EmailClient::inboxItemSelected() 580void EmailClient::inboxItemSelected()
576{ 581{
577 //killTimer(timerID); 582 //killTimer(timerID);
578 583
579 item = (EmailListItem*) inboxView->selectedItem(); 584 item = (EmailListItem*) inboxView->selectedItem();
580 if (item != NULL) { 585 if (item != NULL) {
581 emit viewEmail(inboxView, item->getMail()); 586 emit viewEmail(inboxView, item->getMail());
582 } 587 }
583} 588}
584 589
585void EmailClient::outboxItemSelected() 590void EmailClient::outboxItemSelected()
586{ 591{
587 //killTimer(timerID); 592 //killTimer(timerID);
588 593
@@ -877,146 +882,146 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox)
877 882
878 mailconf->setGroup(mPtr->id); 883 mailconf->setGroup(mPtr->id);
879 mailconf->clearGroup(); 884 mailconf->clearGroup();
880 885
881 //delete any temporary attatchemnts storing 886 //delete any temporary attatchemnts storing
882 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { 887 for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) {
883 if (ePtr->saved) { 888 if (ePtr->saved) {
884 QFile::remove( (ePtr->path + ePtr->name) ); 889 QFile::remove( (ePtr->path + ePtr->name) );
885 } 890 }
886 } 891 }
887 inboxView->takeItem(mailItem); 892 inboxView->takeItem(mailItem);
888 } 893 }
889 else 894 else
890 { 895 {
891 outboxView->takeItem(mailItem); 896 outboxView->takeItem(mailItem);
892 } 897 }
893} 898}
894 899
895void EmailClient::setMailSize(int size) 900void EmailClient::setMailSize(int size)
896{ 901{
897 progressBar->reset(); 902 progressBar->reset();
898 progressBar->setTotalSteps(size); 903 progressBar->setTotalSteps(size);
899} 904}
900 905
901void EmailClient::setTotalSize(int size) 906void EmailClient::setTotalSize(int /*size*/)
902{ 907{
903 908
904} 909}
905 910
906void EmailClient::setDownloadedSize(int size) 911void EmailClient::setDownloadedSize(int size)
907{ 912{
908 int total = progressBar->totalSteps(); 913 int total = progressBar->totalSteps();
909 914
910 if (size < total) { 915 if (size < total) {
911 progressBar->setProgress(size); 916 progressBar->setProgress(size);
912 } else { 917 } else {
913 progressBar->setProgress(total); 918 progressBar->setProgress(total);
914 } 919 }
915} 920}
916 921
917void EmailClient::deleteItem() 922void EmailClient::deleteItem()
918{ 923{
919 bool inbox=mailboxView->currentTab()==0; 924 bool inbox=mailboxView->currentTab()==0;
920 QListView* box; 925 QListView* box;
921 926
922 EmailListItem* eli; 927 EmailListItem* eli;
923 int pos; 928 // int pos;
924 929
925 inbox ? box=inboxView : box=outboxView; 930 inbox ? box=inboxView : box=outboxView;
926 931
927 eli=(EmailListItem*)box->selectedItem(); 932 eli=(EmailListItem*)box->selectedItem();
928 933
929 if (eli) 934 if (eli)
930 { 935 {
931 box->setSelected(eli->itemBelow(),true); //select the previous item 936 box->setSelected(eli->itemBelow(),true); //select the previous item
932 937
933 deleteMail(eli,(bool&)inbox); //remove mail entry 938 deleteMail(eli,(bool&)inbox); //remove mail entry
934 } 939 }
935} 940}
936 941
937void EmailClient::inboxItemPressed() 942void EmailClient::inboxItemPressed()
938{ 943{
939// timerID=startTimer(500); 944// timerID=startTimer(500);
940} 945}
941 946
942void EmailClient::inboxItemReleased() 947void EmailClient::inboxItemReleased()
943{ 948{
944 // killTimer(timerID); 949 // killTimer(timerID);
945} 950}
946 951
947/*void EmailClient::timerEvent(QTimerEvent *e) 952/*void EmailClient::timerEvent(QTimerEvent *e)
948{ 953{
949 /*killTimer(timerID); 954 //killTimer(timerID);
950 955
951 956
952 QPopupMenu *action = new QPopupMenu(this); 957 QPopupMenu *action = new QPopupMenu(this);
953 958
954 int reply=0; 959 int reply=0;
955 960
956 action->insertItem(tr( "Reply To" ),this,SLOT(reply())); 961 action->insertItem(tr( "Reply To" ),this,SLOT(reply()));
957 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); 962 action->insertItem( tr( "Reply All" ),this,SLOT(replyAll()));
958 action->insertItem( tr( "Forward" ), this,SLOT(forward())); 963 action->insertItem( tr( "Forward" ), this,SLOT(forward()));
959 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); 964 action->insertItem( tr( "Remove Mail" ), this,SLOT(remove()));
960 965
961 action->exec(QCursor::pos()); 966 action->exec(QCursor::pos());
962 967
963 if (action) delete action; 968 if (action) delete action;
964 969
965}*/ 970}*/
966 971
967Email* EmailClient::getCurrentMail() 972Email* EmailClient::getCurrentMail()
968{ 973{
969 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); 974 EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem());
970 if (eli!=NULL) 975 if (eli!=NULL)
971 return eli->getMail(); 976 return eli->getMail();
972 else 977 else
973 return NULL; 978 return NULL;
974} 979}
975 980
976void EmailClient::download(Email* mail) 981void EmailClient::download(Email* mail)
977{ 982{
978 MailAccount* acc=0; 983 MailAccount* acc=0;
979 984
980 tempMailDownloadList.clear(); 985 tempMailDownloadList.clear();
981 tempMailDownloadList.sizeInsert(mail->serverId, mail->size); 986 tempMailDownloadList.sizeInsert(mail->serverId, mail->size);
982 987
983 acc=accountList.at(mail->fromAccountId-1); 988 acc=accountList.at(mail->fromAccountId-1);
984 if (acc) 989 if (acc)
985 { 990 {
986 emailHandler->setAccount(*acc); 991 emailHandler->setAccount(*acc);
987 emailHandler->getMailByList(&tempMailDownloadList); 992 emailHandler->getMailByList(&tempMailDownloadList);
988 } 993 }
989 else 994 else
990 QMessageBox::warning(qApp->activeWindow(), 995 QMessageBox::warning(qApp->activeWindow(),
991 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); 996 tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n");
992} 997}
993 998
994void EmailClient::receive(const QCString& msg, const QByteArray& data) 999void EmailClient::receive(const QCString& /*msg*/, const QByteArray& /*data*/)
995{ 1000{
996 /*if (msg=="getMail()") 1001 /*if (msg=="getMail()")
997 { 1002 {
998 /*QDialog qd(qApp->activeWindow(),"Getting mail",true); 1003 //QDialog qd(qApp->activeWindow(),"Getting mail",true);
999 QVBoxLayout *vbProg = new QVBoxLayout( &qd ); 1004 QVBoxLayout *vbProg = new QVBoxLayout( &qd );
1000 1005
1001 initStatusBar(&qd); 1006 initStatusBar(&qd);
1002 1007
1003 if (statusBar==0) 1008 if (statusBar==0)
1004 { 1009 {
1005 qDebug("No Bar ..."); 1010 qDebug("No Bar ...");
1006 //statusBar=new ProgressBar(&qd); 1011 //statusBar=new ProgressBar(&qd);
1007 } 1012 }
1008 statusBar->show(); 1013 statusBar->show();
1009 vbProg->addWidget(statusBar); 1014 vbProg->addWidget(statusBar);
1010 qd.showMaximized(); 1015 qd.showMaximized();
1011 qd.show(); 1016 qd.show();
1012 emit getAllNewMail(); 1017 emit getAllNewMail();
1013 //qd.exec(); 1018 //qd.exec();
1014 } 1019 }
1015 else if (msg=="compose()") 1020 else if (msg=="compose()")
1016 { 1021 {
1017 QDialog qd(qApp->activeWindow(),"Getting mail",true); 1022 QDialog qd(qApp->activeWindow(),"Getting mail",true);
1018 1023
1019 WriteMail wm(&qd,"write new mail"); 1024 WriteMail wm(&qd,"write new mail");
1020 QVBoxLayout vbProg( &qd ); 1025 QVBoxLayout vbProg( &qd );
1021 1026
1022 wm.showMaximized(); 1027 wm.showMaximized();
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h
index c98cfce..80c6d31 100644
--- a/noncore/unsupported/mailit/emailclient.h
+++ b/noncore/unsupported/mailit/emailclient.h
@@ -77,50 +77,50 @@ protected:
77 77
78signals: 78signals:
79 void composeRequested(); 79 void composeRequested();
80 void viewEmail(QListView *, Email *); 80 void viewEmail(QListView *, Email *);
81 void mailUpdated(Email *); 81 void mailUpdated(Email *);
82 void newCaption(const QString &); 82 void newCaption(const QString &);
83 void replyRequested(Email&, bool&); 83 void replyRequested(Email&, bool&);
84 void forwardRequested(Email&); 84 void forwardRequested(Email&);
85 void removeItem(EmailListItem*, bool&); 85 void removeItem(EmailListItem*, bool&);
86 /*void reply(Email&); 86 /*void reply(Email&);
87 void replyAll(Email&); 87 void replyAll(Email&);
88 void remove(Email&); 88 void remove(Email&);
89 void forward(Email&);*/ 89 void forward(Email&);*/
90 90
91public slots: 91public slots:
92 void compose(); 92 void compose();
93 void cancel(); 93 void cancel();
94 void enqueMail(const Email &mail); 94 void enqueMail(const Email &mail);
95 void setMailAccount(); 95 void setMailAccount();
96 void sendQuedMail(); 96 void sendQuedMail();
97 void mailSent(); 97 void mailSent();
98 void deleteItem(); 98 void deleteItem();
99 void getNewMail(); 99 void getNewMail();
100 void getAllNewMail(); 100 void getAllNewMail();
101 void smtpError(int code); 101 void smtpError(int code, const QString & Msg );
102 void popError(int code); 102 void popError(int code, const QString & Msg);
103 void inboxItemSelected(); 103 void inboxItemSelected();
104 void outboxItemSelected(); 104 void outboxItemSelected();
105 void inboxItemPressed(); 105 void inboxItemPressed();
106 void inboxItemReleased(); 106 void inboxItemReleased();
107 void mailArrived(const Email &mail, bool fromDisk); 107 void mailArrived(const Email &mail, bool fromDisk);
108 void allMailArrived(int); 108 void allMailArrived(int);
109 void saveMail(const QString &fileName, QListView *view); 109 void saveMail(const QString &fileName, QListView *view);
110 void selectAccount(int); 110 void selectAccount(int);
111 void editAccount(int); 111 void editAccount(int);
112 void updateAccounts(); 112 void updateAccounts();
113 void deleteAccount(int); 113 void deleteAccount(int);
114 void deleteMail(EmailListItem *mailItem, bool &inbox); 114 void deleteMail(EmailListItem *mailItem, bool &inbox);
115 void setTotalSize(int); 115 void setTotalSize(int);
116 void setMailSize(int); 116 void setMailSize(int);
117 void setDownloadedSize(int); 117 void setDownloadedSize(int);
118 void moveMailFront(Email *mailPtr); 118 void moveMailFront(Email *mailPtr);
119 void download(Email*); 119 void download(Email*);
120/* void reply(); 120/* void reply();
121 void replyAll(); 121 void replyAll();
122 void forward(); 122 void forward();
123 void remove();*/ 123 void remove();*/
124 124
125private slots: 125private slots:
126 void receive(const QCString&, const QByteArray&); 126 void receive(const QCString&, const QByteArray&);
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp
index 39f693d..5b8bda1 100644
--- a/noncore/unsupported/mailit/emailhandler.cpp
+++ b/noncore/unsupported/mailit/emailhandler.cpp
@@ -23,56 +23,56 @@
23#include <qmessagebox.h> 23#include <qmessagebox.h>
24#include <qcstring.h> 24#include <qcstring.h>
25#include "emailhandler.h" 25#include "emailhandler.h"
26#include <qpe/applnk.h> 26#include <qpe/applnk.h>
27#include <qpe/filemanager.h> 27#include <qpe/filemanager.h>
28 28
29QCollection::Item EnclosureList::newItem(QCollection::Item d) 29QCollection::Item EnclosureList::newItem(QCollection::Item d)
30{ 30{
31 return dupl( (Enclosure *) d); 31 return dupl( (Enclosure *) d);
32} 32}
33 33
34Enclosure* EnclosureList::dupl(Enclosure *in) 34Enclosure* EnclosureList::dupl(Enclosure *in)
35{ 35{
36 ac = new Enclosure(*in); 36 ac = new Enclosure(*in);
37 return ac; 37 return ac;
38} 38}
39 39
40EmailHandler::EmailHandler() 40EmailHandler::EmailHandler()
41{ 41{
42 qDebug("EMailHandler::EmailHandler"); 42 qDebug("EMailHandler::EmailHandler");
43 43
44 smtpClient = new SmtpClient(); 44 smtpClient = new SmtpClient();
45 popClient = new PopClient(); 45 popClient = new PopClient();
46 46
47 connect(smtpClient, SIGNAL(errorOccurred(int)), this, 47 connect(smtpClient, SIGNAL(errorOccurred(int, const QString &)), this,
48 SIGNAL(smtpError(int)) ); 48 SIGNAL(smtpError(int, const QString &)) );
49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) ); 49 connect(smtpClient, SIGNAL(mailSent()), this, SIGNAL(mailSent()) );
50 connect(smtpClient, SIGNAL(updateStatus(const QString &)), this, 50 connect(smtpClient, SIGNAL(updateStatus(const QString &)), this,
51 SIGNAL(updateSmtpStatus(const QString &)) ); 51 SIGNAL(updateSmtpStatus(const QString &)) );
52 52
53 connect(popClient, SIGNAL(errorOccurred(int)), this, 53 connect(popClient, SIGNAL(errorOccurred(int, const QString &)), this,
54 SIGNAL(popError(int)) ); 54 SIGNAL(popError(int, const QString &)) );
55 connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)), 55 connect(popClient, SIGNAL(newMessage(const QString &, int, uint, bool)),
56 this, SLOT(messageArrived(const QString &, int, uint, bool)) ); 56 this, SLOT(messageArrived(const QString &, int, uint, bool)) );
57 connect(popClient, SIGNAL(updateStatus(const QString &)), this, 57 connect(popClient, SIGNAL(updateStatus(const QString &)), this,
58 SIGNAL(updatePopStatus(const QString &)) ); 58 SIGNAL(updatePopStatus(const QString &)) );
59 connect(popClient, SIGNAL(mailTransfered(int)), this, 59 connect(popClient, SIGNAL(mailTransfered(int)), this,
60 SIGNAL(mailTransfered(int)) ); 60 SIGNAL(mailTransfered(int)) );
61 61
62 62
63 //relaying size information 63 //relaying size information
64 connect(popClient, SIGNAL(currentMailSize(int)), 64 connect(popClient, SIGNAL(currentMailSize(int)),
65 this, SIGNAL(currentMailSize(int)) ); 65 this, SIGNAL(currentMailSize(int)) );
66 connect(popClient, SIGNAL(downloadedSize(int)), 66 connect(popClient, SIGNAL(downloadedSize(int)),
67 this, SIGNAL(downloadedSize(int)) ); 67 this, SIGNAL(downloadedSize(int)) );
68} 68}
69 69
70void EmailHandler::sendMail(QList<Email> *mailList) 70void EmailHandler::sendMail(QList<Email> *mailList)
71{ 71{
72 Email *currentMail; 72 Email *currentMail;
73 QString temp; 73 QString temp;
74 QString userName = mailAccount.name; 74 QString userName = mailAccount.name;
75 userName += " <" + mailAccount.emailAddress + ">"; 75 userName += " <" + mailAccount.emailAddress + ">";
76 76
77 for (currentMail = mailList->first(); currentMail != 0; 77 for (currentMail = mailList->first(); currentMail != 0;
78 currentMail = mailList->next()) { 78 currentMail = mailList->next()) {
diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h
index e4e7f46..74a8e4c 100644
--- a/noncore/unsupported/mailit/emailhandler.h
+++ b/noncore/unsupported/mailit/emailhandler.h
@@ -106,45 +106,45 @@ struct MailAccount
106 106
107 107
108class EmailHandler : public QObject 108class EmailHandler : public QObject
109{ 109{
110 Q_OBJECT 110 Q_OBJECT
111 111
112public: 112public:
113 EmailHandler(); 113 EmailHandler();
114 void setAccount(MailAccount account); 114 void setAccount(MailAccount account);
115 MailAccount* getAccount(){return &mailAccount;} 115 MailAccount* getAccount(){return &mailAccount;}
116 void sendMail(QList<Email> *mailList); 116 void sendMail(QList<Email> *mailList);
117 void getMail(); 117 void getMail();
118 void getMailHeaders(); 118 void getMailHeaders();
119 void getMailByList(MailList *mailList); 119 void getMailByList(MailList *mailList);
120 bool parse(const QString &in, const QString &lineShift, Email *mail); 120 bool parse(const QString &in, const QString &lineShift, Email *mail);
121 bool getEnclosure(Enclosure *ePtr); 121 bool getEnclosure(Enclosure *ePtr);
122 int parse64base(char *src, char *dest); 122 int parse64base(char *src, char *dest);
123 int encodeMime(Email *mail); 123 int encodeMime(Email *mail);
124 int encodeFile(const QString &fileName, QString *toBody); 124 int encodeFile(const QString &fileName, QString *toBody);
125 void encode64base(char *src, QString *dest, int len); 125 void encode64base(char *src, QString *dest, int len);
126 void cancel(); 126 void cancel();
127 127
128signals: 128signals:
129 void mailSent(); 129 void mailSent();
130 void smtpError(int); 130 void smtpError(int, const QString & Msg );
131 void popError(int); 131 void popError(int, const QString & Msg );
132 void mailArrived(const Email &, bool); 132 void mailArrived(const Email &, bool);
133 void updatePopStatus(const QString &); 133 void updatePopStatus(const QString &);
134 void updateSmtpStatus(const QString &); 134 void updateSmtpStatus(const QString &);
135 void mailTransfered(int); 135 void mailTransfered(int);
136 void mailboxSize(int); 136 void mailboxSize(int);
137 void currentMailSize(int); 137 void currentMailSize(int);
138 void downloadedSize(int); 138 void downloadedSize(int);
139 139
140public slots: 140public slots:
141 void messageArrived(const QString &, int id, uint size, bool complete); 141 void messageArrived(const QString &, int id, uint size, bool complete);
142 142
143private: 143private:
144 MailAccount mailAccount; 144 MailAccount mailAccount;
145 SmtpClient *smtpClient; 145 SmtpClient *smtpClient;
146 PopClient *popClient; 146 PopClient *popClient;
147 bool headers; 147 bool headers;
148}; 148};
149 149
150#endif 150#endif
diff --git a/noncore/unsupported/mailit/mailit.pro b/noncore/unsupported/mailit/mailit.pro
index cfbda36..5e9a83a 100644
--- a/noncore/unsupported/mailit/mailit.pro
+++ b/noncore/unsupported/mailit/mailit.pro
@@ -1,25 +1,26 @@
1TEMPLATE = app 1TEMPLATE = app
2TARGET = mailit
2CONFIG = qt warn_on release 3CONFIG = qt warn_on release
3HEADERS = emailclient.h \ 4HEADERS = emailclient.h \
4 emailhandler.h \ 5 emailhandler.h \
5 emaillistitem.h \ 6 emaillistitem.h \
6 mailitwindow.h \ 7 mailitwindow.h \
7 md5.h \ 8 md5.h \
8 popclient.h \ 9 popclient.h \
9 readmail.h \ 10 readmail.h \
10 smtpclient.h \ 11 smtpclient.h \
11 writemail.h \ 12 writemail.h \
12 textparser.h \ 13 textparser.h \
13 viewatt.h \ 14 viewatt.h \
14 addatt.h \ 15 addatt.h \
15 editaccount.h \ 16 editaccount.h \
16 maillist.h \ 17 maillist.h \
17 addresslist.h 18 addresslist.h
18SOURCES = emailclient.cpp \ 19SOURCES = emailclient.cpp \
19 emailhandler.cpp \ 20 emailhandler.cpp \
20 emaillistitem.cpp \ 21 emaillistitem.cpp \
21 mailitwindow.cpp \ 22 mailitwindow.cpp \
22 main.cpp \ 23 main.cpp \
23 md5.c \ 24 md5.c \
24 popclient.cpp \ 25 popclient.cpp \
25 readmail.cpp \ 26 readmail.cpp \
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp
index f945a0f..6e298c7 100644
--- a/noncore/unsupported/mailit/mailitwindow.cpp
+++ b/noncore/unsupported/mailit/mailitwindow.cpp
@@ -1,51 +1,51 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 Trolltech AS. All rights reserved. 2** Copyright (C) 2001 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include "mailitwindow.h" 22#include "mailitwindow.h"
23 23
24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) 24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags /*fl*/)
25 : QMainWindow(parent, name, WStyle_ContextHelp) 25 : QMainWindow(parent, name, WStyle_ContextHelp)
26{ 26{
27 currentCaption = "Mailit"; 27 currentCaption = tr("Mailit");
28 setCaption(tr(currentCaption)); 28 setCaption(tr(currentCaption));
29 views = new QWidgetStack(this); 29 views = new QWidgetStack(this);
30 setCentralWidget(views); 30 setCentralWidget(views);
31 QWhatsThis::add(views,tr("Central view area")); 31 QWhatsThis::add(views,tr("Central view area"));
32 emailClient = new EmailClient(views, "client"); 32 emailClient = new EmailClient(views, "client");
33 writeMail = new WriteMail(views, "writing"); 33 writeMail = new WriteMail(views, "writing");
34 readMail = new ReadMail(views, "reading"); 34 readMail = new ReadMail(views, "reading");
35 35
36 views->raiseWidget(emailClient); 36 views->raiseWidget(emailClient);
37 37
38 connect(emailClient, SIGNAL(composeRequested()), 38 connect(emailClient, SIGNAL(composeRequested()),
39 this, SLOT(compose()) ); 39 this, SLOT(compose()) );
40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this, 40 connect(emailClient, SIGNAL(viewEmail(QListView *, Email *)), this,
41 SLOT(viewMail(QListView *, Email *)) ); 41 SLOT(viewMail(QListView *, Email *)) );
42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this, 42 connect(emailClient, SIGNAL(mailUpdated(Email *)), this,
43 SLOT(updateMailView(Email *)) ); 43 SLOT(updateMailView(Email *)) );
44 44
45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) ); 45 connect(writeMail, SIGNAL(cancelMail()), this, SLOT(showEmailClient()) );
46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, 46 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this,
47 SLOT(showEmailClient()) ); 47 SLOT(showEmailClient()) );
48 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, 48 connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient,
49 SLOT(enqueMail(const Email &)) ); 49 SLOT(enqueMail(const Email &)) );
50 50
51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); 51 connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) );
diff --git a/noncore/unsupported/mailit/maillist.cpp b/noncore/unsupported/mailit/maillist.cpp
index b5325a9..8c34295 100644
--- a/noncore/unsupported/mailit/maillist.cpp
+++ b/noncore/unsupported/mailit/maillist.cpp
@@ -53,79 +53,79 @@ int* MailList::next()
53 mPtr = sortedList.at(currentPos); 53 mPtr = sortedList.at(currentPos);
54 currentPos++; 54 currentPos++;
55 return &(mPtr->serverId); 55 return &(mPtr->serverId);
56} 56}
57 57
58void MailList::sizeInsert(int serverId, uint size) 58void MailList::sizeInsert(int serverId, uint size)
59{ 59{
60 dList *tempPtr; 60 dList *tempPtr;
61 int x; 61 int x;
62 62
63 dList *newEntry = new dList; 63 dList *newEntry = new dList;
64 newEntry->serverId = serverId; 64 newEntry->serverId = serverId;
65 newEntry->size = size; 65 newEntry->size = size;
66 66
67 for (tempPtr = sortedList.first(); tempPtr != NULL; tempPtr = sortedList.next() ) { 67 for (tempPtr = sortedList.first(); tempPtr != NULL; tempPtr = sortedList.next() ) {
68 if (newEntry->size < tempPtr->size) { 68 if (newEntry->size < tempPtr->size) {
69 x = sortedList.at(); 69 x = sortedList.at();
70 sortedList.insert(x, newEntry); 70 sortedList.insert(x, newEntry);
71 return; 71 return;
72 } 72 }
73 } 73 }
74 sortedList.append(newEntry); 74 sortedList.append(newEntry);
75} 75}
76 76
77void MailList::moveFront(int serverId, uint size) 77void MailList::moveFront(int serverId, uint/* size*/)
78{ 78{
79 dList *currentPtr; 79 dList *currentPtr;
80 uint tempPos; 80 uint tempPos;
81 QString temp; 81 QString temp;
82 82
83 tempPos = currentPos; 83 tempPos = currentPos;
84 if ( tempPos >= sortedList.count() ) 84 if ( tempPos >= sortedList.count() )
85 return; 85 return;
86 currentPtr = sortedList.at(tempPos); 86 currentPtr = sortedList.at(tempPos);
87 while ( ((tempPos+1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { 87 while ( ((tempPos+1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) {
88 tempPos++; 88 tempPos++;
89 currentPtr = sortedList.at(tempPos); 89 currentPtr = sortedList.at(tempPos);
90 } 90 }
91 91
92 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { 92 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) {
93 temp.setNum(currentPtr->serverId); 93 temp.setNum(currentPtr->serverId);
94 qWarning("moved to front, message: " + temp); 94 qWarning("moved to front, message: " + temp);
95 95
96 dList *itemPtr = sortedList.take(tempPos); 96 dList *itemPtr = sortedList.take(tempPos);
97 sortedList.insert(currentPos, itemPtr); 97 sortedList.insert(currentPos, itemPtr);
98 } 98 }
99 99
100} 100}
101 101
102//only works if mail is not already in download 102//only works if mail is not already in download
103bool MailList::remove(int serverId, uint size) 103bool MailList::remove(int serverId, uint /*size*/)
104{ 104{
105 dList *currentPtr; 105 dList *currentPtr;
106 uint tempPos; 106 uint tempPos;
107 QString temp; 107 QString temp;
108 108
109 tempPos = currentPos; 109 tempPos = currentPos;
110 if ( tempPos >=sortedList.count() ) 110 if ( tempPos >=sortedList.count() )
111 return FALSE; 111 return FALSE;
112 currentPtr = sortedList.at(tempPos); 112 currentPtr = sortedList.at(tempPos);
113 while ( ((tempPos + 1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) { 113 while ( ((tempPos + 1) < sortedList.count()) && ( currentPtr->serverId != serverId) ) {
114 tempPos++; 114 tempPos++;
115 currentPtr = sortedList.at(tempPos); 115 currentPtr = sortedList.at(tempPos);
116 } 116 }
117 117
118 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) { 118 if ( (currentPtr != NULL) && (currentPtr->serverId == serverId) ) {
119 temp.setNum(currentPtr->serverId); 119 temp.setNum(currentPtr->serverId);
120 qWarning("deleted message: " + temp); 120 qWarning("deleted message: " + temp);
121 sortedList.remove(tempPos); 121 sortedList.remove(tempPos);
122 122
123 return TRUE; 123 return TRUE;
124 } 124 }
125 return FALSE; 125 return FALSE;
126} 126}
127 127
128void MailList::insert(int pos, int serverId, uint size) 128void MailList::insert(int /*pos*/, int /*serverId*/, uint/* size*/)
129{ 129{
130 //sortedList.insert(pos, mPtr); 130 //sortedList.insert(pos, mPtr);
131} 131}
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp
index dc0116d..5da3bcb 100644
--- a/noncore/unsupported/mailit/popclient.cpp
+++ b/noncore/unsupported/mailit/popclient.cpp
@@ -42,90 +42,94 @@ PopClient::PopClient()
42 lastSync = 0; 42 lastSync = 0;
43 headerLimit = 0; 43 headerLimit = 0;
44 preview = FALSE; 44 preview = FALSE;
45} 45}
46 46
47PopClient::~PopClient() 47PopClient::~PopClient()
48{ 48{
49 delete socket; 49 delete socket;
50 delete stream; 50 delete stream;
51} 51}
52 52
53void PopClient::newConnection(const QString &target, int port) 53void PopClient::newConnection(const QString &target, int port)
54{ 54{
55 if (receiving) { 55 if (receiving) {
56 qWarning("socket in use, connection refused"); 56 qWarning("socket in use, connection refused");
57 return; 57 return;
58 } 58 }
59 59
60 status = Init; 60 status = Init;
61 61
62 socket->connectToHost(target, port); 62 socket->connectToHost(target, port);
63 receiving = TRUE; 63 receiving = TRUE;
64 //selected = FALSE; 64 //selected = FALSE;
65 65
66 emit updateStatus("DNS lookup"); 66 emit updateStatus(tr("DNS lookup"));
67} 67}
68 68
69void PopClient::setAccount(const QString &popUser, const QString &popPasswd) 69void PopClient::setAccount(const QString &popUser, const QString &popPasswd)
70{ 70{
71 popUserName = popUser; 71 popUserName = popUser;
72 popPassword = popPasswd; 72 popPassword = popPasswd;
73} 73}
74 74
75void PopClient::setSynchronize(int lastCount) 75void PopClient::setSynchronize(int lastCount)
76{ 76{
77 synchronize = TRUE; 77 synchronize = TRUE;
78 lastSync = lastCount; 78 lastSync = lastCount;
79} 79}
80 80
81void PopClient::removeSynchronize() 81void PopClient::removeSynchronize()
82{ 82{
83 synchronize = FALSE; 83 synchronize = FALSE;
84 lastSync = 0; 84 lastSync = 0;
85} 85}
86 86
87void PopClient::headersOnly(bool headers, int limit) 87void PopClient::headersOnly(bool headers, int limit)
88{ 88{
89 preview = headers; 89 preview = headers;
90 headerLimit = limit; 90 headerLimit = limit;
91} 91}
92 92
93void PopClient::setSelectedMails(MailList *list) 93void PopClient::setSelectedMails(MailList *list)
94{ 94{
95 selected = TRUE; 95 selected = TRUE;
96 mailList = list; 96 mailList = list;
97} 97}
98 98
99void PopClient::connectionEstablished() 99void PopClient::connectionEstablished()
100{ 100{
101 emit updateStatus(tr("Connection established")); 101 emit updateStatus(tr("Connection established"));
102} 102}
103 103
104void PopClient::errorHandling(int status) 104void PopClient::errorHandling(int status)
105{ 105{
106 errorHandlingWithMsg( status, QString::null );
107}
108void PopClient::errorHandlingWithMsg(int status, const QString & Msg )
109{
106 emit updateStatus(tr("Error Occured")); 110 emit updateStatus(tr("Error Occured"));
107 emit errorOccurred(status); 111 emit errorOccurred(status, Msg);
108 socket->close(); 112 socket->close();
109 receiving = FALSE; 113 receiving = FALSE;
110} 114}
111 115
112void PopClient::incomingData() 116void PopClient::incomingData()
113{ 117{
114 QString response, temp, temp2, timeStamp; 118 QString response, temp, temp2, timeStamp;
115 QString md5Source; 119 QString md5Source;
116 int start, end; 120 int start, end;
117// char *md5Digest; 121// char *md5Digest;
118 char md5Digest[16]; 122 char md5Digest[16];
119// if ( !socket->canReadLine() ) 123// if ( !socket->canReadLine() )
120// return; 124// return;
121 125
122 126
123 response = socket->readLine(); 127 response = socket->readLine();
124 128
125 switch(status) { 129 switch(status) {
126 //logging in 130 //logging in
127 case Init: { 131 case Init: {
128#ifdef APOP_TEST 132#ifdef APOP_TEST
129 start = response.find('<',0); 133 start = response.find('<',0);
130 end = response.find('>', start); 134 end = response.find('>', start);
131 if( start >= 0 && end > start ) 135 if( start >= 0 && end > start )
@@ -146,141 +150,141 @@ void PopClient::incomingData()
146 status = Stat; 150 status = Stat;
147 } 151 }
148 else 152 else
149#endif 153#endif
150 { 154 {
151 timeStamp = ""; 155 timeStamp = "";
152 *stream << "USER " << popUserName << "\r\n"; 156 *stream << "USER " << popUserName << "\r\n";
153 status = Pass; 157 status = Pass;
154 } 158 }
155 159
156 break; 160 break;
157 } 161 }
158 162
159 case Pass: { 163 case Pass: {
160 *stream << "PASS " << popPassword << "\r\n"; 164 *stream << "PASS " << popPassword << "\r\n";
161 status = Stat; 165 status = Stat;
162 166
163 break; 167 break;
164 } 168 }
165 //ask for number of messages 169 //ask for number of messages
166 case Stat: { 170 case Stat: {
167 if (response[0] == '+') { 171 if (response[0] == '+') {
168 *stream << "STAT" << "\r\n"; 172 *stream << "STAT" << "\r\n";
169 status = Mcnt; 173 status = Mcnt;
170 } else errorHandling(ErrLoginFailed); 174 } else errorHandlingWithMsg(ErrLoginFailed, response);
171 break; 175 break;
172 } 176 }
173 //get count of messages, eg "+OK 4 900.." -> int 4 177 //get count of messages, eg "+OK 4 900.." -> int 4
174 case Mcnt: { 178 case Mcnt: {
175 if (response[0] == '+') { 179 if (response[0] == '+') {
176 temp = response.replace(0, 4, ""); 180 temp = response.replace(0, 4, "");
177 int x = temp.find(" ", 0); 181 int x = temp.find(" ", 0);
178 temp.truncate((uint) x); 182 temp.truncate((uint) x);
179 newMessages = temp.toInt(); 183 newMessages = temp.toInt();
180 messageCount = 1; 184 messageCount = 1;
181 status = List; 185 status = List;
182 186
183 if (synchronize) { 187 if (synchronize) {
184 //messages deleted from server, reload all 188 //messages deleted from server, reload all
185 if (newMessages < lastSync) 189 if (newMessages < lastSync)
186 lastSync = 0; 190 lastSync = 0;
187 messageCount = 1; 191 messageCount = 1;
188 } 192 }
189 193
190 if (selected) { 194 if (selected) {
191 int *ptr = mailList->first(); 195 int *ptr = mailList->first();
192 if (ptr != 0) { 196 if (ptr != 0) {
193 newMessages++; //to ensure no early jumpout 197 newMessages++; //to ensure no early jumpout
194 messageCount = *ptr; 198 messageCount = *ptr;
195 } else newMessages = 0; 199 } else newMessages = 0;
196 } 200 }
197 201
198 } else errorHandling(ErrUnknownResponse); 202 } else errorHandlingWithMsg(ErrUnknownResponse, response);
199 } 203 }
200 //Read message number x, count upwards to messageCount 204 //Read message number x, count upwards to messageCount
201 case List: { 205 case List: {
202 if (messageCount <= newMessages) { 206 if (messageCount <= newMessages) {
203 *stream << "LIST " << messageCount << "\r\n"; 207 *stream << "LIST " << messageCount << "\r\n";
204 status = Size; 208 status = Size;
205 temp2.setNum(newMessages - lastSync); 209 temp2.setNum(newMessages - lastSync);
206 temp.setNum(messageCount - lastSync); 210 temp.setNum(messageCount - lastSync);
207 if (!selected) { 211 if (!selected) {
208 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 212 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
209 } else { 213 } else {
210 //completing a previously closed transfer 214 //completing a previously closed transfer
211 /* if ( (messageCount - lastSync) <= 0) { 215 /* if ( (messageCount - lastSync) <= 0) {
212 temp.setNum(messageCount); 216 temp.setNum(messageCount);
213 emit updateStatus(tr("Previous message ") + temp); 217 emit updateStatus(tr("Previous message ") + temp);
214 } else {*/ 218 } else {*/
215 emit updateStatus(tr("Completing message ") + temp); 219 emit updateStatus(tr("Completing message ") + temp);
216 //} 220 //}
217 } 221 }
218 break; 222 break;
219 } else { 223 } else {
220 emit updateStatus(tr("No new Messages")); 224 emit updateStatus(tr("No new Messages"));
221 status = Quit; 225 status = Quit;
222 } 226 }
223 } 227 }
224 //get size of message, eg "500 characters in message.." -> int 500 228 //get size of message, eg "500 characters in message.." -> int 500
225 case Size: { 229 case Size: {
226 if (status != Quit) { //because of idiotic switch 230 if (status != Quit) { //because of idiotic switch
227 if (response[0] == '+') { 231 if (response[0] == '+') {
228 temp = response.replace(0, 4, ""); 232 temp = response.replace(0, 4, "");
229 int x = temp.find(" ", 0); 233 int x = temp.find(" ", 0);
230 temp = temp.right(temp.length() - ((uint) x + 1) ); 234 temp = temp.right(temp.length() - ((uint) x + 1) );
231 mailSize = temp.toInt(); 235 mailSize = temp.toInt();
232 emit currentMailSize(mailSize); 236 emit currentMailSize(mailSize);
233 237
234 status = Retr; 238 status = Retr;
235 } else { 239 } else {
236 //qWarning(response); 240 //qWarning(response);
237 errorHandling(ErrUnknownResponse); 241 errorHandlingWithMsg(ErrUnknownResponse, response);
238 } 242 }
239 } 243 }
240 } 244 }
241 //Read message number x, count upwards to messageCount 245 //Read message number x, count upwards to messageCount
242 case Retr: { 246 case Retr: {
243 if (status != Quit) { 247 if (status != Quit) {
244 if ((selected)||(mailSize <= headerLimit)) 248 if ((selected)||(mailSize <= headerLimit))
245 { 249 {
246 *stream << "RETR " << messageCount << "\r\n"; 250 *stream << "RETR " << messageCount << "\r\n";
247 } else { //only header 251 } else { //only header
248 *stream << "TOP " << messageCount << " 0\r\n"; 252 *stream << "TOP " << messageCount << " 0\r\n";
249 } 253 }
250 messageCount++; 254 messageCount++;
251 status = Ignore; 255 status = Ignore;
252 break; 256 break;
253 } } 257 } }
254 case Ignore: { 258 case Ignore: {
255 if (status != Quit) { //because of idiotic switch 259 if (status != Quit) { //because of idiotic switch
256 if (response[0] == '+') { 260 if (response[0] == '+') {
257 message = ""; 261 message = "";
258 status = Read; 262 status = Read;
259 if (!socket->canReadLine()) //sync. problems 263 if (!socket->canReadLine()) //sync. problems
260 break; 264 break;
261 response = socket->readLine(); 265 response = socket->readLine();
262 } else errorHandling(ErrUnknownResponse); 266 } else errorHandlingWithMsg(ErrUnknownResponse, response);
263 } 267 }
264 } 268 }
265 //add all incoming lines to body. When size is reached, send 269 //add all incoming lines to body. When size is reached, send
266 //message, and go back to read new message 270 //message, and go back to read new message
267 case Read: { 271 case Read: {
268 if (status != Quit) { //because of idiotic switch 272 if (status != Quit) { //because of idiotic switch
269 message += response; 273 message += response;
270 while ( socket->canReadLine() ) { 274 while ( socket->canReadLine() ) {
271 response = socket->readLine(); 275 response = socket->readLine();
272 message += response; 276 message += response;
273 } 277 }
274 emit downloadedSize(message.length()); 278 emit downloadedSize(message.length());
275 int x = message.find("\r\n.\r\n",-5); 279 int x = message.find("\r\n.\r\n",-5);
276 if (x == -1) { 280 if (x == -1) {
277 break; 281 break;
278 } else { //message reach entire size 282 } else { //message reach entire size
279 if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active 283 if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active
280 { 284 {
281 emit newMessage(message, messageCount-1, mailSize, TRUE); 285 emit newMessage(message, messageCount-1, mailSize, TRUE);
282 } else { //incomplete mail downloaded 286 } else { //incomplete mail downloaded
283 emit newMessage(message, messageCount-1, mailSize, FALSE); 287 emit newMessage(message, messageCount-1, mailSize, FALSE);
284 } 288 }
285 289
286 if ((messageCount > newMessages)||(selected)) //last message ? 290 if ((messageCount > newMessages)||(selected)) //last message ?
diff --git a/noncore/unsupported/mailit/popclient.h b/noncore/unsupported/mailit/popclient.h
index c58bc48..6774ceb 100644
--- a/noncore/unsupported/mailit/popclient.h
+++ b/noncore/unsupported/mailit/popclient.h
@@ -23,54 +23,55 @@
23#include <stdio.h> 23#include <stdio.h>
24#include <qsocket.h> 24#include <qsocket.h>
25#include <qstring.h> 25#include <qstring.h>
26#include <qobject.h> 26#include <qobject.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28#include <qlist.h> 28#include <qlist.h>
29#include "maillist.h" 29#include "maillist.h"
30 30
31class PopClient: public QObject 31class PopClient: public QObject
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 PopClient(); 36 PopClient();
37 ~PopClient(); 37 ~PopClient();
38 void newConnection(const QString &target, int port); 38 void newConnection(const QString &target, int port);
39 void setAccount(const QString &popUser, const QString &popPasswd); 39 void setAccount(const QString &popUser, const QString &popPasswd);
40 void setSynchronize(int lastCount); 40 void setSynchronize(int lastCount);
41 void removeSynchronize(); 41 void removeSynchronize();
42 void headersOnly(bool headers, int limit); 42 void headersOnly(bool headers, int limit);
43 void setSelectedMails(MailList *list); 43 void setSelectedMails(MailList *list);
44 44
45signals: 45signals:
46 void newMessage(const QString &, int, uint, bool); 46 void newMessage(const QString &, int, uint, bool);
47 void errorOccurred(int status); 47 void errorOccurred(int status, const QString & Msg );
48 void updateStatus(const QString &); 48 void updateStatus(const QString &);
49 void mailTransfered(int); 49 void mailTransfered(int);
50 void mailboxSize(int); 50 void mailboxSize(int);
51 void currentMailSize(int); 51 void currentMailSize(int);
52 void downloadedSize(int); 52 void downloadedSize(int);
53 53
54public slots: 54public slots:
55 void errorHandling(int); 55 void errorHandling(int);
56 void errorHandlingWithMsg(int, const QString & );
56 57
57protected slots: 58protected slots:
58 void connectionEstablished(); 59 void connectionEstablished();
59 void incomingData(); 60 void incomingData();
60 61
61private: 62private:
62 QSocket *socket; 63 QSocket *socket;
63 QTextStream *stream; 64 QTextStream *stream;
64 enum transferStatus 65 enum transferStatus
65 { 66 {
66 Init, Pass, Stat, Mcnt, Read, List, Size, Retr, Acks, 67 Init, Pass, Stat, Mcnt, Read, List, Size, Retr, Acks,
67 Quit, Done, Ignore 68 Quit, Done, Ignore
68 }; 69 };
69 int status, lastSync; 70 int status, lastSync;
70 int messageCount, newMessages, mailSize, headerLimit; 71 int messageCount, newMessages, mailSize, headerLimit;
71 bool receiving, synchronize, preview, selected; 72 bool receiving, synchronize, preview, selected;
72 QString popUserName, popPassword, message; 73 QString popUserName, popPassword, message;
73 MailList *mailList; 74 MailList *mailList;
74}; 75};
75 76
76#endif 77#endif
diff --git a/noncore/unsupported/mailit/smtpclient.cpp b/noncore/unsupported/mailit/smtpclient.cpp
index 2916f45..5b5ef52 100644
--- a/noncore/unsupported/mailit/smtpclient.cpp
+++ b/noncore/unsupported/mailit/smtpclient.cpp
@@ -52,112 +52,119 @@ void SmtpClient::newConnection(const QString &target, int port)
52 52
53 emit updateStatus(tr("DNS lookup")); 53 emit updateStatus(tr("DNS lookup"));
54} 54}
55 55
56void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body) 56void SmtpClient::addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body)
57{ 57{
58 RawEmail *mail = new RawEmail; 58 RawEmail *mail = new RawEmail;
59 59
60 mail->from = from; 60 mail->from = from;
61 mail->subject = subject; 61 mail->subject = subject;
62 mail->to = to; 62 mail->to = to;
63 mail->body = body; 63 mail->body = body;
64 64
65 mailList.append(mail); 65 mailList.append(mail);
66} 66}
67 67
68void SmtpClient::connectionEstablished() 68void SmtpClient::connectionEstablished()
69{ 69{
70 emit updateStatus(tr("Connection established")); 70 emit updateStatus(tr("Connection established"));
71 71
72} 72}
73 73
74void SmtpClient::errorHandling(int status) 74void SmtpClient::errorHandling(int status)
75{ 75{
76 emit errorOccurred(status); 76 errorHandlingWithMsg( status, QString::null );
77}
78
79void SmtpClient::errorHandlingWithMsg(int status, const QString & EMsg )
80{
81 emit errorOccurred(status, EMsg );
77 socket->close(); 82 socket->close();
78 mailList.clear(); 83 mailList.clear();
79 sending = FALSE; 84 sending = FALSE;
80} 85}
81 86
82void SmtpClient::incomingData() 87void SmtpClient::incomingData()
83{ 88{
84 QString response; 89 QString response;
85 90
86 if (!socket->canReadLine()) 91 if (!socket->canReadLine())
87 return; 92 return;
88 93
89 response = socket->readLine(); 94 response = socket->readLine();
90
91 switch(status) { 95 switch(status) {
92 case Init: { 96 case Init: {
93 if (response[0] == '2') { 97 if (response[0] == '2') {
94 status = From; 98 status = From;
95 mailPtr = mailList.first(); 99 mailPtr = mailList.first();
96 *stream << "HELO there\r\n"; 100 *stream << "HELO there\r\n";
97 } else errorHandling(ErrUnknownResponse); 101 } else errorHandlingWithMsg(ErrUnknownResponse,response);
98 break; 102 break;
99 } 103 }
100 case From: { 104 case From: {
101 if (response[0] == '2') { 105 if (response[0] == '2') {
102 *stream << "MAIL FROM: " << mailPtr->from << "\r\n"; 106 qDebug(mailPtr->from);
107 *stream << "MAIL FROM: <" << mailPtr->from << ">\r\n";
103 status = Recv; 108 status = Recv;
104 } else errorHandling(ErrUnknownResponse); 109 } else errorHandlingWithMsg(ErrUnknownResponse, response );
105 break; 110 break;
106 } 111 }
107 case Recv: { 112 case Recv: {
108 if (response[0] == '2') { 113 if (response[0] == '2') {
109 it = mailPtr->to.begin(); 114 it = mailPtr->to.begin();
110 if (it == NULL) 115 if (it == NULL) {
111 errorHandling(ErrUnknownResponse); 116 errorHandlingWithMsg(ErrUnknownResponse,response);
112 *stream << "RCPT TO: " << *it << ">\r\n"; 117 }
118 *stream << "RCPT TO: <" << *it << ">\r\n";
113 status = MRcv; 119 status = MRcv;
114 } else errorHandling(ErrUnknownResponse); 120 } else errorHandlingWithMsg(ErrUnknownResponse,response);
115 break; 121 break;
116 } 122 }
117 case MRcv: { 123 case MRcv: {
118 if (response[0] == '2') { 124 if (response[0] == '2') {
119 it++; 125 it++;
120 if ( it != mailPtr->to.end() ) { 126 if ( it != mailPtr->to.end() ) {
121 *stream << "RCPT TO: <" << *it << ">\r\n"; 127 *stream << "RCPT TO: <" << *it << ">\r\n";
122 break; 128 break;
123 } else { 129 } else {
124 status = Data; 130 status = Data;
125 } 131 }
126 } else errorHandling(ErrUnknownResponse); 132 } else errorHandlingWithMsg(ErrUnknownResponse,response);
127 } 133 }
128 case Data: { 134 case Data: {
129 if (response[0] == '2') { 135 if (response[0] == '2') {
130 *stream << "DATA\r\n"; 136 *stream << "DATA\r\n";
131 status = Body; 137 status = Body;
132 emit updateStatus(tr("Sending: ") + mailPtr->subject); 138 emit updateStatus(tr("Sending: ") + mailPtr->subject);
133 } else errorHandling(ErrUnknownResponse); 139
140 } else errorHandlingWithMsg(ErrUnknownResponse,response);
134 break; 141 break;
135 } 142 }
136 case Body: { 143 case Body: {
137 if (response[0] == '3') { 144 if (response[0] == '3') {
138 *stream << mailPtr->body << "\r\n.\r\n"; 145 *stream << mailPtr->body << "\r\n.\r\n";
139 mailPtr = mailList.next(); 146 mailPtr = mailList.next();
140 if (mailPtr != NULL) { 147 if (mailPtr != NULL) {
141 status = From; 148 status = From;
142 } else { 149 } else {
143 status = Quit; 150 status = Quit;
144 } 151 }
145 } else errorHandling(ErrUnknownResponse); 152 } else errorHandlingWithMsg(ErrUnknownResponse,response);
146 break; 153 break;
147 } 154 }
148 case Quit: { 155 case Quit: {
149 if (response[0] == '2') { 156 if (response[0] == '2') {
150 *stream << "QUIT\r\n"; 157 *stream << "QUIT\r\n";
151 status = Done; 158 status = Done;
152 QString temp; 159 QString temp;
153 temp.setNum(mailList.count()); 160 temp.setNum(mailList.count());
154 emit updateStatus(tr("Sent ") + temp + tr(" messages")); 161 emit updateStatus(tr("Sent ") + temp + tr(" messages"));
155 emit mailSent(); 162 emit mailSent();
156 mailList.clear(); 163 mailList.clear();
157 sending = FALSE; 164 sending = FALSE;
158 socket->close(); 165 socket->close();
159 } else errorHandling(ErrUnknownResponse); 166 } else errorHandlingWithMsg(ErrUnknownResponse,response);
160 break; 167 break;
161 } 168 }
162 } 169 }
163} 170}
diff --git a/noncore/unsupported/mailit/smtpclient.h b/noncore/unsupported/mailit/smtpclient.h
index 45c0703..554ba3f 100644
--- a/noncore/unsupported/mailit/smtpclient.h
+++ b/noncore/unsupported/mailit/smtpclient.h
@@ -26,50 +26,51 @@
26#include <qobject.h> 26#include <qobject.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qlist.h> 29#include <qlist.h>
30 30
31struct RawEmail 31struct RawEmail
32{ 32{
33 QString from; 33 QString from;
34 QString subject; 34 QString subject;
35 QStringList to; 35 QStringList to;
36 QString body; 36 QString body;
37}; 37};
38 38
39class SmtpClient: public QObject 39class SmtpClient: public QObject
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43public: 43public:
44 SmtpClient(); 44 SmtpClient();
45 ~SmtpClient(); 45 ~SmtpClient();
46 void newConnection(const QString &target, int port); 46 void newConnection(const QString &target, int port);
47 void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body); 47 void addMail(const QString &from, const QString &subject, const QStringList &to, const QString &body);
48 48
49signals: 49signals:
50 void errorOccurred(int); 50 void errorOccurred(int, const QString & LR );
51 void updateStatus(const QString &); 51 void updateStatus(const QString &);
52 void mailSent(); 52 void mailSent();
53 53
54public slots: 54public slots:
55 void errorHandling(int); 55 void errorHandling(int);
56 void errorHandlingWithMsg(int, const QString & LastResponse );
56 57
57protected slots: 58protected slots:
58 void connectionEstablished(); 59 void connectionEstablished();
59 void incomingData(); 60 void incomingData();
60 61
61private: 62private:
62 QSocket *socket; 63 QSocket *socket;
63 QTextStream *stream; 64 QTextStream *stream;
64 enum transferStatus 65 enum transferStatus
65 { 66 {
66 Init, From, Recv, MRcv, Data, Body, Quit, Done 67 Init, From, Recv, MRcv, Data, Body, Quit, Done
67 }; 68 };
68 int status; 69 int status;
69 QList<RawEmail> mailList; 70 QList<RawEmail> mailList;
70 RawEmail *mailPtr; 71 RawEmail *mailPtr;
71 bool sending; 72 bool sending;
72 QStringList::Iterator it; 73 QStringList::Iterator it;
73}; 74};
74 75
75#endif 76#endif
diff --git a/noncore/unsupported/mailit/viewatt.cpp b/noncore/unsupported/mailit/viewatt.cpp
index 21885c2..293e137 100644
--- a/noncore/unsupported/mailit/viewatt.cpp
+++ b/noncore/unsupported/mailit/viewatt.cpp
@@ -5,86 +5,86 @@
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "resource.h" 20#include "resource.h"
21#include "viewatt.h" 21#include "viewatt.h"
22#include <qwhatsthis.h> 22#include <qwhatsthis.h>
23#include <qpe/applnk.h> 23#include <qpe/applnk.h>
24#include <qpe/mimetype.h> 24#include <qpe/mimetype.h>
25 25
26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f) 26ViewAtt::ViewAtt(QWidget *parent, const char *name, WFlags f)
27 : QMainWindow(parent, name, f) 27 : QMainWindow(parent, name, f)
28{ 28{
29 setCaption("Exploring attatchments"); 29 setCaption(tr("Exploring attatchments"));
30 30
31 setToolBarsMovable( FALSE ); 31 setToolBarsMovable( FALSE );
32 bar = new QToolBar(this); 32 bar = new QToolBar(this);
33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 ); 33 installButton = new QAction( tr( "Install" ), Resource::loadPixmap( "exec" ), QString::null, CTRL + Key_C, this, 0 );
34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) ); 34 connect(installButton, SIGNAL(activated()), this, SLOT(install()) );
35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents")); 35 installButton->setWhatsThis(tr("Click here to install the attachment to your Documents"));
36 36
37 listView = new QListView(this, "AttView"); 37 listView = new QListView(this, "AttView");
38 listView->addColumn( "Attatchment" ); 38 listView->addColumn( tr("Attatchment") );
39 listView->addColumn( "Type" ); 39 listView->addColumn( tr("Type") );
40 listView->addColumn( "Installed" ); 40 listView->addColumn( tr("Installed") );
41 setCentralWidget(listView); 41 setCentralWidget(listView);
42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail")); 42 QWhatsThis::add(listView,QWidget::tr("This is an overview about all attachments in the mail"));
43} 43}
44 44
45void ViewAtt::update(Email *mailIn, bool inbox) 45void ViewAtt::update(Email *mailIn, bool inbox)
46{ 46{
47 QListViewItem *item; 47 QListViewItem *item;
48 Enclosure *ePtr; 48 Enclosure *ePtr;
49 49
50 50
51 51
52 listView->clear(); 52 listView->clear();
53 if (inbox) { 53 if (inbox) {
54 bar->clear(); 54 bar->clear();
55 installButton->addTo( bar ); 55 installButton->addTo( bar );
56 bar->show(); 56 bar->show();
57 } else { 57 } else {
58 bar->hide(); 58 bar->hide();
59 } 59 }
60 60
61 mail = mailIn; 61 mail = mailIn;
62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 62 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
63 63
64 QString isInstalled = "No"; 64 QString isInstalled = tr("No");
65 if (ePtr->installed) 65 if (ePtr->installed)
66 isInstalled = "Yes"; 66 isInstalled = tr("Yes");
67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled); 67 item = new QListViewItem(listView, ePtr->originalName, ePtr->contentType, isInstalled);
68 68
69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute; 69 const QString& mtypeDef=(const QString&) ePtr->contentType+"/"+ePtr->contentAttribute;
70 70
71 MimeType mt(mtypeDef); 71 MimeType mt(mtypeDef);
72 72
73 item->setPixmap(0, mt.pixmap()); 73 item->setPixmap(0, mt.pixmap());
74 74
75 /* 75 /*
76 if (ePtr->contentType == "TEXT") { 76 if (ePtr->contentType == "TEXT") {
77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0); 77 actions = new QAction( tr("View"), Resource::loadPixmap("TextEditor"), QString::null, CTRL + Key_C, this, 0);
78 actions->addTo(bar); 78 actions->addTo(bar);
79 } 79 }
80 if (ePtr->contentType == "AUDIO") { 80 if (ePtr->contentType == "AUDIO") {
81 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0); 81 actions = new QAction( tr("Play"), Resource::loadPixmap("SoundPlayer"), QString::null, CTRL + Key_C, this, 0);
82 actions->addTo(bar); 82 actions->addTo(bar);
83 item->setPixmap(0, Resource::loadPixmap("play")); 83 item->setPixmap(0, Resource::loadPixmap("play"));
84 } 84 }
85 if (ePtr->contentType == "IMAGE") { 85 if (ePtr->contentType == "IMAGE") {
86 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0); 86 actions = new QAction( tr("Show"), Resource::loadPixmap("pixmap"), QString::null, CTRL + Key_C, this, 0);
87 actions->addTo(bar); 87 actions->addTo(bar);
88 item->setPixmap(0, Resource::loadPixmap("pixmap")); 88 item->setPixmap(0, Resource::loadPixmap("pixmap"));
89 }*/ 89 }*/
90 } 90 }
@@ -95,27 +95,27 @@ void ViewAtt::install()
95 Enclosure *ePtr, *selPtr; 95 Enclosure *ePtr, *selPtr;
96 QListViewItem *item; 96 QListViewItem *item;
97 QString filename; 97 QString filename;
98 DocLnk d; 98 DocLnk d;
99 99
100 item = listView->selectedItem(); 100 item = listView->selectedItem();
101 if (item != NULL) { 101 if (item != NULL) {
102 filename = item->text(0); 102 filename = item->text(0);
103 selPtr = NULL; 103 selPtr = NULL;
104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { 104 for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) {
105 if (ePtr->originalName == filename) 105 if (ePtr->originalName == filename)
106 selPtr = ePtr; 106 selPtr = ePtr;
107 } 107 }
108 108
109 if (selPtr == NULL) { 109 if (selPtr == NULL) {
110 qWarning("Internal error, file is not installed to documents"); 110 qWarning("Internal error, file is not installed to documents");
111 return; 111 return;
112 } 112 }
113 113
114 d.setName(selPtr->originalName); 114 d.setName(selPtr->originalName);
115 d.setFile(selPtr->path + selPtr->name); 115 d.setFile(selPtr->path + selPtr->name);
116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute); 116 d.setType(selPtr->contentType + "/" + selPtr->contentAttribute);
117 d.writeLink(); 117 d.writeLink();
118 selPtr->installed = TRUE; 118 selPtr->installed = TRUE;
119 item->setText(2, "Yes"); 119 item->setText(2, tr("Yes"));
120 } 120 }
121} 121}
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp
index 0298cb3..26b9660 100644
--- a/noncore/unsupported/mailit/writemail.cpp
+++ b/noncore/unsupported/mailit/writemail.cpp
@@ -97,57 +97,57 @@ void WriteMail::init()
97 grid->addWidget( subjetLabel, 1, 0 ); 97 grid->addWidget( subjetLabel, 1, 0 );
98 98
99 ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" ); 99 ToolButton13_2 = new QToolButton( widget, "ToolButton13_2" );
100 ToolButton13_2->setText( tr( "..." ) ); 100 ToolButton13_2->setText( tr( "..." ) );
101 grid->addWidget( ToolButton13_2, 1, 2 ); 101 grid->addWidget( ToolButton13_2, 1, 2 );
102 102
103 subjectInput = new QLineEdit( widget, "subjectInput" ); 103 subjectInput = new QLineEdit( widget, "subjectInput" );
104 grid->addWidget( subjectInput, 1, 1 ); 104 grid->addWidget( subjectInput, 1, 1 );
105 QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here")); 105 QWhatsThis::add(subjectInput,QWidget::tr("The mail subject should be entered here"));
106 106
107 toInput = new QLineEdit( widget, "toInput" ); 107 toInput = new QLineEdit( widget, "toInput" );
108 grid->addWidget( toInput, 0, 1 ); 108 grid->addWidget( toInput, 0, 1 );
109 QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here")); 109 QWhatsThis::add(recipientsBox,QWidget::tr("Recipients can be entered here"));
110 110
111 ccInput = new QLineEdit( widget, "ccInput" ); 111 ccInput = new QLineEdit( widget, "ccInput" );
112 ccInput->hide(); 112 ccInput->hide();
113 grid->addWidget( ccInput, 0, 1 ); 113 grid->addWidget( ccInput, 0, 1 );
114 QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here")); 114 QWhatsThis::add(ccInput,QWidget::tr("If you would like to send copies of your mail they can be entered here"));
115 115
116 addressButton = new QToolButton( widget, "addressButton" ); 116 addressButton = new QToolButton( widget, "addressButton" );
117 addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); 117 addressButton->setPixmap( Resource::loadPixmap("AddressBook") );
118 addressButton->setToggleButton(TRUE); 118 addressButton->setToggleButton(TRUE);
119 grid->addWidget( addressButton, 0, 2 ); 119 grid->addWidget( addressButton, 0, 2 );
120 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); 120 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) );
121 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); 121 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your Opie addressbook"));
122 122
123 emailInput = new QMultiLineEdit( widget, "emailInput" ); 123 emailInput = new QMultiLineEdit( widget, "emailInput" );
124 grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); 124 grid->addMultiCellWidget( emailInput, 2, 2, 0, 2);
125 QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); 125 QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here"));
126 126
127 addressView = new QListView( widget, "addressView"); 127 addressView = new QListView( widget, "addressView");
128 addressView->addColumn("Name"); 128 addressView->addColumn(tr("Name"));
129 addressView->addColumn("EMail"); 129 addressView->addColumn(tr("EMail") );
130 addressView->setAllColumnsShowFocus(TRUE); 130 addressView->setAllColumnsShowFocus(TRUE);
131 addressView->setMultiSelection(TRUE); 131 addressView->setMultiSelection(TRUE);
132 addressView->hide(); 132 addressView->hide();
133 grid->addMultiCellWidget( addressView, 3, 3, 0, 2); 133 grid->addMultiCellWidget( addressView, 3, 3, 0, 2);
134 QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); 134 QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list"));
135 135
136 okButton = new QToolButton(bar, "ok"); 136 okButton = new QToolButton(bar, "ok");
137 okButton->setPixmap( Resource::loadPixmap("enter") ); 137 okButton->setPixmap( Resource::loadPixmap("enter") );
138 okButton->hide(); 138 okButton->hide();
139 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); 139 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) );
140 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); 140 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here"));
141 141
142 setCentralWidget(widget); 142 setCentralWidget(widget);
143} 143}
144 144
145void WriteMail::reject() 145void WriteMail::reject()
146{ 146{
147 emit cancelMail(); 147 emit cancelMail();
148} 148}
149 149
150void WriteMail::accept() 150void WriteMail::accept()
151{ 151{
152 QStringList attachedFiles, attachmentsType; 152 QStringList attachedFiles, attachmentsType;
153 int idCount = 0; 153 int idCount = 0;
@@ -262,57 +262,57 @@ void WriteMail::reply(Email replyMail, bool replyAll)
262 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)
263 { 263 {
264 ccRecipients.append(*it); 264 ccRecipients.append(*it);
265 ccRecipients.append(";"); 265 ccRecipients.append(";");
266 } 266 }
267 ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end 267 ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end
268 ccInput->setText(ccRecipients); 268 ccInput->setText(ccRecipients);
269 } 269 }
270 else ccInput->clear(); 270 else ccInput->clear();
271 271
272 subjectInput->setText(tr("Re: ") + mail.subject); 272 subjectInput->setText(tr("Re: ") + mail.subject);
273 273
274 QString citation=mail.fromMail; 274 QString citation=mail.fromMail;
275 citation.append(tr(" wrote on ")); 275 citation.append(tr(" wrote on "));
276 citation.append(mail.date); 276 citation.append(mail.date);
277 citation.append(":\n"); 277 citation.append(":\n");
278 278
279 279
280 //mail.body.insert(0,tr("On")); 280 //mail.body.insert(0,tr("On"));
281 pos = 0; 281 pos = 0;
282 mail.body.insert(pos, ">"); 282 mail.body.insert(pos, ">");
283 while (pos != -1) { 283 while (pos != -1) {
284 pos = mail.body.find('\n', pos); 284 pos = mail.body.find('\n', pos);
285 if (pos != -1) 285 if (pos != -1)
286 mail.body.insert(++pos, ">>"); 286 mail.body.insert(++pos, ">");
287 } 287 }
288 mail.body.insert(0,citation); 288 mail.body.insert(0,citation);
289 emailInput->setText(mail.body); 289 emailInput->setText(mail.body);
290} 290}
291 291
292void WriteMail::forward(Email forwMail) 292void WriteMail::forward(Email forwMail)
293{ 293{
294 int pos=0; 294 // int pos=0;
295 295
296 QString fwdBody=tr("======forwarded message from "); 296 QString fwdBody=tr("======forwarded message from ");
297 fwdBody.append(forwMail.fromMail); 297 fwdBody.append(forwMail.fromMail);
298 fwdBody.append(tr(" starts======\n\n")); 298 fwdBody.append(tr(" starts======\n\n"));
299 299
300 mail=forwMail; 300 mail=forwMail;
301 toInput->setText(""); 301 toInput->setText("");
302 ccInput->setText(""); 302 ccInput->setText("");
303 subjectInput->setText(tr("FWD: ") + mail.subject); 303 subjectInput->setText(tr("FWD: ") + mail.subject);
304 304
305 fwdBody+=mail.body; 305 fwdBody+=mail.body;
306 fwdBody+=QString(tr("======end of forwarded message======\n\n")); 306 fwdBody+=QString(tr("======end of forwarded message======\n\n"));
307 307
308 emailInput->setText(fwdBody); 308 emailInput->setText(fwdBody);
309} 309}
310 310
311bool WriteMail::getRecipients(bool ccField) 311bool WriteMail::getRecipients(bool ccField)
312{ 312{
313 QString str, temp; 313 QString str, temp;
314 int pos = 0; 314 int pos = 0;
315 315
316 if (ccField) 316 if (ccField)
317 { 317 {
318 mail.carbonCopies.clear(); 318 mail.carbonCopies.clear();