author | groucho <groucho> | 2003-04-20 07:59:48 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-20 07:59:48 (UTC) |
commit | 8b85cba50912127ff6a2d048021baf68306481c6 (patch) (unidiff) | |
tree | bfd1b377911d05db8e1c816f72fe070d5a5b2ff3 /noncore/unsupported | |
parent | 6b381e438fdeb1757b3278c683349dee9c4ab230 (diff) | |
download | opie-8b85cba50912127ff6a2d048021baf68306481c6.zip opie-8b85cba50912127ff6a2d048021baf68306481c6.tar.gz opie-8b85cba50912127ff6a2d048021baf68306481c6.tar.bz2 |
- Added CC: support
- Added mail forwarding
- Added icon for selective mail download
- Removing mails from mail list via icon
- Temporarily disabled mail header download queue
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 154 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 32 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 17 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 40 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.cpp | 36 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 103 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.h | 9 |
9 files changed, 361 insertions, 43 deletions
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 0d82a9a..ad1e0b4 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -56,14 +56,18 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
56 | 56 | ||
57 | connect(emailHandler, SIGNAL(smtpError(int)), this, | 57 | connect(emailHandler, SIGNAL(smtpError(int)), this, |
58 | SLOT(smtpError(int)) ); | 58 | SLOT(smtpError(int)) ); |
59 | connect(emailHandler, SIGNAL(popError(int)), this, | 59 | connect(emailHandler, SIGNAL(popError(int)), this, |
60 | SLOT(popError(int)) ); | 60 | SLOT(popError(int)) ); |
61 | 61 | ||
62 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); | 62 | connect(inboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(inboxItemSelected()) ); |
63 | connect(outboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 63 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
64 | |||
65 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); | ||
66 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); | ||
67 | |||
64 | 68 | ||
65 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 69 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, |
66 | SLOT(mailArrived(const Email &, bool)) ); | 70 | SLOT(mailArrived(const Email &, bool)) ); |
67 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, | 71 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, |
68 | SLOT(allMailArrived(int)) ); | 72 | SLOT(allMailArrived(int)) ); |
69 | 73 | ||
@@ -140,16 +144,32 @@ void EmailClient::init() | |||
140 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); | 144 | mail->insertItem(tr("Get Mail in"), selectAccountMenu); |
141 | configure->insertItem(tr("Edit account"), editAccountMenu); | 145 | configure->insertItem(tr("Edit account"), editAccountMenu); |
142 | configure->insertItem(tr("Delete account"), deleteAccountMenu); | 146 | configure->insertItem(tr("Delete account"), deleteAccountMenu); |
143 | 147 | ||
144 | bar = new QToolBar(this); | 148 | bar = new QToolBar(this); |
145 | 149 | ||
146 | getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | 150 | getMailButton = new QToolButton(Resource::loadPixmap("mailit/getmail"),tr("getMail"),tr("select account"), this,SLOT(getAllNewMail()),bar); |
151 | //connect(setAccountlButton, SIGNAL(activated()), this, SLOT(setCurrentAccount()) ); | ||
152 | // setAccountButton->addTo(bar); | ||
153 | //setAccountButton->addTo(mail); | ||
154 | |||
155 | /*idCount = 0; | ||
156 | |||
157 | for (MailAccount* accountPtr = accountList.first(); accountPtr != 0; | ||
158 | accountPtr = accountList.next()) { | ||
159 | |||
160 | selectAccountMenu->insertItem(accountPtr->accountName,this, SLOT(selectAccount(int)), 0, idCount); | ||
161 | idCount++; | ||
162 | }*/ | ||
163 | getMailButton->setPopup(selectAccountMenu); | ||
164 | |||
165 | |||
166 | /*getMailButton = new QAction(tr("Get all mail"), Resource::loadPixmap("mailit/getmail"), QString::null, 0, this, 0); | ||
147 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); | 167 | connect(getMailButton, SIGNAL(activated()), this, SLOT(getAllNewMail()) ); |
148 | getMailButton->addTo(bar); | 168 | getMailButton->addTo(bar);*/ |
149 | getMailButton->addTo(mail); | 169 | //getMailButton->addTo(mail); |
150 | 170 | ||
151 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); | 171 | sendMailButton = new QAction(tr("Send mail"), Resource::loadPixmap("mailit/sendqueue"), QString::null, 0, this, 0); |
152 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); | 172 | connect(sendMailButton, SIGNAL(activated()), this, SLOT(sendQuedMail()) ); |
153 | sendMailButton->addTo(bar); | 173 | sendMailButton->addTo(bar); |
154 | sendMailButton->addTo(mail); | 174 | sendMailButton->addTo(mail); |
155 | 175 | ||
@@ -161,12 +181,16 @@ void EmailClient::init() | |||
161 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); | 181 | cancelButton = new QAction(tr("Cancel transfer"), Resource::loadPixmap("close"), QString::null, 0, this, 0); |
162 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); | 182 | connect(cancelButton, SIGNAL(activated()), this, SLOT(cancel()) ); |
163 | cancelButton->addTo(mail); | 183 | cancelButton->addTo(mail); |
164 | cancelButton->addTo(bar); | 184 | cancelButton->addTo(bar); |
165 | cancelButton->setEnabled(FALSE); | 185 | cancelButton->setEnabled(FALSE); |
166 | 186 | ||
187 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | ||
188 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | ||
189 | deleteButton->addTo(bar); | ||
190 | |||
167 | mailboxView = new OTabWidget( this, "mailboxView" ); | 191 | mailboxView = new OTabWidget( this, "mailboxView" ); |
168 | 192 | ||
169 | QWidget* widget = new QWidget( mailboxView, "widget" ); | 193 | QWidget* widget = new QWidget( mailboxView, "widget" ); |
170 | grid_2 = new QGridLayout( widget ); | 194 | grid_2 = new QGridLayout( widget ); |
171 | // grid_2->setSpacing(6); | 195 | // grid_2->setSpacing(6); |
172 | // grid_2->setMargin( 11 ); | 196 | // grid_2->setMargin( 11 ); |
@@ -192,12 +216,14 @@ void EmailClient::init() | |||
192 | outboxView->setAllColumnsShowFocus(TRUE); | 216 | outboxView->setAllColumnsShowFocus(TRUE); |
193 | 217 | ||
194 | grid_3->addWidget( outboxView, 0, 0 ); | 218 | grid_3->addWidget( outboxView, 0, 0 ); |
195 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 219 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
196 | 220 | ||
197 | setCentralWidget(mailboxView); | 221 | setCentralWidget(mailboxView); |
222 | |||
223 | mailboxView->setCurrentTab(0); | ||
198 | } | 224 | } |
199 | 225 | ||
200 | void EmailClient::compose() | 226 | void EmailClient::compose() |
201 | { | 227 | { |
202 | emit composeRequested(); | 228 | emit composeRequested(); |
203 | } | 229 | } |
@@ -229,12 +255,14 @@ void EmailClient::enqueMail(const Email &mail) | |||
229 | Email addMail = mail; | 255 | Email addMail = mail; |
230 | addMail.from = currentAccount->name; | 256 | addMail.from = currentAccount->name; |
231 | addMail.fromMail = currentAccount->emailAddress; | 257 | addMail.fromMail = currentAccount->emailAddress; |
232 | addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); | 258 | addMail.rawMail.prepend("From: " + addMail.from + "<" + addMail.fromMail + ">\n"); |
233 | item = new EmailListItem(outboxView, addMail, false); | 259 | item = new EmailListItem(outboxView, addMail, false); |
234 | 260 | ||
261 | mailboxView->setCurrentTab(1); | ||
262 | |||
235 | } | 263 | } |
236 | 264 | ||
237 | void EmailClient::sendQuedMail() | 265 | void EmailClient::sendQuedMail() |
238 | { | 266 | { |
239 | int count = 0; | 267 | int count = 0; |
240 | 268 | ||
@@ -293,22 +321,22 @@ void EmailClient::getNewMail() { | |||
293 | selectAccountMenu->setEnabled(FALSE); | 321 | selectAccountMenu->setEnabled(FALSE); |
294 | 322 | ||
295 | status1Label->setText(currentAccount->accountName + " headers"); | 323 | status1Label->setText(currentAccount->accountName + " headers"); |
296 | progressBar->reset(); | 324 | progressBar->reset(); |
297 | 325 | ||
298 | //get any previous mails not downloaded and add to queue | 326 | //get any previous mails not downloaded and add to queue |
299 | mailDownloadList.clear(); | 327 | /* mailDownloadList.clear(); |
300 | Email *mailPtr; | 328 | Email *mailPtr; |
301 | item = (EmailListItem *) inboxView->firstChild(); | 329 | item = (EmailListItem *) inboxView->firstChild(); |
302 | while (item != NULL) { | 330 | while (item != NULL) { |
303 | mailPtr = item->getMail(); | 331 | mailPtr = item->getMail(); |
304 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 332 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
305 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 333 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
306 | } | 334 | } |
307 | item = (EmailListItem *) item->nextSibling(); | 335 | item = (EmailListItem *) item->nextSibling(); |
308 | } | 336 | }*/ |
309 | 337 | ||
310 | emailHandler->getMailHeaders(); | 338 | emailHandler->getMailHeaders(); |
311 | } | 339 | } |
312 | 340 | ||
313 | void EmailClient::getAllNewMail() | 341 | void EmailClient::getAllNewMail() |
314 | { | 342 | { |
@@ -412,12 +440,14 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
412 | } else { | 440 | } else { |
413 | item = new EmailListItem(inboxView, newMail, TRUE); | 441 | item = new EmailListItem(inboxView, newMail, TRUE); |
414 | if (!newMail.downloaded) | 442 | if (!newMail.downloaded) |
415 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size); | 443 | mailDownloadList.sizeInsert(newMail.serverId, newMail.size); |
416 | } | 444 | } |
417 | 445 | ||
446 | mailboxView->setCurrentTab(0); | ||
447 | |||
418 | } | 448 | } |
419 | 449 | ||
420 | void EmailClient::allMailArrived(int count) | 450 | void EmailClient::allMailArrived(int count) |
421 | { | 451 | { |
422 | // not previewing means all mailtransfer has been done | 452 | // not previewing means all mailtransfer has been done |
423 | if (!previewingMail) { | 453 | if (!previewingMail) { |
@@ -441,12 +471,14 @@ void EmailClient::allMailArrived(int count) | |||
441 | // all headers downloaded from server, start downloading remaining mails | 471 | // all headers downloaded from server, start downloading remaining mails |
442 | previewingMail = FALSE; | 472 | previewingMail = FALSE; |
443 | status1Label->setText(currentAccount->accountName); | 473 | status1Label->setText(currentAccount->accountName); |
444 | progressBar->reset(); | 474 | progressBar->reset(); |
445 | 475 | ||
446 | emailHandler->getMailByList(&mailDownloadList); | 476 | emailHandler->getMailByList(&mailDownloadList); |
477 | |||
478 | mailboxView->setCurrentTab(0); | ||
447 | } | 479 | } |
448 | 480 | ||
449 | void EmailClient::moveMailFront(Email *mailPtr) | 481 | void EmailClient::moveMailFront(Email *mailPtr) |
450 | { | 482 | { |
451 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { | 483 | if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { |
452 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); | 484 | mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); |
@@ -506,20 +538,24 @@ void EmailClient::popError(int code) | |||
506 | cancelButton->setEnabled(FALSE); | 538 | cancelButton->setEnabled(FALSE); |
507 | selectAccountMenu->setEnabled(TRUE); | 539 | selectAccountMenu->setEnabled(TRUE); |
508 | } | 540 | } |
509 | 541 | ||
510 | void EmailClient::inboxItemSelected() | 542 | void EmailClient::inboxItemSelected() |
511 | { | 543 | { |
544 | killTimer(timerID); | ||
545 | |||
512 | item = (EmailListItem*) inboxView->selectedItem(); | 546 | item = (EmailListItem*) inboxView->selectedItem(); |
513 | if (item != NULL) { | 547 | if (item != NULL) { |
514 | emit viewEmail(inboxView, item->getMail()); | 548 | emit viewEmail(inboxView, item->getMail()); |
515 | } | 549 | } |
516 | } | 550 | } |
517 | 551 | ||
518 | void EmailClient::outboxItemSelected() | 552 | void EmailClient::outboxItemSelected() |
519 | { | 553 | { |
554 | killTimer(timerID); | ||
555 | |||
520 | item = (EmailListItem*) outboxView->selectedItem(); | 556 | item = (EmailListItem*) outboxView->selectedItem(); |
521 | if (item != NULL) { | 557 | if (item != NULL) { |
522 | emit viewEmail(outboxView, item->getMail()); | 558 | emit viewEmail(outboxView, item->getMail()); |
523 | } | 559 | } |
524 | 560 | ||
525 | } | 561 | } |
@@ -689,22 +725,23 @@ void EmailClient::readSettings() | |||
689 | accountIdCount = y; | 725 | accountIdCount = y; |
690 | } | 726 | } |
691 | } | 727 | } |
692 | 728 | ||
693 | void EmailClient::saveSettings() | 729 | void EmailClient::saveSettings() |
694 | { | 730 | { |
731 | |||
695 | QString temp; | 732 | QString temp; |
696 | QFile f( getPath(FALSE) + "settings.txt"); | 733 | QFile f( getPath(FALSE) + "settings.txt"); |
697 | MailAccount *accountPtr; | 734 | MailAccount *accountPtr; |
698 | 735 | ||
699 | if (! f.open(IO_WriteOnly) ) { | 736 | if (! f.open(IO_WriteOnly) ) { |
700 | qWarning("could not save settings file"); | 737 | qWarning("could not save settings file"); |
701 | return; | 738 | return; |
702 | } | 739 | } |
703 | QTextStream t(&f); | 740 | QTextStream t(&f); |
704 | t << "#Settings for QPE Mailit program\n"; | 741 | t << "#Settings for OPIE Mailit program\n"; |
705 | 742 | ||
706 | for (accountPtr = accountList.first(); accountPtr != 0; | 743 | for (accountPtr = accountList.first(); accountPtr != 0; |
707 | accountPtr = accountList.next()) { | 744 | accountPtr = accountList.next()) { |
708 | 745 | ||
709 | t << "accountStart;\n"; | 746 | t << "accountStart;\n"; |
710 | t << "AccountName: " + accountPtr->accountName + "\n"; | 747 | t << "AccountName: " + accountPtr->accountName + "\n"; |
@@ -808,26 +845,27 @@ void EmailClient::updateAccounts() | |||
808 | idCount = 0; | 845 | idCount = 0; |
809 | for (accountPtr = accountList.first(); accountPtr != 0; | 846 | for (accountPtr = accountList.first(); accountPtr != 0; |
810 | accountPtr = accountList.next()) { | 847 | accountPtr = accountList.next()) { |
811 | 848 | ||
812 | editAccountMenu->insertItem(accountPtr->accountName, | 849 | editAccountMenu->insertItem(accountPtr->accountName, |
813 | this, SLOT(editAccount(int)), 0, idCount); | 850 | this, SLOT(editAccount(int)), 0, idCount); |
814 | selectAccountMenu->insertItem(accountPtr->accountName, | 851 | selectAccountMenu->insertItem(accountPtr->accountName, |
815 | this, SLOT(selectAccount(int)), 0, idCount); | 852 | this, SLOT(selectAccount(int)), 0, idCount); |
816 | deleteAccountMenu->insertItem(accountPtr->accountName, | 853 | deleteAccountMenu->insertItem(accountPtr->accountName, |
817 | this, SLOT(deleteAccount(int)), 0, idCount); | 854 | this, SLOT(deleteAccount(int)), 0, idCount); |
818 | idCount++; | 855 | idCount++; |
819 | } | 856 | } |
820 | } | 857 | } |
821 | 858 | ||
822 | void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | 859 | void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) |
823 | { | 860 | { |
824 | Email *mPtr; | 861 | Email *mPtr; |
825 | Enclosure *ePtr; | 862 | Enclosure *ePtr; |
826 | 863 | ||
827 | if (inbox) { | 864 | if (inbox) |
865 | { | ||
828 | mPtr = mailItem->getMail(); | 866 | mPtr = mailItem->getMail(); |
829 | 867 | ||
830 | //if mail is in queue for download, remove it from | 868 | //if mail is in queue for download, remove it from |
831 | //queue if possible | 869 | //queue if possible |
832 | if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { | 870 | if ( (receiving) && (mPtr->fromAccountId == currentAccount->id) ) { |
833 | if ( !mPtr->downloaded ) | 871 | if ( !mPtr->downloaded ) |
@@ -841,13 +879,15 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
841 | for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { | 879 | for ( ePtr=mPtr->files.first(); ePtr != 0; ePtr=mPtr->files.next() ) { |
842 | if (ePtr->saved) { | 880 | if (ePtr->saved) { |
843 | QFile::remove( (ePtr->path + ePtr->name) ); | 881 | QFile::remove( (ePtr->path + ePtr->name) ); |
844 | } | 882 | } |
845 | } | 883 | } |
846 | inboxView->takeItem(mailItem); | 884 | inboxView->takeItem(mailItem); |
847 | } else { | 885 | } |
886 | else | ||
887 | { | ||
848 | outboxView->takeItem(mailItem); | 888 | outboxView->takeItem(mailItem); |
849 | } | 889 | } |
850 | } | 890 | } |
851 | 891 | ||
852 | void EmailClient::setMailSize(int size) | 892 | void EmailClient::setMailSize(int size) |
853 | { | 893 | { |
@@ -867,6 +907,98 @@ void EmailClient::setDownloadedSize(int size) | |||
867 | if (size < total) { | 907 | if (size < total) { |
868 | progressBar->setProgress(size); | 908 | progressBar->setProgress(size); |
869 | } else { | 909 | } else { |
870 | progressBar->setProgress(total); | 910 | progressBar->setProgress(total); |
871 | } | 911 | } |
872 | } | 912 | } |
913 | |||
914 | void EmailClient::deleteItem() | ||
915 | { | ||
916 | bool inbox=mailboxView->currentTab()==0; | ||
917 | |||
918 | EmailListItem* eli; | ||
919 | |||
920 | inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); | ||
921 | |||
922 | if (eli) | ||
923 | deleteMail(eli,(bool&)inbox); | ||
924 | } | ||
925 | |||
926 | void EmailClient::inboxItemPressed() | ||
927 | { | ||
928 | //timerID=startTimer(500); | ||
929 | } | ||
930 | |||
931 | void EmailClient::inboxItemReleased() | ||
932 | { | ||
933 | //killTimer(timerID); | ||
934 | } | ||
935 | |||
936 | void EmailClient::timerEvent(QTimerEvent *e) | ||
937 | { | ||
938 | /*killTimer(timerID); | ||
939 | |||
940 | |||
941 | QPopupMenu *action = new QPopupMenu(this); | ||
942 | |||
943 | int reply=0; | ||
944 | |||
945 | action->insertItem(tr( "Reply To" ),this,SLOT(reply())); | ||
946 | action->insertItem( tr( "Reply All" ),this,SLOT(replyAll())); | ||
947 | action->insertItem( tr( "Forward" ), this,SLOT(forward())); | ||
948 | action->insertItem( tr( "Remove Mail" ), this,SLOT(remove())); | ||
949 | |||
950 | action->exec(QCursor::pos()); | ||
951 | |||
952 | if (action) delete action; | ||
953 | */ | ||
954 | } | ||
955 | |||
956 | Email* EmailClient::getCurrentMail() | ||
957 | { | ||
958 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); | ||
959 | if (eli!=NULL) | ||
960 | return eli->getMail(); | ||
961 | else | ||
962 | return NULL; | ||
963 | } | ||
964 | |||
965 | /* | ||
966 | void EmailClient::reply() | ||
967 | { | ||
968 | Email* mail=getCurrentMail(); | ||
969 | |||
970 | if (mail!=NULL) | ||
971 | { | ||
972 | emit reply(*mail); | ||
973 | } | ||
974 | } | ||
975 | |||
976 | void EmailClient::replyAll() | ||
977 | { | ||
978 | Email* mail=getCurrentMail(); | ||
979 | |||
980 | if (mail!=NULL) | ||
981 | { | ||
982 | emit replyAll(*mail); | ||
983 | } | ||
984 | } | ||
985 | |||
986 | void EmailClient::forward() | ||
987 | { | ||
988 | Email* mail=getCurrentMail(); | ||
989 | |||
990 | if (mail!=NULL) | ||
991 | { | ||
992 | emit reply(*mail); | ||
993 | } | ||
994 | } | ||
995 | |||
996 | void EmailClient::remove() | ||
997 | { | ||
998 | Email* mail=getCurrentMail(); | ||
999 | |||
1000 | if (mail!=NULL) | ||
1001 | { | ||
1002 | emit remove(*mail); | ||
1003 | } | ||
1004 | }*/ \ No newline at end of file | ||
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h index 80457f9..0890dcf 100644 --- a/noncore/unsupported/mailit/emailclient.h +++ b/noncore/unsupported/mailit/emailclient.h | |||
@@ -29,20 +29,22 @@ | |||
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qlistview.h> | 31 | #include <qlistview.h> |
32 | #include <qaction.h> | 32 | #include <qaction.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qtooltip.h> | 34 | #include <qtooltip.h> |
35 | #include <qtoolbutton.h> | ||
35 | #include <qimage.h> | 36 | #include <qimage.h> |
36 | #include <qpixmap.h> | 37 | #include <qpixmap.h> |
37 | #include <qstringlist.h> | 38 | #include <qstringlist.h> |
38 | #include <qprogressbar.h> | 39 | #include <qprogressbar.h> |
39 | #include <qstatusbar.h> | 40 | #include <qstatusbar.h> |
40 | #include <qdir.h> | 41 | #include <qdir.h> |
41 | #include <stdlib.h> | 42 | #include <stdlib.h> |
42 | #include <opie/otabwidget.h> | 43 | #include <opie/otabwidget.h> |
44 | #include <qtimer.h> | ||
43 | 45 | ||
44 | #include "emailhandler.h" | 46 | #include "emailhandler.h" |
45 | #include "emaillistitem.h" | 47 | #include "emaillistitem.h" |
46 | #include "textparser.h" | 48 | #include "textparser.h" |
47 | #include "editaccount.h" | 49 | #include "editaccount.h" |
48 | #include "maillist.h" | 50 | #include "maillist.h" |
@@ -66,52 +68,69 @@ class EmailClient : public QMainWindow | |||
66 | 68 | ||
67 | public: | 69 | public: |
68 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); | 70 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); |
69 | ~EmailClient(); | 71 | ~EmailClient(); |
70 | AddressList* getAdrListRef(); | 72 | AddressList* getAdrListRef(); |
71 | 73 | ||
74 | protected: | ||
75 | void timerEvent(QTimerEvent*); | ||
76 | |||
72 | signals: | 77 | signals: |
73 | void composeRequested(); | 78 | void composeRequested(); |
74 | void viewEmail(QListView *, Email *); | 79 | void viewEmail(QListView *, Email *); |
75 | void mailUpdated(Email *); | 80 | void mailUpdated(Email *); |
76 | void newCaption(const QString &); | 81 | void newCaption(const QString &); |
77 | 82 | void replyRequested(Email&, bool&); | |
83 | void forwardRequested(Email&); | ||
84 | void removeItem(EmailListItem*, bool&); | ||
85 | /*void reply(Email&); | ||
86 | void replyAll(Email&); | ||
87 | void remove(Email&); | ||
88 | void forward(Email&);*/ | ||
89 | |||
78 | public slots: | 90 | public slots: |
79 | void compose(); | 91 | void compose(); |
80 | void cancel(); | 92 | void cancel(); |
81 | void enqueMail(const Email &mail); | 93 | void enqueMail(const Email &mail); |
82 | void setMailAccount(); | 94 | void setMailAccount(); |
83 | void sendQuedMail(); | 95 | void sendQuedMail(); |
84 | void mailSent(); | 96 | void mailSent(); |
97 | void deleteItem(); | ||
85 | void getNewMail(); | 98 | void getNewMail(); |
86 | void getAllNewMail(); | 99 | void getAllNewMail(); |
87 | void smtpError(int code); | 100 | void smtpError(int code); |
88 | void popError(int code); | 101 | void popError(int code); |
89 | void inboxItemSelected(); | 102 | void inboxItemSelected(); |
90 | void outboxItemSelected(); | 103 | void outboxItemSelected(); |
104 | void inboxItemPressed(); | ||
105 | void inboxItemReleased(); | ||
91 | void mailArrived(const Email &mail, bool fromDisk); | 106 | void mailArrived(const Email &mail, bool fromDisk); |
92 | void allMailArrived(int); | 107 | void allMailArrived(int); |
93 | void saveMail(QString fileName, QListView *view); | 108 | void saveMail(QString fileName, QListView *view); |
94 | void selectAccount(int); | 109 | void selectAccount(int); |
95 | void editAccount(int); | 110 | void editAccount(int); |
96 | void updateAccounts(); | 111 | void updateAccounts(); |
97 | void deleteAccount(int); | 112 | void deleteAccount(int); |
98 | void deleteMail(EmailListItem *mailItem, bool &inbox); | 113 | void deleteMail(EmailListItem *mailItem, bool &inbox); |
99 | void setTotalSize(int); | 114 | void setTotalSize(int); |
100 | void setMailSize(int); | 115 | void setMailSize(int); |
101 | void setDownloadedSize(int); | 116 | void setDownloadedSize(int); |
102 | void moveMailFront(Email *mailPtr); | 117 | void moveMailFront(Email *mailPtr); |
118 | /* void reply(); | ||
119 | void replyAll(); | ||
120 | void forward(); | ||
121 | void remove();*/ | ||
103 | 122 | ||
104 | private: | 123 | private: |
105 | void init(); | 124 | void init(); |
106 | void readMail(); | 125 | void readMail(); |
107 | QString getPath(bool enclosurePath); | 126 | QString getPath(bool enclosurePath); |
108 | void readSettings(); | 127 | void readSettings(); |
109 | void saveSettings(); | 128 | void saveSettings(); |
110 | 129 | Email* getCurrentMail(); | |
111 | private: | 130 | int timerID; |
112 | Config *mailconf; | 131 | Config *mailconf; |
113 | int newAccountId, idCount, mailIdCount; | 132 | int newAccountId, idCount, mailIdCount; |
114 | int accountIdCount; | 133 | int accountIdCount; |
115 | AccountList accountList; | 134 | AccountList accountList; |
116 | AddressList *addressList; | 135 | AddressList *addressList; |
117 | 136 | ||
@@ -125,21 +144,24 @@ private: | |||
125 | MailAccount account, *currentAccount; | 144 | MailAccount account, *currentAccount; |
126 | 145 | ||
127 | QToolBar *bar; | 146 | QToolBar *bar; |
128 | QProgressBar *progressBar; | 147 | QProgressBar *progressBar; |
129 | QStatusBar *statusBar; | 148 | QStatusBar *statusBar; |
130 | QLabel *status1Label, *status2Label; | 149 | QLabel *status1Label, *status2Label; |
131 | QAction *getMailButton; | 150 | QToolButton *getMailButton; |
132 | QAction *sendMailButton; | 151 | QAction *sendMailButton; |
133 | QAction *composeButton; | 152 | QAction *composeButton; |
134 | QAction *cancelButton; | 153 | QAction *cancelButton; |
135 | 154 | QAction *deleteButton; | |
155 | //QToolButton *setAccountButton; | ||
156 | |||
136 | QMenuBar *mb; | 157 | QMenuBar *mb; |
137 | QPopupMenu *selectAccountMenu; | 158 | QPopupMenu *selectAccountMenu; |
138 | QPopupMenu *editAccountMenu; | 159 | QPopupMenu *editAccountMenu; |
139 | QPopupMenu *deleteAccountMenu; | 160 | QPopupMenu *deleteAccountMenu; |
161 | QPopupMenu *setAccountMenu; | ||
140 | 162 | ||
141 | OTabWidget* mailboxView; | 163 | OTabWidget* mailboxView; |
142 | QListView* inboxView; | 164 | QListView* inboxView; |
143 | QListView* outboxView; | 165 | QListView* outboxView; |
144 | 166 | ||
145 | QGridLayout* grid_2; | 167 | QGridLayout* grid_2; |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index 03f8a28..f6c6d60 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -197,19 +197,25 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
197 | mail->fromMail.truncate(mail->fromMail.length() - 1); | 197 | mail->fromMail.truncate(mail->fromMail.length() - 1); |
198 | mail->from=mail->fromMail; | 198 | mail->from=mail->fromMail; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: | 202 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: |
203 | if (pos = p.find("TO",':', pos, TRUE) != -1) | 203 | if ((pos = p.find("TO",':', 0, TRUE)) != -1) |
204 | { | 204 | { |
205 | pos++; | 205 | pos++; |
206 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); | 206 | mail->recipients.append (p.getString(&pos, 'z', TRUE) ); |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | //@@@ToDo: Rewrite the parser as To: stops at the first occurence- which is Delivered-To: | |
210 | if ((pos = p.find("CC",':', 0, TRUE)) != -1) | ||
211 | { | ||
212 | pos++; | ||
213 | mail->carbonCopies.append (p.getString(&pos, 'z', TRUE) ); | ||
214 | } | ||
215 | |||
210 | 216 | ||
211 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { | 217 | if ((pos = p.find("SUBJECT",':', 0, TRUE)) != -1) { |
212 | pos++; | 218 | pos++; |
213 | mail->subject = p.getString(&pos, 'z', TRUE); | 219 | mail->subject = p.getString(&pos, 'z', TRUE); |
214 | } | 220 | } |
215 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { | 221 | if ((pos = p.find("DATE",':', 0, TRUE)) != -1) { |
@@ -431,12 +437,19 @@ int EmailHandler::encodeMime(Email *mail) | |||
431 | 437 | ||
432 | //add standard headers | 438 | //add standard headers |
433 | newBody = "From: " + userName + "\r\nTo: "; | 439 | newBody = "From: " + userName + "\r\nTo: "; |
434 | for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { | 440 | for (QStringList::Iterator it = mail->recipients.begin(); it != mail->recipients.end(); ++it ) { |
435 | newBody += *it + " "; | 441 | newBody += *it + " "; |
436 | } | 442 | } |
443 | |||
444 | newBody += "\r\nCC: "; | ||
445 | |||
446 | for (QStringList::Iterator it = mail->carbonCopies.begin(); it != mail->carbonCopies.end(); ++it ) { | ||
447 | newBody += *it + " "; | ||
448 | } | ||
449 | |||
437 | newBody += "\r\nSubject: " + mail->subject + "\r\n"; | 450 | newBody += "\r\nSubject: " + mail->subject + "\r\n"; |
438 | 451 | ||
439 | if (mail->files.count() == 0) { //just a simple mail | 452 | if (mail->files.count() == 0) { //just a simple mail |
440 | newBody += "\r\n" + mail->body; | 453 | newBody += "\r\n" + mail->body; |
441 | mail->rawMail = newBody; | 454 | mail->rawMail = newBody; |
442 | return 0; | 455 | return 0; |
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index 2bf1dcb..ef5fc09 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp | |||
@@ -44,14 +44,17 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
44 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, | 44 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), this, |
45 | SLOT(showEmailClient()) ); | 45 | SLOT(showEmailClient()) ); |
46 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, | 46 | connect(writeMail, SIGNAL(sendMailRequested(const Email &)), emailClient, |
47 | SLOT(enqueMail(const Email &)) ); | 47 | SLOT(enqueMail(const Email &)) ); |
48 | 48 | ||
49 | connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); | 49 | connect(readMail, SIGNAL(cancelView()), this, SLOT(showEmailClient()) ); |
50 | connect(readMail, SIGNAL(replyRequested(Email &)), this, | 50 | connect(readMail, SIGNAL(replyRequested(Email &, bool&)), this, |
51 | SLOT(composeReply(Email &)) ); | 51 | SLOT(composeReply(Email &, bool&)) ); |
52 | connect(readMail, SIGNAL(forwardRequested(Email &)), this, | ||
53 | SLOT(composeForward(Email &)) ); | ||
54 | |||
52 | connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, | 55 | connect(readMail, SIGNAL(removeItem(EmailListItem *, bool &)), emailClient, |
53 | SLOT(deleteMail(EmailListItem *, bool &)) ); | 56 | SLOT(deleteMail(EmailListItem *, bool &)) ); |
54 | connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, | 57 | connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, |
55 | SLOT(moveMailFront(Email *)) ); | 58 | SLOT(moveMailFront(Email *)) ); |
56 | 59 | ||
57 | connect(emailClient, SIGNAL(newCaption(const QString &)), | 60 | connect(emailClient, SIGNAL(newCaption(const QString &)), |
@@ -80,18 +83,25 @@ void MailItWindow::compose() | |||
80 | readMail->hide(); | 83 | readMail->hide(); |
81 | views->raiseWidget(writeMail); | 84 | views->raiseWidget(writeMail); |
82 | writeMail->setAddressList(emailClient->getAdrListRef()); | 85 | writeMail->setAddressList(emailClient->getAdrListRef()); |
83 | setCaption( tr( "Write mail" ) ); | 86 | setCaption( tr( "Write mail" ) ); |
84 | } | 87 | } |
85 | 88 | ||
86 | void MailItWindow::composeReply(Email &mail) | 89 | void MailItWindow::composeReply(Email &mail, bool& replyAll) |
90 | { | ||
91 | compose(); | ||
92 | writeMail->reply(mail,replyAll) ; | ||
93 | } | ||
94 | |||
95 | void MailItWindow::composeForward(Email &mail) | ||
87 | { | 96 | { |
88 | compose(); | 97 | compose(); |
89 | writeMail->reply(mail); | 98 | writeMail->forward(mail) ; |
90 | } | 99 | } |
91 | 100 | ||
101 | |||
92 | void MailItWindow::showEmailClient() | 102 | void MailItWindow::showEmailClient() |
93 | { | 103 | { |
94 | viewingMail = FALSE; | 104 | viewingMail = FALSE; |
95 | writeMail->hide(); | 105 | writeMail->hide(); |
96 | readMail->hide(); | 106 | readMail->hide(); |
97 | views->raiseWidget(emailClient); | 107 | views->raiseWidget(emailClient); |
@@ -128,6 +138,28 @@ void MailItWindow::setDocument(const QString &_address) | |||
128 | address = address.mid(6); | 138 | address = address.mid(6); |
129 | 139 | ||
130 | compose(); | 140 | compose(); |
131 | writeMail->setRecipient(address); | 141 | writeMail->setRecipient(address); |
132 | } | 142 | } |
133 | 143 | ||
144 | /*void MailItWindow::reply(Email& mail) | ||
145 | { | ||
146 | qDebug("####EmailClient: 0 reached"); | ||
147 | composeReply(mail,(bool&)FALSE); | ||
148 | } | ||
149 | |||
150 | void MailItWindow::replyAll(Email& mail) | ||
151 | { | ||
152 | qDebug("####EmailClient: 1 reached"); | ||
153 | composeReply(mail,(bool&)TRUE); | ||
154 | } | ||
155 | |||
156 | void MailItWindow::forward(Email& mail) | ||
157 | { | ||
158 | qDebug("####EmailClient: 2 reached"); | ||
159 | } | ||
160 | |||
161 | void MailItWindow::remove(Email&) | ||
162 | { | ||
163 | qDebug("####EmailClient: 3 reached"); | ||
164 | //emit removeItem(eli,(bool&)TRUE); | ||
165 | } */ \ No newline at end of file | ||
diff --git a/noncore/unsupported/mailit/mailitwindow.h b/noncore/unsupported/mailit/mailitwindow.h index 667960b..e818d32 100644 --- a/noncore/unsupported/mailit/mailitwindow.h +++ b/noncore/unsupported/mailit/mailitwindow.h | |||
@@ -33,21 +33,27 @@ class MailItWindow: public QMainWindow | |||
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 36 | MailItWindow(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
37 | ~MailItWindow(); | 37 | ~MailItWindow(); |
38 | 38 | ||
39 | signals: | ||
39 | public slots: | 40 | public slots: |
40 | void compose(); | 41 | void compose(); |
41 | void composeReply(Email &); | 42 | void composeReply(Email &, bool&); |
43 | void composeForward(Email &); | ||
42 | void showEmailClient(); | 44 | void showEmailClient(); |
43 | void viewMail(QListView *, Email *mail); | 45 | void viewMail(QListView *, Email *mail); |
44 | void updateMailView(Email *mail); | 46 | void updateMailView(Email *mail); |
45 | void closeEvent(QCloseEvent *e); | 47 | void closeEvent(QCloseEvent *e); |
46 | void updateCaption(const QString &); | 48 | void updateCaption(const QString &); |
47 | void setDocument(const QString &); | 49 | void setDocument(const QString &); |
50 | /*void reply(Email&); | ||
51 | void replyAll(Email&); | ||
52 | void forward(Email&); | ||
53 | void remove(Email&);*/ | ||
48 | 54 | ||
49 | private: | 55 | private: |
50 | EmailClient *emailClient; | 56 | EmailClient *emailClient; |
51 | WriteMail *writeMail; | 57 | WriteMail *writeMail; |
52 | ReadMail *readMail; | 58 | ReadMail *readMail; |
53 | QWidgetStack *views; | 59 | QWidgetStack *views; |
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp index 7cd3e09..dc98a6f 100644 --- a/noncore/unsupported/mailit/readmail.cpp +++ b/noncore/unsupported/mailit/readmail.cpp | |||
@@ -56,13 +56,17 @@ void ReadMail::init() | |||
56 | bar = new QToolBar(this); | 56 | bar = new QToolBar(this); |
57 | 57 | ||
58 | //reply dependant on viewing inbox | 58 | //reply dependant on viewing inbox |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), | 59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), |
60 | QString::null, 0, this, 0 ); | 60 | QString::null, 0, this, 0 ); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | 61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); |
62 | 62 | ||
63 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | ||
64 | QString::null, 0, this, 0 ); | ||
65 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); | ||
66 | |||
63 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 67 | previousButton = new QAction( tr( "Previous" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
64 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 68 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
65 | previousButton->addTo(bar); | 69 | previousButton->addTo(bar); |
66 | previousButton->addTo(viewMenu); | 70 | previousButton->addTo(viewMenu); |
67 | 71 | ||
68 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); | 72 | nextButton = new QAction( tr( "Next" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); |
@@ -104,17 +108,22 @@ void ReadMail::updateView() | |||
104 | 108 | ||
105 | mail->read = TRUE; //mark as read | 109 | mail->read = TRUE; //mark as read |
106 | inbox = mail->received; | 110 | inbox = mail->received; |
107 | 111 | ||
108 | replyButton->removeFrom(mailMenu); | 112 | replyButton->removeFrom(mailMenu); |
109 | replyButton->removeFrom(bar); | 113 | replyButton->removeFrom(bar); |
114 | forwardButton->removeFrom(mailMenu); | ||
115 | forwardButton->removeFrom(bar); | ||
110 | 116 | ||
111 | if (inbox == TRUE) { | 117 | if (inbox == TRUE) { |
112 | replyButton->addTo(bar); | 118 | replyButton->addTo(bar); |
113 | replyButton->addTo(mailMenu); | 119 | replyButton->addTo(mailMenu); |
114 | 120 | forwardButton->addTo(bar); | |
121 | forwardButton->addTo(mailMenu); | ||
122 | |||
123 | |||
115 | if (!mail->downloaded) { | 124 | if (!mail->downloaded) { |
116 | //report currently viewed mail so that it will be | 125 | //report currently viewed mail so that it will be |
117 | //placed first in the queue of new mails to download | 126 | //placed first in the queue of new mails to download |
118 | emit viewingMail(mail); | 127 | emit viewingMail(mail); |
119 | 128 | ||
120 | double mailSize = (double) mail->size; | 129 | double mailSize = (double) mail->size; |
@@ -142,12 +151,19 @@ void ReadMail::updateView() | |||
142 | 151 | ||
143 | text +="<b>To: </b>"; | 152 | text +="<b>To: </b>"; |
144 | for (QStringList::Iterator it = mail->recipients.begin(); | 153 | for (QStringList::Iterator it = mail->recipients.begin(); |
145 | it != mail->recipients.end(); ++it ) { | 154 | it != mail->recipients.end(); ++it ) { |
146 | text += *it + " "; | 155 | text += *it + " "; |
147 | } | 156 | } |
157 | |||
158 | text +="<br><b>CC: </b>"; | ||
159 | for (QStringList::Iterator it = mail->carbonCopies.begin(); | ||
160 | it != mail->carbonCopies.end(); ++it ) { | ||
161 | text += *it + " "; | ||
162 | } | ||
163 | |||
148 | text += "<br>" + mail->date; | 164 | text += "<br>" + mail->date; |
149 | 165 | ||
150 | if (mail->files.count() > 0) { | 166 | if (mail->files.count() > 0) { |
151 | text += "<br><b>Attatchments: </b>"; | 167 | text += "<br><b>Attatchments: </b>"; |
152 | 168 | ||
153 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { | 169 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { |
@@ -199,12 +215,20 @@ void ReadMail::updateView() | |||
199 | text += "From: " + mail->from + " " + mail->fromMail + "\n"; | 215 | text += "From: " + mail->from + " " + mail->fromMail + "\n"; |
200 | text += "To: "; | 216 | text += "To: "; |
201 | for (QStringList::Iterator it = mail->recipients.begin(); | 217 | for (QStringList::Iterator it = mail->recipients.begin(); |
202 | it != mail->recipients.end(); ++it ) { | 218 | it != mail->recipients.end(); ++it ) { |
203 | text += *it + " "; | 219 | text += *it + " "; |
204 | } | 220 | } |
221 | |||
222 | text += "\nCC: "; | ||
223 | for (QStringList::Iterator it = mail->carbonCopies.begin(); | ||
224 | it != mail->carbonCopies.end(); ++it ) { | ||
225 | text += *it + " "; | ||
226 | } | ||
227 | |||
228 | |||
205 | text += "\nDate: " + mail->date + "\n"; | 229 | text += "\nDate: " + mail->date + "\n"; |
206 | if (mail->files.count() > 0) { | 230 | if (mail->files.count() > 0) { |
207 | text += "Attatchments: "; | 231 | text += "Attatchments: "; |
208 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { | 232 | for ( ePtr=mail->files.first(); ePtr != 0; ePtr=mail->files.next() ) { |
209 | text += ePtr->originalName + " "; | 233 | text += ePtr->originalName + " "; |
210 | } | 234 | } |
@@ -320,8 +344,14 @@ void ReadMail::viewAttatchments() | |||
320 | viewAtt->update(mail, inbox); | 344 | viewAtt->update(mail, inbox); |
321 | viewAtt->showMaximized(); | 345 | viewAtt->showMaximized(); |
322 | } | 346 | } |
323 | 347 | ||
324 | void ReadMail::reply() | 348 | void ReadMail::reply() |
325 | { | 349 | { |
326 | emit replyRequested(*mail); | 350 | emit replyRequested(*mail, (bool&)TRUE); |
327 | } | 351 | } |
352 | |||
353 | void ReadMail::forward() | ||
354 | { | ||
355 | emit forwardRequested(*mail); | ||
356 | } | ||
357 | |||
diff --git a/noncore/unsupported/mailit/readmail.h b/noncore/unsupported/mailit/readmail.h index d0bb067..0fe0646 100644 --- a/noncore/unsupported/mailit/readmail.h +++ b/noncore/unsupported/mailit/readmail.h | |||
@@ -43,24 +43,26 @@ public: | |||
43 | void update(QListView *thisView, Email *mailIn); | 43 | void update(QListView *thisView, Email *mailIn); |
44 | void updateView(); | 44 | void updateView(); |
45 | void mailUpdated(Email *mailIn); | 45 | void mailUpdated(Email *mailIn); |
46 | 46 | ||
47 | signals: | 47 | signals: |
48 | void cancelView(); | 48 | void cancelView(); |
49 | void replyRequested(Email &); | 49 | void replyRequested(Email &, bool &); |
50 | void forwardRequested(Email&); | ||
50 | void removeItem(EmailListItem *, bool &); | 51 | void removeItem(EmailListItem *, bool &); |
51 | void viewingMail(Email *); | 52 | void viewingMail(Email *); |
52 | 53 | ||
53 | public slots: | 54 | public slots: |
54 | void close(); | 55 | void close(); |
55 | void next(); | 56 | void next(); |
56 | void previous(); | 57 | void previous(); |
57 | void deleteItem(); | 58 | void deleteItem(); |
58 | void shiftText(); | 59 | void shiftText(); |
59 | void viewAttatchments(); | 60 | void viewAttatchments(); |
60 | void reply(); | 61 | void reply(); |
62 | void forward(); | ||
61 | 63 | ||
62 | private: | 64 | private: |
63 | void init(); | 65 | void init(); |
64 | void updateButtons(); | 66 | void updateButtons(); |
65 | 67 | ||
66 | private: | 68 | private: |
@@ -78,9 +80,10 @@ private: | |||
78 | QAction *plainTextButton; | 80 | QAction *plainTextButton; |
79 | QAction *nextButton; | 81 | QAction *nextButton; |
80 | QTextView *emailView; | 82 | QTextView *emailView; |
81 | QAction *attatchmentsButton; | 83 | QAction *attatchmentsButton; |
82 | QAction *previousButton; | 84 | QAction *previousButton; |
83 | QAction *replyButton; | 85 | QAction *replyButton; |
86 | QAction *forwardButton; | ||
84 | }; | 87 | }; |
85 | 88 | ||
86 | #endif // READMAIL_H | 89 | #endif // READMAIL_H |
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index 38a2596..a9dcb02 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -80,15 +80,17 @@ void WriteMail::init() | |||
80 | 80 | ||
81 | widget = new QWidget(this, "widget"); | 81 | widget = new QWidget(this, "widget"); |
82 | grid = new QGridLayout( widget ); | 82 | grid = new QGridLayout( widget ); |
83 | 83 | ||
84 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); | 84 | recipientsBox = new QComboBox( FALSE, widget, "toLabel" ); |
85 | recipientsBox->insertItem( tr( "To:" ) ); | 85 | recipientsBox->insertItem( tr( "To:" ) ); |
86 | recipientsBox->insertItem( tr( "CC:" ) ); | 86 | recipientsBox->insertItem( tr( "CC:" ) ); |
87 | recipientsBox->setCurrentItem(0); | 87 | recipientsBox->setCurrentItem(0); |
88 | grid->addWidget( recipientsBox, 0, 0 ); | 88 | grid->addWidget( recipientsBox, 0, 0 ); |
89 | connect(recipientsBox,SIGNAL(activated(int)),this, SLOT(changeRecipients(int))); | ||
90 | |||
89 | 91 | ||
90 | subjetLabel = new QLabel( widget, "subjetLabel" ); | 92 | subjetLabel = new QLabel( widget, "subjetLabel" ); |
91 | subjetLabel->setText( tr( "Subject:" ) ); | 93 | subjetLabel->setText( tr( "Subject:" ) ); |
92 | 94 | ||
93 | grid->addWidget( subjetLabel, 1, 0 ); | 95 | grid->addWidget( subjetLabel, 1, 0 ); |
94 | 96 | ||
@@ -99,12 +101,17 @@ void WriteMail::init() | |||
99 | subjectInput = new QLineEdit( widget, "subjectInput" ); | 101 | subjectInput = new QLineEdit( widget, "subjectInput" ); |
100 | grid->addWidget( subjectInput, 1, 1 ); | 102 | grid->addWidget( subjectInput, 1, 1 ); |
101 | 103 | ||
102 | toInput = new QLineEdit( widget, "toInput" ); | 104 | toInput = new QLineEdit( widget, "toInput" ); |
103 | grid->addWidget( toInput, 0, 1 ); | 105 | grid->addWidget( toInput, 0, 1 ); |
104 | 106 | ||
107 | ccInput = new QLineEdit( widget, "ccInput" ); | ||
108 | ccInput->hide(); | ||
109 | grid->addWidget( ccInput, 0, 1 ); | ||
110 | |||
111 | |||
105 | addressButton = new QToolButton( widget, "addressButton" ); | 112 | addressButton = new QToolButton( widget, "addressButton" ); |
106 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); | 113 | addressButton->setPixmap( Resource::loadPixmap("AddressBook") ); |
107 | addressButton->setToggleButton(TRUE); | 114 | addressButton->setToggleButton(TRUE); |
108 | grid->addWidget( addressButton, 0, 2 ); | 115 | grid->addWidget( addressButton, 0, 2 ); |
109 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); | 116 | connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); |
110 | 117 | ||
@@ -136,34 +143,57 @@ void WriteMail::reject() | |||
136 | // need to insert date | 143 | // need to insert date |
137 | void WriteMail::accept() | 144 | void WriteMail::accept() |
138 | { | 145 | { |
139 | QStringList attatchedFiles, attatchmentsType; | 146 | QStringList attatchedFiles, attatchmentsType; |
140 | int idCount = 0; | 147 | int idCount = 0; |
141 | 148 | ||
142 | if (toInput->text() == "") { | 149 | if (toInput->text() == "") |
143 | QMessageBox::warning(this,"No recipient", "Send mail to whom?", "OK\n"); | 150 | { |
151 | QMessageBox::warning(this,tr("No recipient"), tr("Send mail to whom?"), tr("OK\n")); | ||
152 | return; | ||
153 | } | ||
154 | |||
155 | if (! getRecipients(false) ) | ||
156 | { | ||
157 | QMessageBox::warning(this,tr("Incorrect recipient separator"), | ||
158 | tr("Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n")); | ||
144 | return; | 159 | return; |
145 | } | 160 | } |
146 | if (! getRecipients() ) { | 161 | |
147 | QMessageBox::warning(this,"Incorrect recipient separator", | 162 | if ((ccInput->text()!="") && (! getRecipients(true) )) |
148 | "Recipients must be separated by ;\nand be valid emailaddresses", "OK\n"); | 163 | { |
164 | QMessageBox::warning(this,tr("Incorrect carbon copy separator"), | ||
165 | tr("CC Recipients must be separated by ;\nand be valid emailaddresses"), tr("OK\n")); | ||
149 | return; | 166 | return; |
150 | } | 167 | } |
168 | |||
151 | mail.subject = subjectInput->text(); | 169 | mail.subject = subjectInput->text(); |
152 | mail.body = emailInput->text(); | 170 | mail.body = emailInput->text(); |
153 | mail.sent = false; | 171 | mail.sent = false; |
154 | mail.received = false; | 172 | mail.received = false; |
173 | |||
155 | mail.rawMail = "To: "; | 174 | mail.rawMail = "To: "; |
156 | 175 | ||
157 | for (QStringList::Iterator it = mail.recipients.begin(); | 176 | for (QStringList::Iterator it = mail.recipients.begin(); |
158 | it != mail.recipients.end(); ++it) { | 177 | it != mail.recipients.end(); ++it) { |
159 | 178 | ||
160 | mail.rawMail += (*it); | 179 | mail.rawMail += (*it); |
161 | mail.rawMail += ",\n"; | 180 | mail.rawMail += ",\n"; |
162 | } | 181 | } |
182 | |||
163 | mail.rawMail.truncate(mail.rawMail.length()-2); | 183 | mail.rawMail.truncate(mail.rawMail.length()-2); |
184 | |||
185 | mail.rawMail += "\nCC: "; | ||
186 | |||
187 | for (QStringList::Iterator it = mail.carbonCopies.begin(); | ||
188 | it != mail.carbonCopies.end(); ++it) { | ||
189 | |||
190 | mail.rawMail += (*it); | ||
191 | mail.rawMail += ",\n"; | ||
192 | } | ||
193 | |||
164 | mail.rawMail += mail.from; | 194 | mail.rawMail += mail.from; |
165 | mail.rawMail += "\nSubject: "; | 195 | mail.rawMail += "\nSubject: "; |
166 | mail.rawMail += mail.subject; | 196 | mail.rawMail += mail.subject; |
167 | mail.rawMail += "\n\n"; | 197 | mail.rawMail += "\n\n"; |
168 | 198 | ||
169 | attatchedFiles = addAtt->returnAttatchedFiles(); | 199 | attatchedFiles = addAtt->returnAttatchedFiles(); |
@@ -208,84 +238,129 @@ void WriteMail::getAddress() | |||
208 | 238 | ||
209 | void WriteMail::attatchFile() | 239 | void WriteMail::attatchFile() |
210 | { | 240 | { |
211 | addAtt->showMaximized(); | 241 | addAtt->showMaximized(); |
212 | } | 242 | } |
213 | 243 | ||
214 | void WriteMail::reply(Email replyMail) | 244 | void WriteMail::reply(Email replyMail, bool replyAll) |
215 | { | 245 | { |
216 | int pos; | 246 | int pos; |
217 | 247 | ||
218 | mail = replyMail; | 248 | mail = replyMail; |
219 | mail.files.clear(); | 249 | mail.files.clear(); |
220 | 250 | ||
221 | toInput->setText(mail.fromMail); | 251 | toInput->setText(mail.fromMail); |
222 | subjectInput->setText("Re: " + mail.subject); | 252 | //replyAll ? ccInput->setText(mail.c) |
253 | |||
254 | addRecipients(replyAll); | ||
255 | |||
256 | subjectInput->setText(tr("Re: ") + mail.subject); | ||
223 | 257 | ||
224 | pos = 0; | 258 | pos = 0; |
225 | mail.body.insert(pos, ">>"); | 259 | mail.body.insert(pos, ">>"); |
226 | while (pos != -1) { | 260 | while (pos != -1) { |
227 | pos = mail.body.find('\n', pos); | 261 | pos = mail.body.find('\n', pos); |
228 | if (pos != -1) | 262 | if (pos != -1) |
229 | mail.body.insert(++pos, ">>"); | 263 | mail.body.insert(++pos, ">>"); |
230 | } | 264 | } |
231 | 265 | ||
232 | emailInput->setText(mail.body); | 266 | emailInput->setText(mail.body); |
233 | } | 267 | } |
234 | 268 | ||
235 | bool WriteMail::getRecipients() | 269 | void WriteMail::forward(Email forwMail) |
270 | { | ||
271 | int pos=0; | ||
272 | |||
273 | QString fwdBody=tr("======forwarded message from "); | ||
274 | fwdBody.append(forwMail.fromMail); | ||
275 | fwdBody.append(tr(" starts======\n\n")); | ||
276 | |||
277 | mail=forwMail; | ||
278 | toInput->setText(""); | ||
279 | ccInput->setText(""); | ||
280 | subjectInput->setText(tr("FWD: ") + mail.subject); | ||
281 | |||
282 | fwdBody+=mail.body; | ||
283 | fwdBody+=QString(tr("======end of forwarded message======\n\n")); | ||
284 | |||
285 | emailInput->setText(fwdBody); | ||
286 | } | ||
287 | |||
288 | bool WriteMail::getRecipients(bool ccField) | ||
236 | { | 289 | { |
237 | QString str, temp; | 290 | QString str, temp; |
238 | int pos = 0; | 291 | int pos = 0; |
239 | 292 | ||
240 | mail.recipients.clear(); | 293 | mail.recipients.clear(); |
241 | 294 | ||
242 | temp = toInput->text(); | 295 | ccField ? temp = ccInput->text() : temp=toInput->text() ; |
296 | |||
243 | while ( (pos = temp.find(';')) != -1) { | 297 | while ( (pos = temp.find(';')) != -1) { |
244 | str = temp.left(pos).stripWhiteSpace(); | 298 | str = temp.left(pos).stripWhiteSpace(); |
245 | temp = temp.right(temp.length() - (pos + 1)); | 299 | temp = temp.right(temp.length() - (pos + 1)); |
246 | if ( str.find('@') == -1) | 300 | if ( str.find('@') == -1) |
247 | return false; | 301 | return false; |
248 | mail.recipients.append(str); | 302 | ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); |
249 | addressList->addContact(str, ""); | 303 | addressList->addContact(str, ""); |
250 | } | 304 | } |
251 | temp = temp.stripWhiteSpace(); | 305 | temp = temp.stripWhiteSpace(); |
252 | if ( temp.find('@') == -1) | 306 | if ( temp.find('@') == -1) |
253 | return false; | 307 | return false; |
254 | mail.recipients.append(temp); | 308 | ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); |
255 | addressList->addContact(temp, ""); | 309 | addressList->addContact(temp, ""); |
256 | 310 | ||
257 | return TRUE; | 311 | return TRUE; |
258 | } | 312 | } |
259 | |||
260 | 313 | ||
261 | void WriteMail::addRecipients() | 314 | void WriteMail::addRecipients() |
262 | { | 315 | { |
316 | |||
317 | addRecipients(false); | ||
318 | } | ||
319 | |||
320 | void WriteMail::addRecipients(bool ccField) | ||
321 | { | ||
263 | QString recipients = ""; | 322 | QString recipients = ""; |
264 | 323 | ||
265 | mail.recipients.clear(); | 324 | mail.recipients.clear(); |
325 | |||
266 | QListViewItem *item = addressView->firstChild(); | 326 | QListViewItem *item = addressView->firstChild(); |
267 | while (item != NULL) { | 327 | while (item != NULL) { |
268 | if ( item->isSelected() ) { | 328 | if ( item->isSelected() ) { |
269 | if (recipients == "") { | 329 | if (recipients == "") { |
270 | recipients = item->text(0); | 330 | recipients = item->text(0); |
271 | } else { | 331 | } else { |
272 | recipients += "; " + item->text(0); | 332 | recipients += "; " + item->text(0); |
273 | } | 333 | } |
274 | } | 334 | } |
275 | item = item->nextSibling(); | 335 | item = item->nextSibling(); |
276 | } | 336 | } |
277 | toInput->setText(recipients); | 337 | |
338 | ccField ? ccInput->setText(recipients):toInput->setText(recipients); | ||
278 | 339 | ||
279 | addressView->hide(); | 340 | addressView->hide(); |
280 | okButton->hide(); | 341 | okButton->hide(); |
281 | emailInput->show(); | 342 | emailInput->show(); |
282 | addressButton->setOn(FALSE); | 343 | addressButton->setOn(FALSE); |
283 | showingAddressList = !showingAddressList; | 344 | showingAddressList = !showingAddressList; |
284 | } | 345 | } |
285 | 346 | ||
347 | void WriteMail::changeRecipients(int selection) | ||
348 | { | ||
349 | if (selection==0) | ||
350 | { | ||
351 | toInput->show(); | ||
352 | ccInput->hide(); | ||
353 | } | ||
354 | else if (selection==1) | ||
355 | { | ||
356 | toInput->hide(); | ||
357 | ccInput->show(); | ||
358 | } | ||
359 | } | ||
360 | |||
286 | void WriteMail::setRecipient(const QString &recipient) | 361 | void WriteMail::setRecipient(const QString &recipient) |
287 | { | 362 | { |
288 | toInput->setText(recipient); | 363 | toInput->setText(recipient); |
289 | } | 364 | } |
290 | 365 | ||
291 | void WriteMail::newMail() | 366 | void WriteMail::newMail() |
diff --git a/noncore/unsupported/mailit/writemail.h b/noncore/unsupported/mailit/writemail.h index dd12063..f193b13 100644 --- a/noncore/unsupported/mailit/writemail.h +++ b/noncore/unsupported/mailit/writemail.h | |||
@@ -40,31 +40,35 @@ class WriteMail : public QMainWindow | |||
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | WriteMail( QWidget* parent, const char* name, WFlags fl = 0 ); | 44 | WriteMail( QWidget* parent, const char* name, WFlags fl = 0 ); |
45 | ~WriteMail(); | 45 | ~WriteMail(); |
46 | void reply(Email replyMail); | 46 | void reply(Email replyMail, bool replyAll); |
47 | void setRecipient(const QString &recipient); | 47 | void setRecipient(const QString &recipient); |
48 | void setAddressList(AddressList *list); | 48 | void setAddressList(AddressList *list); |
49 | void forward(Email forwMail); | ||
49 | 50 | ||
50 | signals: | 51 | signals: |
51 | void sendMailRequested(const Email &mail); | 52 | void sendMailRequested(const Email &mail); |
52 | void cancelMail(); | 53 | void cancelMail(); |
54 | |||
53 | 55 | ||
54 | public slots: | 56 | public slots: |
55 | void getAddress(); | 57 | void getAddress(); |
56 | void attatchFile(); | 58 | void attatchFile(); |
57 | void addRecipients(); | 59 | void addRecipients(); |
58 | void newMail(); | 60 | void newMail(); |
59 | void accept(); | 61 | void accept(); |
60 | void reject(); | 62 | void reject(); |
63 | void changeRecipients(int); | ||
61 | 64 | ||
62 | private: | 65 | private: |
63 | bool getRecipients(); | 66 | bool getRecipients(bool); |
64 | void init(); | 67 | void init(); |
68 | void addRecipients(bool); | ||
65 | 69 | ||
66 | Email mail; | 70 | Email mail; |
67 | AddAtt *addAtt; | 71 | AddAtt *addAtt; |
68 | AddressList *addressList; | 72 | AddressList *addressList; |
69 | bool showingAddressList; | 73 | bool showingAddressList; |
70 | 74 | ||
@@ -80,12 +84,13 @@ private: | |||
80 | QAction *newButton; | 84 | QAction *newButton; |
81 | QLabel* subjetLabel; | 85 | QLabel* subjetLabel; |
82 | QToolButton* ToolButton13_2; | 86 | QToolButton* ToolButton13_2; |
83 | QComboBox* recipientsBox; | 87 | QComboBox* recipientsBox; |
84 | QLineEdit *subjectInput; | 88 | QLineEdit *subjectInput; |
85 | QLineEdit *toInput; | 89 | QLineEdit *toInput; |
90 | QLineEdit *ccInput; | ||
86 | QToolButton* addressButton; | 91 | QToolButton* addressButton; |
87 | QMultiLineEdit* emailInput; | 92 | QMultiLineEdit* emailInput; |
88 | QGridLayout* grid; | 93 | QGridLayout* grid; |
89 | }; | 94 | }; |
90 | 95 | ||
91 | #endif // WRITEMAIL_H | 96 | #endif // WRITEMAIL_H |