-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 152 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.h | 28 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 15 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.cpp | 40 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.h | 8 | ||||
-rw-r--r-- | noncore/net/mailit/readmail.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mailit/readmail.h | 5 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 101 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.h | 9 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 152 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 28 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 15 | ||||
-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 | 32 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 101 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.h | 9 |
18 files changed, 708 insertions, 72 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 0d82a9a..ad1e0b4 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -61,4 +61,8 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
@@ -145,6 +149,22 @@ void EmailClient::init() | |||
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 | ||
@@ -166,2 +186,6 @@ void EmailClient::init() | |||
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" ); |
@@ -197,2 +221,4 @@ void EmailClient::init() | |||
197 | setCentralWidget(mailboxView); | 221 | setCentralWidget(mailboxView); |
222 | |||
223 | mailboxView->setCurrentTab(0); | ||
198 | } | 224 | } |
@@ -234,2 +260,4 @@ void EmailClient::enqueMail(const Email &mail) | |||
234 | 260 | ||
261 | mailboxView->setCurrentTab(1); | ||
262 | |||
235 | } | 263 | } |
@@ -298,3 +326,3 @@ void EmailClient::getNewMail() { | |||
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; |
@@ -307,3 +335,3 @@ void EmailClient::getNewMail() { | |||
307 | item = (EmailListItem *) item->nextSibling(); | 335 | item = (EmailListItem *) item->nextSibling(); |
308 | } | 336 | }*/ |
309 | 337 | ||
@@ -417,2 +445,4 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
417 | 445 | ||
446 | mailboxView->setCurrentTab(0); | ||
447 | |||
418 | } | 448 | } |
@@ -446,2 +476,4 @@ void EmailClient::allMailArrived(int count) | |||
446 | emailHandler->getMailByList(&mailDownloadList); | 476 | emailHandler->getMailByList(&mailDownloadList); |
477 | |||
478 | mailboxView->setCurrentTab(0); | ||
447 | } | 479 | } |
@@ -511,2 +543,4 @@ void EmailClient::inboxItemSelected() | |||
511 | { | 543 | { |
544 | killTimer(timerID); | ||
545 | |||
512 | item = (EmailListItem*) inboxView->selectedItem(); | 546 | item = (EmailListItem*) inboxView->selectedItem(); |
@@ -519,2 +553,4 @@ void EmailClient::outboxItemSelected() | |||
519 | { | 553 | { |
554 | killTimer(timerID); | ||
555 | |||
520 | item = (EmailListItem*) outboxView->selectedItem(); | 556 | item = (EmailListItem*) outboxView->selectedItem(); |
@@ -694,2 +730,3 @@ void EmailClient::saveSettings() | |||
694 | { | 730 | { |
731 | |||
695 | QString temp; | 732 | QString temp; |
@@ -703,3 +740,3 @@ void EmailClient::saveSettings() | |||
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 | ||
@@ -826,3 +863,4 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
826 | 863 | ||
827 | if (inbox) { | 864 | if (inbox) |
865 | { | ||
828 | mPtr = mailItem->getMail(); | 866 | mPtr = mailItem->getMail(); |
@@ -846,3 +884,5 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
846 | inboxView->takeItem(mailItem); | 884 | inboxView->takeItem(mailItem); |
847 | } else { | 885 | } |
886 | else | ||
887 | { | ||
848 | outboxView->takeItem(mailItem); | 888 | outboxView->takeItem(mailItem); |
@@ -872 +912,93 @@ void EmailClient::setDownloadedSize(int size) | |||
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/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h index 80457f9..0890dcf 100644 --- a/noncore/net/mailit/emailclient.h +++ b/noncore/net/mailit/emailclient.h | |||
@@ -34,2 +34,3 @@ | |||
34 | #include <qtooltip.h> | 34 | #include <qtooltip.h> |
35 | #include <qtoolbutton.h> | ||
35 | #include <qimage.h> | 36 | #include <qimage.h> |
@@ -42,2 +43,3 @@ | |||
42 | #include <opie/otabwidget.h> | 43 | #include <opie/otabwidget.h> |
44 | #include <qtimer.h> | ||
43 | 45 | ||
@@ -71,2 +73,5 @@ public: | |||
71 | 73 | ||
74 | protected: | ||
75 | void timerEvent(QTimerEvent*); | ||
76 | |||
72 | signals: | 77 | signals: |
@@ -76,2 +81,9 @@ signals: | |||
76 | void newCaption(const QString &); | 81 | void newCaption(const QString &); |
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&);*/ | ||
77 | 89 | ||
@@ -84,2 +96,3 @@ public slots: | |||
84 | void mailSent(); | 96 | void mailSent(); |
97 | void deleteItem(); | ||
85 | void getNewMail(); | 98 | void getNewMail(); |
@@ -90,2 +103,4 @@ public slots: | |||
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); |
@@ -102,2 +117,6 @@ public slots: | |||
102 | void moveMailFront(Email *mailPtr); | 117 | void moveMailFront(Email *mailPtr); |
118 | /* void reply(); | ||
119 | void replyAll(); | ||
120 | void forward(); | ||
121 | void remove();*/ | ||
103 | 122 | ||
@@ -109,4 +128,4 @@ private: | |||
109 | void saveSettings(); | 128 | void saveSettings(); |
110 | 129 | Email* getCurrentMail(); | |
111 | private: | 130 | int timerID; |
112 | Config *mailconf; | 131 | Config *mailconf; |
@@ -130,3 +149,3 @@ private: | |||
130 | QLabel *status1Label, *status2Label; | 149 | QLabel *status1Label, *status2Label; |
131 | QAction *getMailButton; | 150 | QToolButton *getMailButton; |
132 | QAction *sendMailButton; | 151 | QAction *sendMailButton; |
@@ -134,2 +153,4 @@ private: | |||
134 | QAction *cancelButton; | 153 | QAction *cancelButton; |
154 | QAction *deleteButton; | ||
155 | //QToolButton *setAccountButton; | ||
135 | 156 | ||
@@ -139,2 +160,3 @@ private: | |||
139 | QPopupMenu *deleteAccountMenu; | 160 | QPopupMenu *deleteAccountMenu; |
161 | QPopupMenu *setAccountMenu; | ||
140 | 162 | ||
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index 03f8a28..f6c6d60 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -202,3 +202,3 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
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 | { |
@@ -208,2 +208,8 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
208 | 208 | ||
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 | } | ||
209 | 215 | ||
@@ -436,2 +442,9 @@ int EmailHandler::encodeMime(Email *mail) | |||
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"; |
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp index 2bf1dcb..ef5fc09 100644 --- a/noncore/net/mailit/mailitwindow.cpp +++ b/noncore/net/mailit/mailitwindow.cpp | |||
@@ -49,4 +49,7 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
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, |
@@ -85,8 +88,15 @@ void MailItWindow::compose() | |||
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() |
@@ -133 +143,23 @@ void MailItWindow::setDocument(const QString &_address) | |||
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/net/mailit/mailitwindow.h b/noncore/net/mailit/mailitwindow.h index 667960b..e818d32 100644 --- a/noncore/net/mailit/mailitwindow.h +++ b/noncore/net/mailit/mailitwindow.h | |||
@@ -38,5 +38,7 @@ public: | |||
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(); |
@@ -47,2 +49,6 @@ public slots: | |||
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 | ||
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp index 7cd3e09..dc98a6f 100644 --- a/noncore/net/mailit/readmail.cpp +++ b/noncore/net/mailit/readmail.cpp | |||
@@ -62,2 +62,6 @@ void ReadMail::init() | |||
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 ); |
@@ -109,2 +113,4 @@ void ReadMail::updateView() | |||
109 | replyButton->removeFrom(bar); | 113 | replyButton->removeFrom(bar); |
114 | forwardButton->removeFrom(mailMenu); | ||
115 | forwardButton->removeFrom(bar); | ||
110 | 116 | ||
@@ -113,2 +119,5 @@ void ReadMail::updateView() | |||
113 | replyButton->addTo(mailMenu); | 119 | replyButton->addTo(mailMenu); |
120 | forwardButton->addTo(bar); | ||
121 | forwardButton->addTo(mailMenu); | ||
122 | |||
114 | 123 | ||
@@ -147,2 +156,9 @@ void ReadMail::updateView() | |||
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; |
@@ -204,2 +220,10 @@ void ReadMail::updateView() | |||
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"; |
@@ -325,3 +349,9 @@ 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/net/mailit/readmail.h b/noncore/net/mailit/readmail.h index d0bb067..0fe0646 100644 --- a/noncore/net/mailit/readmail.h +++ b/noncore/net/mailit/readmail.h | |||
@@ -48,3 +48,4 @@ 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 &); |
@@ -60,2 +61,3 @@ public slots: | |||
60 | void reply(); | 61 | void reply(); |
62 | void forward(); | ||
61 | 63 | ||
@@ -83,2 +85,3 @@ private: | |||
83 | QAction *replyButton; | 85 | QAction *replyButton; |
86 | QAction *forwardButton; | ||
84 | }; | 87 | }; |
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index 38a2596..a9dcb02 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -88,2 +88,4 @@ void WriteMail::init() | |||
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 | ||
@@ -104,2 +106,7 @@ void WriteMail::init() | |||
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" ); |
@@ -141,11 +148,22 @@ void WriteMail::accept() | |||
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(); |
@@ -154,2 +172,3 @@ void WriteMail::accept() | |||
154 | mail.received = false; | 172 | mail.received = false; |
173 | |||
155 | mail.rawMail = "To: "; | 174 | mail.rawMail = "To: "; |
@@ -162,3 +181,14 @@ void WriteMail::accept() | |||
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; |
@@ -213,3 +243,3 @@ void WriteMail::attatchFile() | |||
213 | 243 | ||
214 | void WriteMail::reply(Email replyMail) | 244 | void WriteMail::reply(Email replyMail, bool replyAll) |
215 | { | 245 | { |
@@ -221,3 +251,7 @@ void WriteMail::reply(Email replyMail) | |||
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 | ||
@@ -234,3 +268,22 @@ void WriteMail::reply(Email replyMail) | |||
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 | { |
@@ -241,3 +294,4 @@ bool WriteMail::getRecipients() | |||
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) { |
@@ -247,3 +301,3 @@ bool WriteMail::getRecipients() | |||
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, ""); |
@@ -253,3 +307,3 @@ bool WriteMail::getRecipients() | |||
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, ""); |
@@ -259,5 +313,10 @@ bool WriteMail::getRecipients() | |||
259 | 313 | ||
260 | |||
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 = ""; |
@@ -265,2 +324,3 @@ void WriteMail::addRecipients() | |||
265 | mail.recipients.clear(); | 324 | mail.recipients.clear(); |
325 | |||
266 | QListViewItem *item = addressView->firstChild(); | 326 | QListViewItem *item = addressView->firstChild(); |
@@ -276,3 +336,4 @@ void WriteMail::addRecipients() | |||
276 | } | 336 | } |
277 | toInput->setText(recipients); | 337 | |
338 | ccField ? ccInput->setText(recipients):toInput->setText(recipients); | ||
278 | 339 | ||
@@ -285,2 +346,16 @@ void WriteMail::addRecipients() | |||
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) |
diff --git a/noncore/net/mailit/writemail.h b/noncore/net/mailit/writemail.h index dd12063..f193b13 100644 --- a/noncore/net/mailit/writemail.h +++ b/noncore/net/mailit/writemail.h | |||
@@ -45,5 +45,6 @@ public: | |||
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 | ||
@@ -53,2 +54,3 @@ signals: | |||
53 | 54 | ||
55 | |||
54 | public slots: | 56 | public slots: |
@@ -60,6 +62,8 @@ public slots: | |||
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 | ||
@@ -85,2 +89,3 @@ private: | |||
85 | QLineEdit *toInput; | 89 | QLineEdit *toInput; |
90 | QLineEdit *ccInput; | ||
86 | QToolButton* addressButton; | 91 | QToolButton* addressButton; |
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 | |||
@@ -61,4 +61,8 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
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 | ||
@@ -145,6 +149,22 @@ void EmailClient::init() | |||
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 | ||
@@ -166,2 +186,6 @@ void EmailClient::init() | |||
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" ); |
@@ -197,2 +221,4 @@ void EmailClient::init() | |||
197 | setCentralWidget(mailboxView); | 221 | setCentralWidget(mailboxView); |
222 | |||
223 | mailboxView->setCurrentTab(0); | ||
198 | } | 224 | } |
@@ -234,2 +260,4 @@ void EmailClient::enqueMail(const Email &mail) | |||
234 | 260 | ||
261 | mailboxView->setCurrentTab(1); | ||
262 | |||
235 | } | 263 | } |
@@ -298,3 +326,3 @@ void EmailClient::getNewMail() { | |||
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; |
@@ -307,3 +335,3 @@ void EmailClient::getNewMail() { | |||
307 | item = (EmailListItem *) item->nextSibling(); | 335 | item = (EmailListItem *) item->nextSibling(); |
308 | } | 336 | }*/ |
309 | 337 | ||
@@ -417,2 +445,4 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
417 | 445 | ||
446 | mailboxView->setCurrentTab(0); | ||
447 | |||
418 | } | 448 | } |
@@ -446,2 +476,4 @@ void EmailClient::allMailArrived(int count) | |||
446 | emailHandler->getMailByList(&mailDownloadList); | 476 | emailHandler->getMailByList(&mailDownloadList); |
477 | |||
478 | mailboxView->setCurrentTab(0); | ||
447 | } | 479 | } |
@@ -511,2 +543,4 @@ void EmailClient::inboxItemSelected() | |||
511 | { | 543 | { |
544 | killTimer(timerID); | ||
545 | |||
512 | item = (EmailListItem*) inboxView->selectedItem(); | 546 | item = (EmailListItem*) inboxView->selectedItem(); |
@@ -519,2 +553,4 @@ void EmailClient::outboxItemSelected() | |||
519 | { | 553 | { |
554 | killTimer(timerID); | ||
555 | |||
520 | item = (EmailListItem*) outboxView->selectedItem(); | 556 | item = (EmailListItem*) outboxView->selectedItem(); |
@@ -694,2 +730,3 @@ void EmailClient::saveSettings() | |||
694 | { | 730 | { |
731 | |||
695 | QString temp; | 732 | QString temp; |
@@ -703,3 +740,3 @@ void EmailClient::saveSettings() | |||
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 | ||
@@ -826,3 +863,4 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
826 | 863 | ||
827 | if (inbox) { | 864 | if (inbox) |
865 | { | ||
828 | mPtr = mailItem->getMail(); | 866 | mPtr = mailItem->getMail(); |
@@ -846,3 +884,5 @@ void EmailClient::deleteMail(EmailListItem *mailItem, bool &inbox) | |||
846 | inboxView->takeItem(mailItem); | 884 | inboxView->takeItem(mailItem); |
847 | } else { | 885 | } |
886 | else | ||
887 | { | ||
848 | outboxView->takeItem(mailItem); | 888 | outboxView->takeItem(mailItem); |
@@ -872 +912,93 @@ void EmailClient::setDownloadedSize(int size) | |||
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 | |||
@@ -34,2 +34,3 @@ | |||
34 | #include <qtooltip.h> | 34 | #include <qtooltip.h> |
35 | #include <qtoolbutton.h> | ||
35 | #include <qimage.h> | 36 | #include <qimage.h> |
@@ -42,2 +43,3 @@ | |||
42 | #include <opie/otabwidget.h> | 43 | #include <opie/otabwidget.h> |
44 | #include <qtimer.h> | ||
43 | 45 | ||
@@ -71,2 +73,5 @@ public: | |||
71 | 73 | ||
74 | protected: | ||
75 | void timerEvent(QTimerEvent*); | ||
76 | |||
72 | signals: | 77 | signals: |
@@ -76,2 +81,9 @@ signals: | |||
76 | void newCaption(const QString &); | 81 | void newCaption(const QString &); |
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&);*/ | ||
77 | 89 | ||
@@ -84,2 +96,3 @@ public slots: | |||
84 | void mailSent(); | 96 | void mailSent(); |
97 | void deleteItem(); | ||
85 | void getNewMail(); | 98 | void getNewMail(); |
@@ -90,2 +103,4 @@ public slots: | |||
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); |
@@ -102,2 +117,6 @@ public slots: | |||
102 | void moveMailFront(Email *mailPtr); | 117 | void moveMailFront(Email *mailPtr); |
118 | /* void reply(); | ||
119 | void replyAll(); | ||
120 | void forward(); | ||
121 | void remove();*/ | ||
103 | 122 | ||
@@ -109,4 +128,4 @@ private: | |||
109 | void saveSettings(); | 128 | void saveSettings(); |
110 | 129 | Email* getCurrentMail(); | |
111 | private: | 130 | int timerID; |
112 | Config *mailconf; | 131 | Config *mailconf; |
@@ -130,3 +149,3 @@ private: | |||
130 | QLabel *status1Label, *status2Label; | 149 | QLabel *status1Label, *status2Label; |
131 | QAction *getMailButton; | 150 | QToolButton *getMailButton; |
132 | QAction *sendMailButton; | 151 | QAction *sendMailButton; |
@@ -134,2 +153,4 @@ private: | |||
134 | QAction *cancelButton; | 153 | QAction *cancelButton; |
154 | QAction *deleteButton; | ||
155 | //QToolButton *setAccountButton; | ||
135 | 156 | ||
@@ -139,2 +160,3 @@ private: | |||
139 | QPopupMenu *deleteAccountMenu; | 160 | QPopupMenu *deleteAccountMenu; |
161 | QPopupMenu *setAccountMenu; | ||
140 | 162 | ||
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 | |||
@@ -202,3 +202,3 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
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 | { |
@@ -208,2 +208,8 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
208 | 208 | ||
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 | } | ||
209 | 215 | ||
@@ -436,2 +442,9 @@ int EmailHandler::encodeMime(Email *mail) | |||
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"; |
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 | |||
@@ -49,4 +49,7 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
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, |
@@ -85,8 +88,15 @@ void MailItWindow::compose() | |||
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() |
@@ -133 +143,23 @@ void MailItWindow::setDocument(const QString &_address) | |||
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 | |||
@@ -38,5 +38,7 @@ public: | |||
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(); |
@@ -47,2 +49,6 @@ public slots: | |||
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 | ||
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 | |||
@@ -62,2 +62,6 @@ void ReadMail::init() | |||
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 ); |
@@ -109,2 +113,4 @@ void ReadMail::updateView() | |||
109 | replyButton->removeFrom(bar); | 113 | replyButton->removeFrom(bar); |
114 | forwardButton->removeFrom(mailMenu); | ||
115 | forwardButton->removeFrom(bar); | ||
110 | 116 | ||
@@ -113,2 +119,5 @@ void ReadMail::updateView() | |||
113 | replyButton->addTo(mailMenu); | 119 | replyButton->addTo(mailMenu); |
120 | forwardButton->addTo(bar); | ||
121 | forwardButton->addTo(mailMenu); | ||
122 | |||
114 | 123 | ||
@@ -147,2 +156,9 @@ void ReadMail::updateView() | |||
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; |
@@ -204,2 +220,10 @@ void ReadMail::updateView() | |||
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"; |
@@ -325,3 +349,9 @@ 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 | |||
@@ -48,3 +48,4 @@ 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 &); |
@@ -60,2 +61,3 @@ public slots: | |||
60 | void reply(); | 61 | void reply(); |
62 | void forward(); | ||
61 | 63 | ||
@@ -83,2 +85,3 @@ private: | |||
83 | QAction *replyButton; | 85 | QAction *replyButton; |
86 | QAction *forwardButton; | ||
84 | }; | 87 | }; |
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 | |||
@@ -88,2 +88,4 @@ void WriteMail::init() | |||
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 | ||
@@ -104,2 +106,7 @@ void WriteMail::init() | |||
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" ); |
@@ -141,11 +148,22 @@ void WriteMail::accept() | |||
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(); |
@@ -154,2 +172,3 @@ void WriteMail::accept() | |||
154 | mail.received = false; | 172 | mail.received = false; |
173 | |||
155 | mail.rawMail = "To: "; | 174 | mail.rawMail = "To: "; |
@@ -162,3 +181,14 @@ void WriteMail::accept() | |||
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; |
@@ -213,3 +243,3 @@ void WriteMail::attatchFile() | |||
213 | 243 | ||
214 | void WriteMail::reply(Email replyMail) | 244 | void WriteMail::reply(Email replyMail, bool replyAll) |
215 | { | 245 | { |
@@ -221,3 +251,7 @@ void WriteMail::reply(Email replyMail) | |||
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 | ||
@@ -234,3 +268,22 @@ void WriteMail::reply(Email replyMail) | |||
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 | { |
@@ -241,3 +294,4 @@ bool WriteMail::getRecipients() | |||
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) { |
@@ -247,3 +301,3 @@ bool WriteMail::getRecipients() | |||
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, ""); |
@@ -253,3 +307,3 @@ bool WriteMail::getRecipients() | |||
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, ""); |
@@ -259,5 +313,10 @@ bool WriteMail::getRecipients() | |||
259 | 313 | ||
260 | |||
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 = ""; |
@@ -265,2 +324,3 @@ void WriteMail::addRecipients() | |||
265 | mail.recipients.clear(); | 324 | mail.recipients.clear(); |
325 | |||
266 | QListViewItem *item = addressView->firstChild(); | 326 | QListViewItem *item = addressView->firstChild(); |
@@ -276,3 +336,4 @@ void WriteMail::addRecipients() | |||
276 | } | 336 | } |
277 | toInput->setText(recipients); | 337 | |
338 | ccField ? ccInput->setText(recipients):toInput->setText(recipients); | ||
278 | 339 | ||
@@ -285,2 +346,16 @@ void WriteMail::addRecipients() | |||
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) |
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 | |||
@@ -45,5 +45,6 @@ public: | |||
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 | ||
@@ -53,2 +54,3 @@ signals: | |||
53 | 54 | ||
55 | |||
54 | public slots: | 56 | public slots: |
@@ -60,6 +62,8 @@ public slots: | |||
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 | ||
@@ -85,2 +89,3 @@ private: | |||
85 | QLineEdit *toInput; | 89 | QLineEdit *toInput; |
90 | QLineEdit *ccInput; | ||
86 | QToolButton* addressButton; | 91 | QToolButton* addressButton; |