author | groucho <groucho> | 2003-04-29 08:04:34 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-29 08:04:34 (UTC) |
commit | f09f685be0540e98cc33bc4f664a812aed756926 (patch) (unidiff) | |
tree | 10a2193eafd1dc0ae25cd458f3bfa9f0f23522e1 | |
parent | e096c9d1f2be1ec74ede583fc4221871a56ef508 (diff) | |
download | opie-f09f685be0540e98cc33bc4f664a812aed756926.zip opie-f09f685be0540e98cc33bc4f664a812aed756926.tar.gz opie-f09f685be0540e98cc33bc4f664a812aed756926.tar.bz2 |
- added ReplyAll for CC: addressing
- added a download button in mail view
- smaller layout fixes
- now it's getting to be real useful
-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 140 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.h | 11 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/net/mailit/popclient.cpp | 14 | ||||
-rw-r--r-- | noncore/net/mailit/readmail.cpp | 64 | ||||
-rw-r--r-- | noncore/net/mailit/readmail.h | 8 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 35 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 140 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 11 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/mailit/popclient.cpp | 14 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.cpp | 64 | ||||
-rw-r--r-- | noncore/unsupported/mailit/readmail.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 35 |
18 files changed, 412 insertions, 148 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index dff1888..2cedc51 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -18,15 +18,17 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qvbox.h> | ||
22 | #include <qfile.h> | 23 | #include <qfile.h> |
23 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
24 | #include <qmenubar.h> | 25 | #include <qmenubar.h> |
25 | #include <qaction.h> | 26 | #include <qaction.h> |
26 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
27 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
28 | #include "emailclient.h" | 29 | #include "emailclient.h" |
30 | #include "writemail.h" | ||
29 | 31 | ||
30 | QCollection::Item AccountList::newItem(QCollection::Item d) | 32 | QCollection::Item AccountList::newItem(QCollection::Item d) |
31 | { | 33 | { |
32 | return dupl( (MailAccount *) d); | 34 | return dupl( (MailAccount *) d); |
@@ -39,9 +41,9 @@ MailAccount* AccountList::dupl(MailAccount *in) | |||
39 | } | 41 | } |
40 | 42 | ||
41 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | 43 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) |
42 | : QMainWindow( parent, name, fl ) | 44 | : QMainWindow( parent, name, fl ) |
43 | { | 45 | { |
44 | emailHandler = new EmailHandler(); | 46 | emailHandler = new EmailHandler(); |
45 | addressList = new AddressList(); | 47 | addressList = new AddressList(); |
46 | 48 | ||
47 | sending = FALSE; | 49 | sending = FALSE; |
@@ -52,8 +54,10 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
52 | allAccounts = FALSE; | 54 | allAccounts = FALSE; |
53 | 55 | ||
54 | init(); | 56 | init(); |
55 | 57 | ||
58 | |||
59 | |||
56 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); | 60 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); |
57 | 61 | ||
58 | connect(emailHandler, SIGNAL(smtpError(int)), this, | 62 | connect(emailHandler, SIGNAL(smtpError(int)), this, |
59 | SLOT(smtpError(int)) ); | 63 | SLOT(smtpError(int)) ); |
@@ -64,10 +68,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
64 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 68 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
65 | 69 | ||
66 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); | 70 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); |
67 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); | 71 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); |
68 | 72 | ||
69 | |||
70 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 73 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, |
71 | SLOT(mailArrived(const Email &, bool)) ); | 74 | SLOT(mailArrived(const Email &, bool)) ); |
72 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, | 75 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, |
73 | SLOT(allMailArrived(int)) ); | 76 | SLOT(allMailArrived(int)) ); |
@@ -83,8 +86,13 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
83 | readMail(); | 86 | readMail(); |
84 | lineShift = "\r\n"; | 87 | lineShift = "\r\n"; |
85 | 88 | ||
86 | mailboxView->setCurrentTab(0); //ensure that inbox has focus | 89 | mailboxView->setCurrentTab(0); //ensure that inbox has focus |
90 | |||
91 | /*channel = new QCopChannel( "QPE/Application/mailit", this ); | ||
92 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
93 | this, SLOT(receive(const QCString&, const QByteArray&)) );*/ | ||
94 | |||
87 | } | 95 | } |
88 | 96 | ||
89 | 97 | ||
90 | EmailClient::~EmailClient() | 98 | EmailClient::~EmailClient() |
@@ -103,31 +111,10 @@ EmailClient::~EmailClient() | |||
103 | } | 111 | } |
104 | 112 | ||
105 | void EmailClient::init() | 113 | void EmailClient::init() |
106 | { | 114 | { |
107 | statusBar = new QStatusBar(this); | 115 | initStatusBar(this); |
108 | statusBar->setSizeGripEnabled(FALSE); | 116 | |
109 | |||
110 | status1Label = new QLabel( tr("Idle"), statusBar); | ||
111 | status2Label = new QLabel("", statusBar); | ||
112 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | ||
113 | status2Label, SLOT(setText(const QString &)) ); | ||
114 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | ||
115 | status2Label, SLOT(setText(const QString &)) ); | ||
116 | |||
117 | progressBar = new QProgressBar(statusBar); | ||
118 | |||
119 | connect(emailHandler, SIGNAL(mailboxSize(int)), | ||
120 | this, SLOT(setTotalSize(int)) ); | ||
121 | connect(emailHandler, SIGNAL(currentMailSize(int)), | ||
122 | this, SLOT(setMailSize(int)) ); | ||
123 | connect(emailHandler, SIGNAL(downloadedSize(int)), | ||
124 | this, SLOT(setDownloadedSize(int)) ); | ||
125 | |||
126 | statusBar->addWidget(status1Label); | ||
127 | statusBar->addWidget(progressBar); | ||
128 | statusBar->addWidget(status2Label); | ||
129 | |||
130 | setToolBarsMovable(FALSE); | 117 | setToolBarsMovable(FALSE); |
131 | 118 | ||
132 | bar = new QToolBar(this); | 119 | bar = new QToolBar(this); |
133 | QWhatsThis::add(bar,tr("Main operation toolbar")); | 120 | QWhatsThis::add(bar,tr("Main operation toolbar")); |
@@ -193,10 +180,13 @@ void EmailClient::init() | |||
193 | inboxView->addColumn( tr( "Subject" ) ); | 180 | inboxView->addColumn( tr( "Subject" ) ); |
194 | inboxView->addColumn( tr( "Date" ) ); | 181 | inboxView->addColumn( tr( "Date" ) ); |
195 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 182 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
196 | inboxView->setAllColumnsShowFocus(TRUE); | 183 | inboxView->setAllColumnsShowFocus(TRUE); |
197 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n It keeps the fetched mail which can be viewed by double clicking the entry.\n" | 184 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" |
198 | " A blue attachment icon shows whether this mail has attachments.")); | 185 | "It keeps the fetched mail which can be \n" |
186 | "viewed by double clicking the entry.\n" | ||
187 | "blue attachment icon shows whether this \n" | ||
188 | "mailhas attachments.\n")); | ||
199 | 189 | ||
200 | grid_2->addWidget( inboxView, 2, 0 ); | 190 | grid_2->addWidget( inboxView, 2, 0 ); |
201 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); | 191 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
202 | 192 | ||
@@ -209,16 +199,45 @@ void EmailClient::init() | |||
209 | outboxView->addColumn( tr( "To" ) ); | 199 | outboxView->addColumn( tr( "To" ) ); |
210 | outboxView->addColumn( tr( "Subject" ) ); | 200 | outboxView->addColumn( tr( "Subject" ) ); |
211 | outboxView->setAllColumnsShowFocus(TRUE); | 201 | outboxView->setAllColumnsShowFocus(TRUE); |
212 | 202 | ||
213 | QWhatsThis::add(outboxView,QWidget::tr("This is the oubox view.\n It keeps the queued mails to send which can be reviewed by double clicking the entry.")); | 203 | QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" |
204 | "It keeps the queued mails to send which can be \n" | ||
205 | "reviewed by double clicking the entry.")); | ||
214 | grid_3->addWidget( outboxView, 0, 0 ); | 206 | grid_3->addWidget( outboxView, 0, 0 ); |
215 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 207 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
216 | 208 | ||
217 | setCentralWidget(mailboxView); | 209 | setCentralWidget(mailboxView); |
218 | 210 | ||
219 | } | 211 | } |
220 | 212 | ||
213 | void EmailClient::initStatusBar(QWidget* parent) | ||
214 | { | ||
215 | statusBar = new QStatusBar(parent); | ||
216 | statusBar->setSizeGripEnabled(FALSE); | ||
217 | |||
218 | status1Label = new QLabel( tr("Idle"), statusBar); | ||
219 | status2Label = new QLabel("", statusBar); | ||
220 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | ||
221 | status2Label, SLOT(setText(const QString &)) ); | ||
222 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | ||
223 | status2Label, SLOT(setText(const QString &)) ); | ||
224 | |||
225 | progressBar = new QProgressBar(statusBar); | ||
226 | |||
227 | connect(emailHandler, SIGNAL(mailboxSize(int)), | ||
228 | this, SLOT(setTotalSize(int)) ); | ||
229 | connect(emailHandler, SIGNAL(currentMailSize(int)), | ||
230 | this, SLOT(setMailSize(int)) ); | ||
231 | connect(emailHandler, SIGNAL(downloadedSize(int)), | ||
232 | this, SLOT(setDownloadedSize(int)) ); | ||
233 | |||
234 | statusBar->addWidget(status1Label); | ||
235 | statusBar->addWidget(progressBar); | ||
236 | statusBar->addWidget(status2Label); | ||
237 | |||
238 | } | ||
239 | |||
221 | void EmailClient::compose() | 240 | void EmailClient::compose() |
222 | { | 241 | { |
223 | emit composeRequested(); | 242 | emit composeRequested(); |
224 | } | 243 | } |
@@ -318,18 +337,18 @@ void EmailClient::getNewMail() { | |||
318 | status1Label->setText(currentAccount->accountName + " headers"); | 337 | status1Label->setText(currentAccount->accountName + " headers"); |
319 | progressBar->reset(); | 338 | progressBar->reset(); |
320 | 339 | ||
321 | //get any previous mails not downloaded and add to queue | 340 | //get any previous mails not downloaded and add to queue |
322 | mailDownloadList.clear(); | 341 | /*mailDownloadList.clear(); |
323 | Email *mailPtr; | 342 | Email *mailPtr; |
324 | item = (EmailListItem *) inboxView->firstChild(); | 343 | item = (EmailListItem *) inboxView->firstChild(); |
325 | while (item != NULL) { | 344 | while (item != NULL) { |
326 | mailPtr = item->getMail(); | 345 | mailPtr = item->getMail(); |
327 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 346 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
328 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 347 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
329 | } | 348 | } |
330 | item = (EmailListItem *) item->nextSibling(); | 349 | item = (EmailListItem *) item->nextSibling(); |
331 | } | 350 | }*/ |
332 | 351 | ||
333 | emailHandler->getMailHeaders(); | 352 | emailHandler->getMailHeaders(); |
334 | 353 | ||
335 | } | 354 | } |
@@ -337,9 +356,9 @@ void EmailClient::getNewMail() { | |||
337 | void EmailClient::getAllNewMail() | 356 | void EmailClient::getAllNewMail() |
338 | { | 357 | { |
339 | allAccounts = TRUE; | 358 | allAccounts = TRUE; |
340 | currentAccount = accountList.first(); | 359 | currentAccount = accountList.first(); |
341 | getNewMail(); | 360 | getNewMail(); |
342 | } | 361 | } |
343 | 362 | ||
344 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 363 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
345 | { | 364 | { |
@@ -347,18 +366,20 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
347 | Email newMail; | 366 | Email newMail; |
348 | int thisMailId; | 367 | int thisMailId; |
349 | emailHandler->parse(mail.rawMail, lineShift, &newMail); | 368 | emailHandler->parse(mail.rawMail, lineShift, &newMail); |
350 | mailconf->setGroup(newMail.id); | 369 | mailconf->setGroup(newMail.id); |
351 | 370 | ||
352 | if (fromDisk) | 371 | if (fromDisk) |
353 | { | 372 | { |
373 | |||
354 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 374 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
355 | newMail.size = mailconf->readNumEntry("size"); | 375 | newMail.size = mailconf->readNumEntry("size"); |
356 | newMail.serverId = mailconf->readNumEntry("serverid"); | 376 | newMail.serverId = mailconf->readNumEntry("serverid"); |
357 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 377 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
358 | } | 378 | } |
359 | else | 379 | else |
360 | { //mail arrived from server | 380 | { //mail arrived from server |
381 | |||
361 | newMail.serverId = mail.serverId; | 382 | newMail.serverId = mail.serverId; |
362 | newMail.size = mail.size; | 383 | newMail.size = mail.size; |
363 | newMail.downloaded = mail.downloaded; | 384 | newMail.downloaded = mail.downloaded; |
364 | 385 | ||
@@ -917,9 +938,9 @@ void EmailClient::inboxItemReleased() | |||
917 | { | 938 | { |
918 | //killTimer(timerID); | 939 | //killTimer(timerID); |
919 | } | 940 | } |
920 | 941 | ||
921 | void EmailClient::timerEvent(QTimerEvent *e) | 942 | /*void EmailClient::timerEvent(QTimerEvent *e) |
922 | { | 943 | { |
923 | /*killTimer(timerID); | 944 | /*killTimer(timerID); |
924 | 945 | ||
925 | 946 | ||
@@ -934,10 +955,10 @@ void EmailClient::timerEvent(QTimerEvent *e) | |||
934 | 955 | ||
935 | action->exec(QCursor::pos()); | 956 | action->exec(QCursor::pos()); |
936 | 957 | ||
937 | if (action) delete action; | 958 | if (action) delete action; |
938 | */ | 959 | |
939 | } | 960 | }*/ |
940 | 961 | ||
941 | Email* EmailClient::getCurrentMail() | 962 | Email* EmailClient::getCurrentMail() |
942 | { | 963 | { |
943 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); | 964 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); |
@@ -952,10 +973,8 @@ void EmailClient::download(Email* mail) | |||
952 | MailAccount* acc=0; | 973 | MailAccount* acc=0; |
953 | 974 | ||
954 | tempMailDownloadList.clear(); | 975 | tempMailDownloadList.clear(); |
955 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); | 976 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
956 | if (accountList.count()>0) | ||
957 | qDebug("Accounts present"); | ||
958 | 977 | ||
959 | acc=accountList.at(mail->fromAccountId-1); | 978 | acc=accountList.at(mail->fromAccountId-1); |
960 | if (acc) | 979 | if (acc) |
961 | { | 980 | { |
@@ -965,4 +984,49 @@ void EmailClient::download(Email* mail) | |||
965 | else | 984 | else |
966 | QMessageBox::warning(qApp->activeWindow(), | 985 | QMessageBox::warning(qApp->activeWindow(), |
967 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); | 986 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); |
968 | } | 987 | } |
988 | |||
989 | void EmailClient::receive(const QCString& msg, const QByteArray& data) | ||
990 | { | ||
991 | /*if (msg=="getMail()") | ||
992 | { | ||
993 | /*QDialog qd(qApp->activeWindow(),"Getting mail",true); | ||
994 | QVBoxLayout *vbProg = new QVBoxLayout( &qd ); | ||
995 | |||
996 | initStatusBar(&qd); | ||
997 | |||
998 | if (statusBar==0) | ||
999 | { | ||
1000 | qDebug("No Bar ..."); | ||
1001 | //statusBar=new ProgressBar(&qd); | ||
1002 | } | ||
1003 | statusBar->show(); | ||
1004 | vbProg->addWidget(statusBar); | ||
1005 | qd.showMaximized(); | ||
1006 | qd.show(); | ||
1007 | emit getAllNewMail(); | ||
1008 | //qd.exec(); | ||
1009 | } | ||
1010 | else if (msg=="compose()") | ||
1011 | { | ||
1012 | QDialog qd(qApp->activeWindow(),"Getting mail",true); | ||
1013 | |||
1014 | WriteMail wm(&qd,"write new mail"); | ||
1015 | QVBoxLayout vbProg( &qd ); | ||
1016 | |||
1017 | wm.showMaximized(); | ||
1018 | vbProg.addWidget(&wm); | ||
1019 | |||
1020 | qd.showMaximized(); | ||
1021 | |||
1022 | emit composeRequested(); | ||
1023 | qd.exec(); | ||
1024 | |||
1025 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | ||
1026 | } | ||
1027 | |||
1028 | else if (msg=="dialog()") | ||
1029 | { | ||
1030 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | ||
1031 | }*/ | ||
1032 | } | ||
diff --git a/noncore/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h index 549683b..994fec5 100644 --- a/noncore/net/mailit/emailclient.h +++ b/noncore/net/mailit/emailclient.h | |||
@@ -40,8 +40,9 @@ | |||
40 | #include <qstatusbar.h> | 40 | #include <qstatusbar.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <stdlib.h> | 42 | #include <stdlib.h> |
43 | #include <opie/otabwidget.h> | 43 | #include <opie/otabwidget.h> |
44 | #include <qpe/qcopenvelope_qws.h> | ||
44 | #include <qtimer.h> | 45 | #include <qtimer.h> |
45 | 46 | ||
46 | #include "emailhandler.h" | 47 | #include "emailhandler.h" |
47 | #include "emaillistitem.h" | 48 | #include "emaillistitem.h" |
@@ -69,12 +70,11 @@ class EmailClient : public QMainWindow | |||
69 | public: | 70 | public: |
70 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); | 71 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); |
71 | ~EmailClient(); | 72 | ~EmailClient(); |
72 | AddressList* getAdrListRef(); | 73 | AddressList* getAdrListRef(); |
73 | void download(Email*); | ||
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | void timerEvent(QTimerEvent*); | 76 | //void timerEvent(QTimerEvent*); |
77 | 77 | ||
78 | signals: | 78 | signals: |
79 | void composeRequested(); | 79 | void composeRequested(); |
80 | void viewEmail(QListView *, Email *); | 80 | void viewEmail(QListView *, Email *); |
@@ -115,15 +115,20 @@ public slots: | |||
115 | void setTotalSize(int); | 115 | void setTotalSize(int); |
116 | void setMailSize(int); | 116 | void setMailSize(int); |
117 | void setDownloadedSize(int); | 117 | void setDownloadedSize(int); |
118 | void moveMailFront(Email *mailPtr); | 118 | void moveMailFront(Email *mailPtr); |
119 | void download(Email*); | ||
119 | /* void reply(); | 120 | /* void reply(); |
120 | void replyAll(); | 121 | void replyAll(); |
121 | void forward(); | 122 | void forward(); |
122 | void remove();*/ | 123 | void remove();*/ |
123 | 124 | ||
125 | private slots: | ||
126 | void receive(const QCString&, const QByteArray&); | ||
127 | |||
124 | private: | 128 | private: |
125 | void init(); | 129 | void init(); |
130 | void initStatusBar(QWidget*); | ||
126 | void readMail(); | 131 | void readMail(); |
127 | QString getPath(bool enclosurePath); | 132 | QString getPath(bool enclosurePath); |
128 | void readSettings(); | 133 | void readSettings(); |
129 | void saveSettings(); | 134 | void saveSettings(); |
@@ -145,8 +150,10 @@ private: | |||
145 | bool sending, receiving, previewingMail, allAccounts; | 150 | bool sending, receiving, previewingMail, allAccounts; |
146 | QString lineShift; | 151 | QString lineShift; |
147 | MailAccount account, *currentAccount; | 152 | MailAccount account, *currentAccount; |
148 | 153 | ||
154 | QCopChannel* channel; | ||
155 | |||
149 | QToolBar *bar; | 156 | QToolBar *bar; |
150 | QProgressBar *progressBar; | 157 | QProgressBar *progressBar; |
151 | QStatusBar *statusBar; | 158 | QStatusBar *statusBar; |
152 | QLabel *status1Label, *status2Label; | 159 | QLabel *status1Label, *status2Label; |
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index fbbada7..c7b27a0 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -38,8 +38,10 @@ Enclosure* EnclosureList::dupl(Enclosure *in) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | EmailHandler::EmailHandler() | 40 | EmailHandler::EmailHandler() |
41 | { | 41 | { |
42 | qDebug("EMailHandler::EmailHandler"); | ||
43 | |||
42 | smtpClient = new SmtpClient(); | 44 | smtpClient = new SmtpClient(); |
43 | popClient = new PopClient(); | 45 | popClient = new PopClient(); |
44 | 46 | ||
45 | connect(smtpClient, SIGNAL(errorOccurred(int)), this, | 47 | connect(smtpClient, SIGNAL(errorOccurred(int)), this, |
@@ -114,8 +116,9 @@ void EmailHandler::getMailHeaders() | |||
114 | mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); | 116 | mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); |
115 | 117 | ||
116 | headers = TRUE; | 118 | headers = TRUE; |
117 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all | 119 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all |
120 | qDebug("Initiating connection"); | ||
118 | popClient->newConnection(mailAccount.popServer, 110); | 121 | popClient->newConnection(mailAccount.popServer, 110); |
119 | } | 122 | } |
120 | 123 | ||
121 | void EmailHandler::getMailByList(MailList *mailList) | 124 | void EmailHandler::getMailByList(MailList *mailList) |
@@ -625,4 +628,5 @@ void EmailHandler::cancel() | |||
625 | { | 628 | { |
626 | popClient->errorHandling(ErrCancel); | 629 | popClient->errorHandling(ErrCancel); |
627 | smtpClient->errorHandling(ErrCancel); | 630 | smtpClient->errorHandling(ErrCancel); |
628 | } | 631 | } |
632 | |||
diff --git a/noncore/net/mailit/emailhandler.h b/noncore/net/mailit/emailhandler.h index b645868..5b59f65 100644 --- a/noncore/net/mailit/emailhandler.h +++ b/noncore/net/mailit/emailhandler.h | |||
@@ -27,8 +27,9 @@ | |||
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qfile.h> | 28 | #include <qfile.h> |
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <qcollection.h> | 30 | #include <qcollection.h> |
31 | #include <qpe/qcopenvelope_qws.h> | ||
31 | 32 | ||
32 | #include "smtpclient.h" | 33 | #include "smtpclient.h" |
33 | #include "popclient.h" | 34 | #include "popclient.h" |
34 | #include "textparser.h" | 35 | #include "textparser.h" |
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp index ffee67e..a111241 100644 --- a/noncore/net/mailit/mailitwindow.cpp +++ b/noncore/net/mailit/mailitwindow.cpp | |||
@@ -60,8 +60,11 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
60 | SLOT(moveMailFront(Email *)) ); | 60 | SLOT(moveMailFront(Email *)) ); |
61 | 61 | ||
62 | connect(emailClient, SIGNAL(newCaption(const QString &)), | 62 | connect(emailClient, SIGNAL(newCaption(const QString &)), |
63 | this, SLOT(updateCaption(const QString &)) ); | 63 | this, SLOT(updateCaption(const QString &)) ); |
64 | |||
65 | connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) ); | ||
66 | |||
64 | viewingMail = FALSE; | 67 | viewingMail = FALSE; |
65 | } | 68 | } |
66 | 69 | ||
67 | MailItWindow::~MailItWindow() | 70 | MailItWindow::~MailItWindow() |
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp index 6105d09..fedc4e2 100644 --- a/noncore/net/mailit/popclient.cpp +++ b/noncore/net/mailit/popclient.cpp | |||
@@ -28,8 +28,9 @@ extern "C" { | |||
28 | #include <qcstring.h> | 28 | #include <qcstring.h> |
29 | 29 | ||
30 | PopClient::PopClient() | 30 | PopClient::PopClient() |
31 | { | 31 | { |
32 | |||
32 | socket = new QSocket(this, "popClient"); | 33 | socket = new QSocket(this, "popClient"); |
33 | connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); | 34 | connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); |
34 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); | 35 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); |
35 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); | 36 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); |
@@ -116,8 +117,9 @@ void PopClient::incomingData() | |||
116 | // char *md5Digest; | 117 | // char *md5Digest; |
117 | char md5Digest[16]; | 118 | char md5Digest[16]; |
118 | // if ( !socket->canReadLine() ) | 119 | // if ( !socket->canReadLine() ) |
119 | // return; | 120 | // return; |
121 | |||
120 | 122 | ||
121 | response = socket->readLine(); | 123 | response = socket->readLine(); |
122 | 124 | ||
123 | switch(status) { | 125 | switch(status) { |
@@ -150,21 +152,22 @@ void PopClient::incomingData() | |||
150 | *stream << "USER " << popUserName << "\r\n"; | 152 | *stream << "USER " << popUserName << "\r\n"; |
151 | status = Pass; | 153 | status = Pass; |
152 | } | 154 | } |
153 | 155 | ||
154 | break; | 156 | break; |
155 | } | 157 | } |
156 | 158 | ||
157 | case Pass: { | 159 | case Pass: { |
158 | *stream << "PASS " << popPassword << "\r\n"; | 160 | *stream << "PASS " << popPassword << "\r\n"; |
159 | status = Stat; | 161 | status = Stat; |
162 | |||
160 | break; | 163 | break; |
161 | } | 164 | } |
162 | //ask for number of messages | 165 | //ask for number of messages |
163 | case Stat: { | 166 | case Stat: { |
164 | if (response[0] == '+') { | 167 | if (response[0] == '+') { |
165 | *stream << "STAT" << "\r\n"; | 168 | *stream << "STAT" << "\r\n"; |
166 | status = Mcnt; | 169 | status = Mcnt; |
167 | } else errorHandling(ErrLoginFailed); | 170 | } else errorHandling(ErrLoginFailed); |
168 | break; | 171 | break; |
169 | } | 172 | } |
170 | //get count of messages, eg "+OK 4 900.." -> int 4 | 173 | //get count of messages, eg "+OK 4 900.." -> int 4 |
@@ -178,10 +181,10 @@ void PopClient::incomingData() | |||
178 | status = List; | 181 | status = List; |
179 | 182 | ||
180 | if (synchronize) { | 183 | if (synchronize) { |
181 | //messages deleted from server, reload all | 184 | //messages deleted from server, reload all |
182 | if (newMessages < lastSync) | 185 | if (newMessages < lastSync) |
183 | lastSync = 0; | 186 | lastSync = 0; |
184 | messageCount = 1; | 187 | messageCount = 1; |
185 | } | 188 | } |
186 | 189 | ||
187 | if (selected) { | 190 | if (selected) { |
@@ -272,9 +275,8 @@ void PopClient::incomingData() | |||
272 | int x = message.find("\r\n.\r\n",-5); | 275 | int x = message.find("\r\n.\r\n",-5); |
273 | if (x == -1) { | 276 | if (x == -1) { |
274 | break; | 277 | break; |
275 | } else { //message reach entire size | 278 | } else { //message reach entire size |
276 | |||
277 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active | 279 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active |
278 | { | 280 | { |
279 | emit newMessage(message, messageCount-1, mailSize, TRUE); | 281 | emit newMessage(message, messageCount-1, mailSize, TRUE); |
280 | } else { //incomplete mail downloaded | 282 | } else { //incomplete mail downloaded |
diff --git a/noncore/net/mailit/readmail.cpp b/noncore/net/mailit/readmail.cpp index 4eae7f6..1682675 100644 --- a/noncore/net/mailit/readmail.cpp +++ b/noncore/net/mailit/readmail.cpp | |||
@@ -18,10 +18,12 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "readmail.h" | 20 | #include "readmail.h" |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qwhatsthis.h> | ||
22 | #include <qmime.h> | 23 | #include <qmime.h> |
23 | #include <qaction.h> | 24 | #include <qaction.h> |
25 | #include <qpopupmenu.h> | ||
24 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
25 | 27 | ||
26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) | 28 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow(parent, name, fl) | 29 | : QMainWindow(parent, name, fl) |
@@ -41,8 +43,10 @@ ReadMail::~ReadMail() | |||
41 | void ReadMail::init() | 43 | void ReadMail::init() |
42 | { | 44 | { |
43 | setToolBarsMovable(FALSE); | 45 | setToolBarsMovable(FALSE); |
44 | 46 | ||
47 | QPopupMenu* mailaction=new QPopupMenu(this); | ||
48 | |||
45 | bar = new QToolBar(this); | 49 | bar = new QToolBar(this); |
46 | bar->setHorizontalStretchable( TRUE ); | 50 | bar->setHorizontalStretchable( TRUE ); |
47 | 51 | ||
48 | menu = new QMenuBar( bar ); | 52 | menu = new QMenuBar( bar ); |
@@ -54,19 +58,13 @@ void ReadMail::init() | |||
54 | menu->insertItem( tr( "&Mail" ), mailMenu); | 58 | menu->insertItem( tr( "&Mail" ), mailMenu); |
55 | 59 | ||
56 | bar = new QToolBar(this); | 60 | bar = new QToolBar(this); |
57 | 61 | ||
58 | //reply dependant on viewing inbox | 62 | downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 ); |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), | 63 | connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) ); |
60 | QString::null, 0, this, 0 ); | 64 | downloadButton->setWhatsThis(tr("Click here to download the selected mail")); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | ||
62 | replyButton->setWhatsThis(tr("Click here to reply to the selected mail")); | ||
63 | |||
64 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | ||
65 | QString::null, 0, this, 0 ); | ||
66 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); | ||
67 | forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); | ||
68 | 65 | ||
66 | |||
69 | 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 ); |
70 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 68 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
71 | previousButton->addTo(bar); | 69 | previousButton->addTo(bar); |
72 | previousButton->addTo(viewMenu); | 70 | previousButton->addTo(viewMenu); |
@@ -93,8 +91,25 @@ void ReadMail::init() | |||
93 | "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" | 91 | "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" |
94 | "<LI><B>Plain</B> shows the mail as standard plain text</LI>" | 92 | "<LI><B>Plain</B> shows the mail as standard plain text</LI>" |
95 | "Click here to switch between those view modes" )); | 93 | "Click here to switch between those view modes" )); |
96 | 94 | ||
95 | //reply dependant on viewing inbox | ||
96 | replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar); | ||
97 | QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options.")); | ||
98 | replyButton->setPopup(mailaction); | ||
99 | |||
100 | replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 ); | ||
101 | connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll())); | ||
102 | replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also")); | ||
103 | replyAllButton->addTo(mailaction); | ||
104 | |||
105 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | ||
106 | QString::null, 0, this, 0 ); | ||
107 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward())); | ||
108 | forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); | ||
109 | forwardButton->addTo(mailaction); | ||
110 | |||
111 | |||
97 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 112 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
98 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 113 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
99 | deleteButton->addTo(bar); | 114 | deleteButton->addTo(bar); |
100 | deleteButton->addTo(mailMenu); | 115 | deleteButton->addTo(mailMenu); |
@@ -118,21 +133,28 @@ void ReadMail::updateView() | |||
118 | 133 | ||
119 | mail->read = TRUE; //mark as read | 134 | mail->read = TRUE; //mark as read |
120 | inbox = mail->received; | 135 | inbox = mail->received; |
121 | 136 | ||
122 | replyButton->removeFrom(mailMenu); | 137 | replyButton->setEnabled(false); |
123 | replyButton->removeFrom(bar); | 138 | /*replyButton->removeFrom(bar); |
124 | forwardButton->removeFrom(mailMenu); | 139 | forwardButton->removeFrom(mailMenu); |
125 | forwardButton->removeFrom(bar); | 140 | forwardButton->removeFrom(bar);*/ |
141 | downloadButton->removeFrom(bar); | ||
142 | |||
143 | //downloadButton->setEnabled(!mail->downloaded); | ||
126 | 144 | ||
145 | |||
127 | if (inbox == TRUE) { | 146 | if (inbox == TRUE) { |
128 | replyButton->addTo(bar); | 147 | replyButton->setEnabled(true); |
129 | replyButton->addTo(mailMenu); | 148 | /*replyButton->addTo(mailMenu); |
130 | forwardButton->addTo(bar); | 149 | forwardButton->addTo(bar); |
131 | forwardButton->addTo(mailMenu); | 150 | forwardButton->addTo(mailMenu);*/ |
132 | 151 | ||
133 | 152 | ||
134 | if (!mail->downloaded) { | 153 | if (!mail->downloaded) { |
154 | |||
155 | downloadButton->addTo(bar); | ||
156 | |||
135 | //report currently viewed mail so that it will be | 157 | //report currently viewed mail so that it will be |
136 | //placed first in the queue of new mails to download | 158 | //placed first in the queue of new mails to download |
137 | emit viewingMail(mail); | 159 | emit viewingMail(mail); |
138 | 160 | ||
@@ -356,12 +378,22 @@ void ReadMail::viewAttachments() | |||
356 | } | 378 | } |
357 | 379 | ||
358 | void ReadMail::reply() | 380 | void ReadMail::reply() |
359 | { | 381 | { |
382 | emit replyRequested(*mail, (bool&)FALSE); | ||
383 | } | ||
384 | |||
385 | void ReadMail::replyAll() | ||
386 | { | ||
360 | emit replyRequested(*mail, (bool&)TRUE); | 387 | emit replyRequested(*mail, (bool&)TRUE); |
361 | } | 388 | } |
362 | 389 | ||
363 | void ReadMail::forward() | 390 | void ReadMail::forward() |
364 | { | 391 | { |
365 | emit forwardRequested(*mail); | 392 | emit forwardRequested(*mail); |
366 | } | 393 | } |
367 | 394 | ||
395 | void ReadMail::download() | ||
396 | { | ||
397 | emit download(mail); | ||
398 | } | ||
399 | |||
diff --git a/noncore/net/mailit/readmail.h b/noncore/net/mailit/readmail.h index df32c34..6700595 100644 --- a/noncore/net/mailit/readmail.h +++ b/noncore/net/mailit/readmail.h | |||
@@ -27,8 +27,9 @@ | |||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qtextview.h> | 30 | #include <qtextview.h> |
31 | #include <qtoolbutton.h> | ||
31 | 32 | ||
32 | #include "emailhandler.h" | 33 | #include "emailhandler.h" |
33 | #include "emaillistitem.h" | 34 | #include "emaillistitem.h" |
34 | #include "viewatt.h" | 35 | #include "viewatt.h" |
@@ -49,8 +50,9 @@ signals: | |||
49 | void replyRequested(Email &, bool &); | 50 | void replyRequested(Email &, bool &); |
50 | void forwardRequested(Email&); | 51 | void forwardRequested(Email&); |
51 | void removeItem(EmailListItem *, bool &); | 52 | void removeItem(EmailListItem *, bool &); |
52 | void viewingMail(Email *); | 53 | void viewingMail(Email *); |
54 | void download (Email*); | ||
53 | 55 | ||
54 | public slots: | 56 | public slots: |
55 | void close(); | 57 | void close(); |
56 | void next(); | 58 | void next(); |
@@ -58,9 +60,11 @@ public slots: | |||
58 | void deleteItem(); | 60 | void deleteItem(); |
59 | void shiftText(); | 61 | void shiftText(); |
60 | void viewAttachments(); | 62 | void viewAttachments(); |
61 | void reply(); | 63 | void reply(); |
64 | void replyAll(); | ||
62 | void forward(); | 65 | void forward(); |
66 | void download(); | ||
63 | 67 | ||
64 | private: | 68 | private: |
65 | void init(); | 69 | void init(); |
66 | void updateButtons(); | 70 | void updateButtons(); |
@@ -81,9 +85,11 @@ private: | |||
81 | QAction *nextButton; | 85 | QAction *nextButton; |
82 | QTextView *emailView; | 86 | QTextView *emailView; |
83 | QAction *attachmentButton; | 87 | QAction *attachmentButton; |
84 | QAction *previousButton; | 88 | QAction *previousButton; |
85 | QAction *replyButton; | 89 | QToolButton *replyButton; |
86 | QAction *forwardButton; | 90 | QAction *forwardButton; |
91 | QAction *replyAllButton; | ||
92 | QAction *downloadButton; | ||
87 | }; | 93 | }; |
88 | 94 | ||
89 | #endif // READMAIL_H | 95 | #endif // READMAIL_H |
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index dcf0c6e..c75494e 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -21,10 +21,9 @@ | |||
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include "writemail.h" | 22 | #include "writemail.h" |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) |
26 | : QMainWindow( parent, name, fl ) | ||
27 | { | 26 | { |
28 | showingAddressList = FALSE; | 27 | showingAddressList = FALSE; |
29 | init(); | 28 | init(); |
30 | 29 | ||
@@ -258,30 +257,36 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
258 | 257 | ||
259 | toInput->setText(mail.fromMail); | 258 | toInput->setText(mail.fromMail); |
260 | 259 | ||
261 | if (replyAll) | 260 | if (replyAll) |
262 | { | 261 | { |
263 | for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) | 262 | for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) |
264 | { | 263 | { |
265 | ccRecipients.append(*it); | 264 | ccRecipients.append(*it); |
266 | ccRecipients.append(";"); | 265 | ccRecipients.append(";"); |
267 | } | 266 | } |
268 | ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end | 267 | ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end |
269 | ccInput->setText(ccRecipients); | 268 | ccInput->setText(ccRecipients); |
270 | } | 269 | } |
271 | 270 | else ccInput->clear(); | |
272 | addRecipients(replyAll); | ||
273 | 271 | ||
274 | subjectInput->setText(tr("Re: ") + mail.subject); | 272 | subjectInput->setText(tr("Re: ") + mail.subject); |
275 | 273 | ||
274 | QString citation=mail.fromMail; | ||
275 | citation.append(tr(" wrote on ")); | ||
276 | citation.append(mail.date); | ||
277 | citation.append(":\n"); | ||
278 | |||
279 | |||
280 | //mail.body.insert(0,tr("On")); | ||
276 | pos = 0; | 281 | pos = 0; |
277 | mail.body.insert(pos, ">"); | 282 | mail.body.insert(pos, ">"); |
278 | while (pos != -1) { | 283 | while (pos != -1) { |
279 | pos = mail.body.find('\n', pos); | 284 | pos = mail.body.find('\n', pos); |
280 | if (pos != -1) | 285 | if (pos != -1) |
281 | mail.body.insert(++pos, ">>"); | 286 | mail.body.insert(++pos, ">>"); |
282 | } | 287 | } |
283 | 288 | mail.body.insert(0,citation); | |
284 | emailInput->setText(mail.body); | 289 | emailInput->setText(mail.body); |
285 | } | 290 | } |
286 | 291 | ||
287 | void WriteMail::forward(Email forwMail) | 292 | void WriteMail::forward(Email forwMail) |
@@ -307,25 +312,32 @@ bool WriteMail::getRecipients(bool ccField) | |||
307 | { | 312 | { |
308 | QString str, temp; | 313 | QString str, temp; |
309 | int pos = 0; | 314 | int pos = 0; |
310 | 315 | ||
311 | mail.recipients.clear(); | 316 | if (ccField) |
312 | 317 | { | |
313 | ccField ? temp = ccInput->text() : temp=toInput->text() ; | 318 | mail.carbonCopies.clear(); |
319 | temp = ccInput->text(); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | mail.recipients.clear(); | ||
324 | temp=toInput->text() ; | ||
325 | } | ||
314 | 326 | ||
315 | while ( (pos = temp.find(';')) != -1) { | 327 | while ( (pos = temp.find(';')) != -1) { |
316 | str = temp.left(pos).stripWhiteSpace(); | 328 | str = temp.left(pos).stripWhiteSpace(); |
317 | temp = temp.right(temp.length() - (pos + 1)); | 329 | temp = temp.right(temp.length() - (pos + 1)); |
318 | if ( str.find('@') == -1) | 330 | if ( str.find('@') == -1) |
319 | return false; | 331 | return false; |
320 | ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); | 332 | ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); |
321 | addressList->addContact(str, ""); | 333 | //addressList->addContact(str, ""); |
322 | } | 334 | } |
323 | temp = temp.stripWhiteSpace(); | 335 | temp = temp.stripWhiteSpace(); |
324 | if ( temp.find('@') == -1) | 336 | if ( temp.find('@') == -1) |
325 | return false; | 337 | return false; |
326 | ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); | 338 | ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); |
327 | addressList->addContact(temp, ""); | 339 | //addressList->addContact(temp, ""); |
328 | 340 | ||
329 | return TRUE; | 341 | return TRUE; |
330 | } | 342 | } |
331 | 343 | ||
@@ -382,8 +394,9 @@ void WriteMail::setRecipient(const QString &recipient) | |||
382 | 394 | ||
383 | void WriteMail::newMail() | 395 | void WriteMail::newMail() |
384 | { | 396 | { |
385 | toInput->clear(); | 397 | toInput->clear(); |
398 | ccInput->clear(); | ||
386 | subjectInput->clear(); | 399 | subjectInput->clear(); |
387 | emailInput->clear(); | 400 | emailInput->clear(); |
388 | setAddressList(addressList); | 401 | setAddressList(addressList); |
389 | } | 402 | } |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index dff1888..2cedc51 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -18,15 +18,17 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qvbox.h> | ||
22 | #include <qfile.h> | 23 | #include <qfile.h> |
23 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
24 | #include <qmenubar.h> | 25 | #include <qmenubar.h> |
25 | #include <qaction.h> | 26 | #include <qaction.h> |
26 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
27 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
28 | #include "emailclient.h" | 29 | #include "emailclient.h" |
30 | #include "writemail.h" | ||
29 | 31 | ||
30 | QCollection::Item AccountList::newItem(QCollection::Item d) | 32 | QCollection::Item AccountList::newItem(QCollection::Item d) |
31 | { | 33 | { |
32 | return dupl( (MailAccount *) d); | 34 | return dupl( (MailAccount *) d); |
@@ -39,9 +41,9 @@ MailAccount* AccountList::dupl(MailAccount *in) | |||
39 | } | 41 | } |
40 | 42 | ||
41 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | 43 | EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) |
42 | : QMainWindow( parent, name, fl ) | 44 | : QMainWindow( parent, name, fl ) |
43 | { | 45 | { |
44 | emailHandler = new EmailHandler(); | 46 | emailHandler = new EmailHandler(); |
45 | addressList = new AddressList(); | 47 | addressList = new AddressList(); |
46 | 48 | ||
47 | sending = FALSE; | 49 | sending = FALSE; |
@@ -52,8 +54,10 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
52 | allAccounts = FALSE; | 54 | allAccounts = FALSE; |
53 | 55 | ||
54 | init(); | 56 | init(); |
55 | 57 | ||
58 | |||
59 | |||
56 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); | 60 | connect(emailHandler, SIGNAL(mailSent()), this, SLOT(mailSent()) ); |
57 | 61 | ||
58 | connect(emailHandler, SIGNAL(smtpError(int)), this, | 62 | connect(emailHandler, SIGNAL(smtpError(int)), this, |
59 | SLOT(smtpError(int)) ); | 63 | SLOT(smtpError(int)) ); |
@@ -64,10 +68,9 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
64 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); | 68 | connect(outboxView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(outboxItemSelected()) ); |
65 | 69 | ||
66 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); | 70 | connect(inboxView, SIGNAL(pressed(QListViewItem *)), this, SLOT(inboxItemPressed()) ); |
67 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); | 71 | connect(inboxView, SIGNAL(clicked(QListViewItem *)), this, SLOT(inboxItemReleased()) ); |
68 | 72 | ||
69 | |||
70 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, | 73 | connect(emailHandler, SIGNAL(mailArrived(const Email &, bool)), this, |
71 | SLOT(mailArrived(const Email &, bool)) ); | 74 | SLOT(mailArrived(const Email &, bool)) ); |
72 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, | 75 | connect(emailHandler, SIGNAL(mailTransfered(int)), this, |
73 | SLOT(allMailArrived(int)) ); | 76 | SLOT(allMailArrived(int)) ); |
@@ -83,8 +86,13 @@ EmailClient::EmailClient( QWidget* parent, const char* name, WFlags fl ) | |||
83 | readMail(); | 86 | readMail(); |
84 | lineShift = "\r\n"; | 87 | lineShift = "\r\n"; |
85 | 88 | ||
86 | mailboxView->setCurrentTab(0); //ensure that inbox has focus | 89 | mailboxView->setCurrentTab(0); //ensure that inbox has focus |
90 | |||
91 | /*channel = new QCopChannel( "QPE/Application/mailit", this ); | ||
92 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
93 | this, SLOT(receive(const QCString&, const QByteArray&)) );*/ | ||
94 | |||
87 | } | 95 | } |
88 | 96 | ||
89 | 97 | ||
90 | EmailClient::~EmailClient() | 98 | EmailClient::~EmailClient() |
@@ -103,31 +111,10 @@ EmailClient::~EmailClient() | |||
103 | } | 111 | } |
104 | 112 | ||
105 | void EmailClient::init() | 113 | void EmailClient::init() |
106 | { | 114 | { |
107 | statusBar = new QStatusBar(this); | 115 | initStatusBar(this); |
108 | statusBar->setSizeGripEnabled(FALSE); | 116 | |
109 | |||
110 | status1Label = new QLabel( tr("Idle"), statusBar); | ||
111 | status2Label = new QLabel("", statusBar); | ||
112 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | ||
113 | status2Label, SLOT(setText(const QString &)) ); | ||
114 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | ||
115 | status2Label, SLOT(setText(const QString &)) ); | ||
116 | |||
117 | progressBar = new QProgressBar(statusBar); | ||
118 | |||
119 | connect(emailHandler, SIGNAL(mailboxSize(int)), | ||
120 | this, SLOT(setTotalSize(int)) ); | ||
121 | connect(emailHandler, SIGNAL(currentMailSize(int)), | ||
122 | this, SLOT(setMailSize(int)) ); | ||
123 | connect(emailHandler, SIGNAL(downloadedSize(int)), | ||
124 | this, SLOT(setDownloadedSize(int)) ); | ||
125 | |||
126 | statusBar->addWidget(status1Label); | ||
127 | statusBar->addWidget(progressBar); | ||
128 | statusBar->addWidget(status2Label); | ||
129 | |||
130 | setToolBarsMovable(FALSE); | 117 | setToolBarsMovable(FALSE); |
131 | 118 | ||
132 | bar = new QToolBar(this); | 119 | bar = new QToolBar(this); |
133 | QWhatsThis::add(bar,tr("Main operation toolbar")); | 120 | QWhatsThis::add(bar,tr("Main operation toolbar")); |
@@ -193,10 +180,13 @@ void EmailClient::init() | |||
193 | inboxView->addColumn( tr( "Subject" ) ); | 180 | inboxView->addColumn( tr( "Subject" ) ); |
194 | inboxView->addColumn( tr( "Date" ) ); | 181 | inboxView->addColumn( tr( "Date" ) ); |
195 | inboxView->setMinimumSize( QSize( 0, 0 ) ); | 182 | inboxView->setMinimumSize( QSize( 0, 0 ) ); |
196 | inboxView->setAllColumnsShowFocus(TRUE); | 183 | inboxView->setAllColumnsShowFocus(TRUE); |
197 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n It keeps the fetched mail which can be viewed by double clicking the entry.\n" | 184 | QWhatsThis::add(inboxView,QWidget::tr("This is the inbox view.\n" |
198 | " A blue attachment icon shows whether this mail has attachments.")); | 185 | "It keeps the fetched mail which can be \n" |
186 | "viewed by double clicking the entry.\n" | ||
187 | "blue attachment icon shows whether this \n" | ||
188 | "mailhas attachments.\n")); | ||
199 | 189 | ||
200 | grid_2->addWidget( inboxView, 2, 0 ); | 190 | grid_2->addWidget( inboxView, 2, 0 ); |
201 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); | 191 | mailboxView->addTab( widget, "mailit/inbox", tr( "Inbox" ) ); |
202 | 192 | ||
@@ -209,16 +199,45 @@ void EmailClient::init() | |||
209 | outboxView->addColumn( tr( "To" ) ); | 199 | outboxView->addColumn( tr( "To" ) ); |
210 | outboxView->addColumn( tr( "Subject" ) ); | 200 | outboxView->addColumn( tr( "Subject" ) ); |
211 | outboxView->setAllColumnsShowFocus(TRUE); | 201 | outboxView->setAllColumnsShowFocus(TRUE); |
212 | 202 | ||
213 | QWhatsThis::add(outboxView,QWidget::tr("This is the oubox view.\n It keeps the queued mails to send which can be reviewed by double clicking the entry.")); | 203 | QWhatsThis::add(outboxView,QWidget::tr("This is the outbox view.\n" |
204 | "It keeps the queued mails to send which can be \n" | ||
205 | "reviewed by double clicking the entry.")); | ||
214 | grid_3->addWidget( outboxView, 0, 0 ); | 206 | grid_3->addWidget( outboxView, 0, 0 ); |
215 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); | 207 | mailboxView->addTab( widget_2,"mailit/outbox", tr( "Outbox" ) ); |
216 | 208 | ||
217 | setCentralWidget(mailboxView); | 209 | setCentralWidget(mailboxView); |
218 | 210 | ||
219 | } | 211 | } |
220 | 212 | ||
213 | void EmailClient::initStatusBar(QWidget* parent) | ||
214 | { | ||
215 | statusBar = new QStatusBar(parent); | ||
216 | statusBar->setSizeGripEnabled(FALSE); | ||
217 | |||
218 | status1Label = new QLabel( tr("Idle"), statusBar); | ||
219 | status2Label = new QLabel("", statusBar); | ||
220 | connect(emailHandler, SIGNAL(updatePopStatus(const QString &)), | ||
221 | status2Label, SLOT(setText(const QString &)) ); | ||
222 | connect(emailHandler, SIGNAL(updateSmtpStatus(const QString &)), | ||
223 | status2Label, SLOT(setText(const QString &)) ); | ||
224 | |||
225 | progressBar = new QProgressBar(statusBar); | ||
226 | |||
227 | connect(emailHandler, SIGNAL(mailboxSize(int)), | ||
228 | this, SLOT(setTotalSize(int)) ); | ||
229 | connect(emailHandler, SIGNAL(currentMailSize(int)), | ||
230 | this, SLOT(setMailSize(int)) ); | ||
231 | connect(emailHandler, SIGNAL(downloadedSize(int)), | ||
232 | this, SLOT(setDownloadedSize(int)) ); | ||
233 | |||
234 | statusBar->addWidget(status1Label); | ||
235 | statusBar->addWidget(progressBar); | ||
236 | statusBar->addWidget(status2Label); | ||
237 | |||
238 | } | ||
239 | |||
221 | void EmailClient::compose() | 240 | void EmailClient::compose() |
222 | { | 241 | { |
223 | emit composeRequested(); | 242 | emit composeRequested(); |
224 | } | 243 | } |
@@ -318,18 +337,18 @@ void EmailClient::getNewMail() { | |||
318 | status1Label->setText(currentAccount->accountName + " headers"); | 337 | status1Label->setText(currentAccount->accountName + " headers"); |
319 | progressBar->reset(); | 338 | progressBar->reset(); |
320 | 339 | ||
321 | //get any previous mails not downloaded and add to queue | 340 | //get any previous mails not downloaded and add to queue |
322 | mailDownloadList.clear(); | 341 | /*mailDownloadList.clear(); |
323 | Email *mailPtr; | 342 | Email *mailPtr; |
324 | item = (EmailListItem *) inboxView->firstChild(); | 343 | item = (EmailListItem *) inboxView->firstChild(); |
325 | while (item != NULL) { | 344 | while (item != NULL) { |
326 | mailPtr = item->getMail(); | 345 | mailPtr = item->getMail(); |
327 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { | 346 | if ( (!mailPtr->downloaded) && (mailPtr->fromAccountId == currentAccount->id) ) { |
328 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); | 347 | mailDownloadList.sizeInsert(mailPtr->serverId, mailPtr->size); |
329 | } | 348 | } |
330 | item = (EmailListItem *) item->nextSibling(); | 349 | item = (EmailListItem *) item->nextSibling(); |
331 | } | 350 | }*/ |
332 | 351 | ||
333 | emailHandler->getMailHeaders(); | 352 | emailHandler->getMailHeaders(); |
334 | 353 | ||
335 | } | 354 | } |
@@ -337,9 +356,9 @@ void EmailClient::getNewMail() { | |||
337 | void EmailClient::getAllNewMail() | 356 | void EmailClient::getAllNewMail() |
338 | { | 357 | { |
339 | allAccounts = TRUE; | 358 | allAccounts = TRUE; |
340 | currentAccount = accountList.first(); | 359 | currentAccount = accountList.first(); |
341 | getNewMail(); | 360 | getNewMail(); |
342 | } | 361 | } |
343 | 362 | ||
344 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) | 363 | void EmailClient::mailArrived(const Email &mail, bool fromDisk) |
345 | { | 364 | { |
@@ -347,18 +366,20 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
347 | Email newMail; | 366 | Email newMail; |
348 | int thisMailId; | 367 | int thisMailId; |
349 | emailHandler->parse(mail.rawMail, lineShift, &newMail); | 368 | emailHandler->parse(mail.rawMail, lineShift, &newMail); |
350 | mailconf->setGroup(newMail.id); | 369 | mailconf->setGroup(newMail.id); |
351 | 370 | ||
352 | if (fromDisk) | 371 | if (fromDisk) |
353 | { | 372 | { |
373 | |||
354 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); | 374 | newMail.downloaded = mailconf->readBoolEntry("downloaded"); |
355 | newMail.size = mailconf->readNumEntry("size"); | 375 | newMail.size = mailconf->readNumEntry("size"); |
356 | newMail.serverId = mailconf->readNumEntry("serverid"); | 376 | newMail.serverId = mailconf->readNumEntry("serverid"); |
357 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); | 377 | newMail.fromAccountId = mailconf->readNumEntry("fromaccountid"); |
358 | } | 378 | } |
359 | else | 379 | else |
360 | { //mail arrived from server | 380 | { //mail arrived from server |
381 | |||
361 | newMail.serverId = mail.serverId; | 382 | newMail.serverId = mail.serverId; |
362 | newMail.size = mail.size; | 383 | newMail.size = mail.size; |
363 | newMail.downloaded = mail.downloaded; | 384 | newMail.downloaded = mail.downloaded; |
364 | 385 | ||
@@ -917,9 +938,9 @@ void EmailClient::inboxItemReleased() | |||
917 | { | 938 | { |
918 | //killTimer(timerID); | 939 | //killTimer(timerID); |
919 | } | 940 | } |
920 | 941 | ||
921 | void EmailClient::timerEvent(QTimerEvent *e) | 942 | /*void EmailClient::timerEvent(QTimerEvent *e) |
922 | { | 943 | { |
923 | /*killTimer(timerID); | 944 | /*killTimer(timerID); |
924 | 945 | ||
925 | 946 | ||
@@ -934,10 +955,10 @@ void EmailClient::timerEvent(QTimerEvent *e) | |||
934 | 955 | ||
935 | action->exec(QCursor::pos()); | 956 | action->exec(QCursor::pos()); |
936 | 957 | ||
937 | if (action) delete action; | 958 | if (action) delete action; |
938 | */ | 959 | |
939 | } | 960 | }*/ |
940 | 961 | ||
941 | Email* EmailClient::getCurrentMail() | 962 | Email* EmailClient::getCurrentMail() |
942 | { | 963 | { |
943 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); | 964 | EmailListItem *eli=(EmailListItem* ) (inboxView->selectedItem()); |
@@ -952,10 +973,8 @@ void EmailClient::download(Email* mail) | |||
952 | MailAccount* acc=0; | 973 | MailAccount* acc=0; |
953 | 974 | ||
954 | tempMailDownloadList.clear(); | 975 | tempMailDownloadList.clear(); |
955 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); | 976 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
956 | if (accountList.count()>0) | ||
957 | qDebug("Accounts present"); | ||
958 | 977 | ||
959 | acc=accountList.at(mail->fromAccountId-1); | 978 | acc=accountList.at(mail->fromAccountId-1); |
960 | if (acc) | 979 | if (acc) |
961 | { | 980 | { |
@@ -965,4 +984,49 @@ void EmailClient::download(Email* mail) | |||
965 | else | 984 | else |
966 | QMessageBox::warning(qApp->activeWindow(), | 985 | QMessageBox::warning(qApp->activeWindow(), |
967 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); | 986 | tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); |
968 | } | 987 | } |
988 | |||
989 | void EmailClient::receive(const QCString& msg, const QByteArray& data) | ||
990 | { | ||
991 | /*if (msg=="getMail()") | ||
992 | { | ||
993 | /*QDialog qd(qApp->activeWindow(),"Getting mail",true); | ||
994 | QVBoxLayout *vbProg = new QVBoxLayout( &qd ); | ||
995 | |||
996 | initStatusBar(&qd); | ||
997 | |||
998 | if (statusBar==0) | ||
999 | { | ||
1000 | qDebug("No Bar ..."); | ||
1001 | //statusBar=new ProgressBar(&qd); | ||
1002 | } | ||
1003 | statusBar->show(); | ||
1004 | vbProg->addWidget(statusBar); | ||
1005 | qd.showMaximized(); | ||
1006 | qd.show(); | ||
1007 | emit getAllNewMail(); | ||
1008 | //qd.exec(); | ||
1009 | } | ||
1010 | else if (msg=="compose()") | ||
1011 | { | ||
1012 | QDialog qd(qApp->activeWindow(),"Getting mail",true); | ||
1013 | |||
1014 | WriteMail wm(&qd,"write new mail"); | ||
1015 | QVBoxLayout vbProg( &qd ); | ||
1016 | |||
1017 | wm.showMaximized(); | ||
1018 | vbProg.addWidget(&wm); | ||
1019 | |||
1020 | qd.showMaximized(); | ||
1021 | |||
1022 | emit composeRequested(); | ||
1023 | qd.exec(); | ||
1024 | |||
1025 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | ||
1026 | } | ||
1027 | |||
1028 | else if (msg=="dialog()") | ||
1029 | { | ||
1030 | QMessageBox::warning(qApp->activeWindow(),tr("Info"), tr("Info"), "OK\n"); | ||
1031 | }*/ | ||
1032 | } | ||
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h index 549683b..994fec5 100644 --- a/noncore/unsupported/mailit/emailclient.h +++ b/noncore/unsupported/mailit/emailclient.h | |||
@@ -40,8 +40,9 @@ | |||
40 | #include <qstatusbar.h> | 40 | #include <qstatusbar.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <stdlib.h> | 42 | #include <stdlib.h> |
43 | #include <opie/otabwidget.h> | 43 | #include <opie/otabwidget.h> |
44 | #include <qpe/qcopenvelope_qws.h> | ||
44 | #include <qtimer.h> | 45 | #include <qtimer.h> |
45 | 46 | ||
46 | #include "emailhandler.h" | 47 | #include "emailhandler.h" |
47 | #include "emaillistitem.h" | 48 | #include "emaillistitem.h" |
@@ -69,12 +70,11 @@ class EmailClient : public QMainWindow | |||
69 | public: | 70 | public: |
70 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); | 71 | EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); |
71 | ~EmailClient(); | 72 | ~EmailClient(); |
72 | AddressList* getAdrListRef(); | 73 | AddressList* getAdrListRef(); |
73 | void download(Email*); | ||
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | void timerEvent(QTimerEvent*); | 76 | //void timerEvent(QTimerEvent*); |
77 | 77 | ||
78 | signals: | 78 | signals: |
79 | void composeRequested(); | 79 | void composeRequested(); |
80 | void viewEmail(QListView *, Email *); | 80 | void viewEmail(QListView *, Email *); |
@@ -115,15 +115,20 @@ public slots: | |||
115 | void setTotalSize(int); | 115 | void setTotalSize(int); |
116 | void setMailSize(int); | 116 | void setMailSize(int); |
117 | void setDownloadedSize(int); | 117 | void setDownloadedSize(int); |
118 | void moveMailFront(Email *mailPtr); | 118 | void moveMailFront(Email *mailPtr); |
119 | void download(Email*); | ||
119 | /* void reply(); | 120 | /* void reply(); |
120 | void replyAll(); | 121 | void replyAll(); |
121 | void forward(); | 122 | void forward(); |
122 | void remove();*/ | 123 | void remove();*/ |
123 | 124 | ||
125 | private slots: | ||
126 | void receive(const QCString&, const QByteArray&); | ||
127 | |||
124 | private: | 128 | private: |
125 | void init(); | 129 | void init(); |
130 | void initStatusBar(QWidget*); | ||
126 | void readMail(); | 131 | void readMail(); |
127 | QString getPath(bool enclosurePath); | 132 | QString getPath(bool enclosurePath); |
128 | void readSettings(); | 133 | void readSettings(); |
129 | void saveSettings(); | 134 | void saveSettings(); |
@@ -145,8 +150,10 @@ private: | |||
145 | bool sending, receiving, previewingMail, allAccounts; | 150 | bool sending, receiving, previewingMail, allAccounts; |
146 | QString lineShift; | 151 | QString lineShift; |
147 | MailAccount account, *currentAccount; | 152 | MailAccount account, *currentAccount; |
148 | 153 | ||
154 | QCopChannel* channel; | ||
155 | |||
149 | QToolBar *bar; | 156 | QToolBar *bar; |
150 | QProgressBar *progressBar; | 157 | QProgressBar *progressBar; |
151 | QStatusBar *statusBar; | 158 | QStatusBar *statusBar; |
152 | QLabel *status1Label, *status2Label; | 159 | QLabel *status1Label, *status2Label; |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index fbbada7..c7b27a0 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -38,8 +38,10 @@ Enclosure* EnclosureList::dupl(Enclosure *in) | |||
38 | } | 38 | } |
39 | 39 | ||
40 | EmailHandler::EmailHandler() | 40 | EmailHandler::EmailHandler() |
41 | { | 41 | { |
42 | qDebug("EMailHandler::EmailHandler"); | ||
43 | |||
42 | smtpClient = new SmtpClient(); | 44 | smtpClient = new SmtpClient(); |
43 | popClient = new PopClient(); | 45 | popClient = new PopClient(); |
44 | 46 | ||
45 | connect(smtpClient, SIGNAL(errorOccurred(int)), this, | 47 | connect(smtpClient, SIGNAL(errorOccurred(int)), this, |
@@ -114,8 +116,9 @@ void EmailHandler::getMailHeaders() | |||
114 | mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); | 116 | mailAccount.synchronize ? popClient->setSynchronize(mailAccount.lastServerMailCount): popClient->removeSynchronize(); |
115 | 117 | ||
116 | headers = TRUE; | 118 | headers = TRUE; |
117 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all | 119 | popClient->headersOnly(headers, mailAccount.syncLimit); //less than requested syncLimit, download all |
120 | qDebug("Initiating connection"); | ||
118 | popClient->newConnection(mailAccount.popServer, 110); | 121 | popClient->newConnection(mailAccount.popServer, 110); |
119 | } | 122 | } |
120 | 123 | ||
121 | void EmailHandler::getMailByList(MailList *mailList) | 124 | void EmailHandler::getMailByList(MailList *mailList) |
@@ -625,4 +628,5 @@ void EmailHandler::cancel() | |||
625 | { | 628 | { |
626 | popClient->errorHandling(ErrCancel); | 629 | popClient->errorHandling(ErrCancel); |
627 | smtpClient->errorHandling(ErrCancel); | 630 | smtpClient->errorHandling(ErrCancel); |
628 | } | 631 | } |
632 | |||
diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h index b645868..5b59f65 100644 --- a/noncore/unsupported/mailit/emailhandler.h +++ b/noncore/unsupported/mailit/emailhandler.h | |||
@@ -27,8 +27,9 @@ | |||
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qfile.h> | 28 | #include <qfile.h> |
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <qcollection.h> | 30 | #include <qcollection.h> |
31 | #include <qpe/qcopenvelope_qws.h> | ||
31 | 32 | ||
32 | #include "smtpclient.h" | 33 | #include "smtpclient.h" |
33 | #include "popclient.h" | 34 | #include "popclient.h" |
34 | #include "textparser.h" | 35 | #include "textparser.h" |
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index ffee67e..a111241 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp | |||
@@ -60,8 +60,11 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
60 | SLOT(moveMailFront(Email *)) ); | 60 | SLOT(moveMailFront(Email *)) ); |
61 | 61 | ||
62 | connect(emailClient, SIGNAL(newCaption(const QString &)), | 62 | connect(emailClient, SIGNAL(newCaption(const QString &)), |
63 | this, SLOT(updateCaption(const QString &)) ); | 63 | this, SLOT(updateCaption(const QString &)) ); |
64 | |||
65 | connect(readMail, SIGNAL(download(Email *)), emailClient, SLOT(download(Email*)) ); | ||
66 | |||
64 | viewingMail = FALSE; | 67 | viewingMail = FALSE; |
65 | } | 68 | } |
66 | 69 | ||
67 | MailItWindow::~MailItWindow() | 70 | MailItWindow::~MailItWindow() |
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index 6105d09..fedc4e2 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp | |||
@@ -28,8 +28,9 @@ extern "C" { | |||
28 | #include <qcstring.h> | 28 | #include <qcstring.h> |
29 | 29 | ||
30 | PopClient::PopClient() | 30 | PopClient::PopClient() |
31 | { | 31 | { |
32 | |||
32 | socket = new QSocket(this, "popClient"); | 33 | socket = new QSocket(this, "popClient"); |
33 | connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); | 34 | connect(socket, SIGNAL(error(int)), this, SLOT(errorHandling(int))); |
34 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); | 35 | connect(socket, SIGNAL(connected()), this, SLOT(connectionEstablished())); |
35 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); | 36 | connect(socket, SIGNAL(readyRead()), this, SLOT(incomingData())); |
@@ -116,8 +117,9 @@ void PopClient::incomingData() | |||
116 | // char *md5Digest; | 117 | // char *md5Digest; |
117 | char md5Digest[16]; | 118 | char md5Digest[16]; |
118 | // if ( !socket->canReadLine() ) | 119 | // if ( !socket->canReadLine() ) |
119 | // return; | 120 | // return; |
121 | |||
120 | 122 | ||
121 | response = socket->readLine(); | 123 | response = socket->readLine(); |
122 | 124 | ||
123 | switch(status) { | 125 | switch(status) { |
@@ -150,21 +152,22 @@ void PopClient::incomingData() | |||
150 | *stream << "USER " << popUserName << "\r\n"; | 152 | *stream << "USER " << popUserName << "\r\n"; |
151 | status = Pass; | 153 | status = Pass; |
152 | } | 154 | } |
153 | 155 | ||
154 | break; | 156 | break; |
155 | } | 157 | } |
156 | 158 | ||
157 | case Pass: { | 159 | case Pass: { |
158 | *stream << "PASS " << popPassword << "\r\n"; | 160 | *stream << "PASS " << popPassword << "\r\n"; |
159 | status = Stat; | 161 | status = Stat; |
162 | |||
160 | break; | 163 | break; |
161 | } | 164 | } |
162 | //ask for number of messages | 165 | //ask for number of messages |
163 | case Stat: { | 166 | case Stat: { |
164 | if (response[0] == '+') { | 167 | if (response[0] == '+') { |
165 | *stream << "STAT" << "\r\n"; | 168 | *stream << "STAT" << "\r\n"; |
166 | status = Mcnt; | 169 | status = Mcnt; |
167 | } else errorHandling(ErrLoginFailed); | 170 | } else errorHandling(ErrLoginFailed); |
168 | break; | 171 | break; |
169 | } | 172 | } |
170 | //get count of messages, eg "+OK 4 900.." -> int 4 | 173 | //get count of messages, eg "+OK 4 900.." -> int 4 |
@@ -178,10 +181,10 @@ void PopClient::incomingData() | |||
178 | status = List; | 181 | status = List; |
179 | 182 | ||
180 | if (synchronize) { | 183 | if (synchronize) { |
181 | //messages deleted from server, reload all | 184 | //messages deleted from server, reload all |
182 | if (newMessages < lastSync) | 185 | if (newMessages < lastSync) |
183 | lastSync = 0; | 186 | lastSync = 0; |
184 | messageCount = 1; | 187 | messageCount = 1; |
185 | } | 188 | } |
186 | 189 | ||
187 | if (selected) { | 190 | if (selected) { |
@@ -272,9 +275,8 @@ void PopClient::incomingData() | |||
272 | int x = message.find("\r\n.\r\n",-5); | 275 | int x = message.find("\r\n.\r\n",-5); |
273 | if (x == -1) { | 276 | if (x == -1) { |
274 | break; | 277 | break; |
275 | } else { //message reach entire size | 278 | } else { //message reach entire size |
276 | |||
277 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active | 279 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active |
278 | { | 280 | { |
279 | emit newMessage(message, messageCount-1, mailSize, TRUE); | 281 | emit newMessage(message, messageCount-1, mailSize, TRUE); |
280 | } else { //incomplete mail downloaded | 282 | } else { //incomplete mail downloaded |
diff --git a/noncore/unsupported/mailit/readmail.cpp b/noncore/unsupported/mailit/readmail.cpp index 4eae7f6..1682675 100644 --- a/noncore/unsupported/mailit/readmail.cpp +++ b/noncore/unsupported/mailit/readmail.cpp | |||
@@ -18,10 +18,12 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "readmail.h" | 20 | #include "readmail.h" |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qwhatsthis.h> | ||
22 | #include <qmime.h> | 23 | #include <qmime.h> |
23 | #include <qaction.h> | 24 | #include <qaction.h> |
25 | #include <qpopupmenu.h> | ||
24 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
25 | 27 | ||
26 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) | 28 | ReadMail::ReadMail( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow(parent, name, fl) | 29 | : QMainWindow(parent, name, fl) |
@@ -41,8 +43,10 @@ ReadMail::~ReadMail() | |||
41 | void ReadMail::init() | 43 | void ReadMail::init() |
42 | { | 44 | { |
43 | setToolBarsMovable(FALSE); | 45 | setToolBarsMovable(FALSE); |
44 | 46 | ||
47 | QPopupMenu* mailaction=new QPopupMenu(this); | ||
48 | |||
45 | bar = new QToolBar(this); | 49 | bar = new QToolBar(this); |
46 | bar->setHorizontalStretchable( TRUE ); | 50 | bar->setHorizontalStretchable( TRUE ); |
47 | 51 | ||
48 | menu = new QMenuBar( bar ); | 52 | menu = new QMenuBar( bar ); |
@@ -54,19 +58,13 @@ void ReadMail::init() | |||
54 | menu->insertItem( tr( "&Mail" ), mailMenu); | 58 | menu->insertItem( tr( "&Mail" ), mailMenu); |
55 | 59 | ||
56 | bar = new QToolBar(this); | 60 | bar = new QToolBar(this); |
57 | 61 | ||
58 | //reply dependant on viewing inbox | 62 | downloadButton = new QAction( tr( "Download" ), Resource::loadPixmap( "mailit/download" ),QString::null, 0, this, 0 ); |
59 | replyButton = new QAction( tr( "Reply" ), Resource::loadPixmap( "mailit/reply" ), | 63 | connect(downloadButton, SIGNAL(activated()), this, SLOT(download()) ); |
60 | QString::null, 0, this, 0 ); | 64 | downloadButton->setWhatsThis(tr("Click here to download the selected mail")); |
61 | connect(replyButton, SIGNAL(activated()), this, SLOT(reply()) ); | ||
62 | replyButton->setWhatsThis(tr("Click here to reply to the selected mail")); | ||
63 | |||
64 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | ||
65 | QString::null, 0, this, 0 ); | ||
66 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward()) ); | ||
67 | forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); | ||
68 | 65 | ||
66 | |||
69 | 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 ); |
70 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); | 68 | connect( previousButton, SIGNAL( activated() ), this, SLOT( previous() ) ); |
71 | previousButton->addTo(bar); | 69 | previousButton->addTo(bar); |
72 | previousButton->addTo(viewMenu); | 70 | previousButton->addTo(viewMenu); |
@@ -93,8 +91,25 @@ void ReadMail::init() | |||
93 | "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" | 91 | "<LI><B>RichText</B> shows the mail as HTML with reach features (no standard line breaks)</LI>" |
94 | "<LI><B>Plain</B> shows the mail as standard plain text</LI>" | 92 | "<LI><B>Plain</B> shows the mail as standard plain text</LI>" |
95 | "Click here to switch between those view modes" )); | 93 | "Click here to switch between those view modes" )); |
96 | 94 | ||
95 | //reply dependant on viewing inbox | ||
96 | replyButton = new QToolButton(Resource::loadPixmap("mailit/reply"),tr("reply"),tr("reply to mail"), this,SLOT(reply()),bar); | ||
97 | QWhatsThis::add(replyButton,tr("Click here to reply to the selected mail\nPress and hold for more options.")); | ||
98 | replyButton->setPopup(mailaction); | ||
99 | |||
100 | replyAllButton = new QAction( tr( "Reply all" ), Resource::loadPixmap( "mailit/reply" ),QString::null, 0, this, 0 ); | ||
101 | connect(replyAllButton, SIGNAL(activated()), this, SLOT(replyAll())); | ||
102 | replyAllButton->setWhatsThis(tr("Click here to reply to the selected mail to CC: addresses also")); | ||
103 | replyAllButton->addTo(mailaction); | ||
104 | |||
105 | forwardButton = new QAction( tr( "Forward" ), Resource::loadPixmap( "mailit/forward" ), | ||
106 | QString::null, 0, this, 0 ); | ||
107 | connect(forwardButton, SIGNAL(activated()), this, SLOT(forward())); | ||
108 | forwardButton->setWhatsThis(tr("Click here to forward the selected mail")); | ||
109 | forwardButton->addTo(mailaction); | ||
110 | |||
111 | |||
97 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); | 112 | deleteButton = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); |
98 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); | 113 | connect( deleteButton, SIGNAL( activated() ), this, SLOT( deleteItem() ) ); |
99 | deleteButton->addTo(bar); | 114 | deleteButton->addTo(bar); |
100 | deleteButton->addTo(mailMenu); | 115 | deleteButton->addTo(mailMenu); |
@@ -118,21 +133,28 @@ void ReadMail::updateView() | |||
118 | 133 | ||
119 | mail->read = TRUE; //mark as read | 134 | mail->read = TRUE; //mark as read |
120 | inbox = mail->received; | 135 | inbox = mail->received; |
121 | 136 | ||
122 | replyButton->removeFrom(mailMenu); | 137 | replyButton->setEnabled(false); |
123 | replyButton->removeFrom(bar); | 138 | /*replyButton->removeFrom(bar); |
124 | forwardButton->removeFrom(mailMenu); | 139 | forwardButton->removeFrom(mailMenu); |
125 | forwardButton->removeFrom(bar); | 140 | forwardButton->removeFrom(bar);*/ |
141 | downloadButton->removeFrom(bar); | ||
142 | |||
143 | //downloadButton->setEnabled(!mail->downloaded); | ||
126 | 144 | ||
145 | |||
127 | if (inbox == TRUE) { | 146 | if (inbox == TRUE) { |
128 | replyButton->addTo(bar); | 147 | replyButton->setEnabled(true); |
129 | replyButton->addTo(mailMenu); | 148 | /*replyButton->addTo(mailMenu); |
130 | forwardButton->addTo(bar); | 149 | forwardButton->addTo(bar); |
131 | forwardButton->addTo(mailMenu); | 150 | forwardButton->addTo(mailMenu);*/ |
132 | 151 | ||
133 | 152 | ||
134 | if (!mail->downloaded) { | 153 | if (!mail->downloaded) { |
154 | |||
155 | downloadButton->addTo(bar); | ||
156 | |||
135 | //report currently viewed mail so that it will be | 157 | //report currently viewed mail so that it will be |
136 | //placed first in the queue of new mails to download | 158 | //placed first in the queue of new mails to download |
137 | emit viewingMail(mail); | 159 | emit viewingMail(mail); |
138 | 160 | ||
@@ -356,12 +378,22 @@ void ReadMail::viewAttachments() | |||
356 | } | 378 | } |
357 | 379 | ||
358 | void ReadMail::reply() | 380 | void ReadMail::reply() |
359 | { | 381 | { |
382 | emit replyRequested(*mail, (bool&)FALSE); | ||
383 | } | ||
384 | |||
385 | void ReadMail::replyAll() | ||
386 | { | ||
360 | emit replyRequested(*mail, (bool&)TRUE); | 387 | emit replyRequested(*mail, (bool&)TRUE); |
361 | } | 388 | } |
362 | 389 | ||
363 | void ReadMail::forward() | 390 | void ReadMail::forward() |
364 | { | 391 | { |
365 | emit forwardRequested(*mail); | 392 | emit forwardRequested(*mail); |
366 | } | 393 | } |
367 | 394 | ||
395 | void ReadMail::download() | ||
396 | { | ||
397 | emit download(mail); | ||
398 | } | ||
399 | |||
diff --git a/noncore/unsupported/mailit/readmail.h b/noncore/unsupported/mailit/readmail.h index df32c34..6700595 100644 --- a/noncore/unsupported/mailit/readmail.h +++ b/noncore/unsupported/mailit/readmail.h | |||
@@ -27,8 +27,9 @@ | |||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlistview.h> | 28 | #include <qlistview.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qtextview.h> | 30 | #include <qtextview.h> |
31 | #include <qtoolbutton.h> | ||
31 | 32 | ||
32 | #include "emailhandler.h" | 33 | #include "emailhandler.h" |
33 | #include "emaillistitem.h" | 34 | #include "emaillistitem.h" |
34 | #include "viewatt.h" | 35 | #include "viewatt.h" |
@@ -49,8 +50,9 @@ signals: | |||
49 | void replyRequested(Email &, bool &); | 50 | void replyRequested(Email &, bool &); |
50 | void forwardRequested(Email&); | 51 | void forwardRequested(Email&); |
51 | void removeItem(EmailListItem *, bool &); | 52 | void removeItem(EmailListItem *, bool &); |
52 | void viewingMail(Email *); | 53 | void viewingMail(Email *); |
54 | void download (Email*); | ||
53 | 55 | ||
54 | public slots: | 56 | public slots: |
55 | void close(); | 57 | void close(); |
56 | void next(); | 58 | void next(); |
@@ -58,9 +60,11 @@ public slots: | |||
58 | void deleteItem(); | 60 | void deleteItem(); |
59 | void shiftText(); | 61 | void shiftText(); |
60 | void viewAttachments(); | 62 | void viewAttachments(); |
61 | void reply(); | 63 | void reply(); |
64 | void replyAll(); | ||
62 | void forward(); | 65 | void forward(); |
66 | void download(); | ||
63 | 67 | ||
64 | private: | 68 | private: |
65 | void init(); | 69 | void init(); |
66 | void updateButtons(); | 70 | void updateButtons(); |
@@ -81,9 +85,11 @@ private: | |||
81 | QAction *nextButton; | 85 | QAction *nextButton; |
82 | QTextView *emailView; | 86 | QTextView *emailView; |
83 | QAction *attachmentButton; | 87 | QAction *attachmentButton; |
84 | QAction *previousButton; | 88 | QAction *previousButton; |
85 | QAction *replyButton; | 89 | QToolButton *replyButton; |
86 | QAction *forwardButton; | 90 | QAction *forwardButton; |
91 | QAction *replyAllButton; | ||
92 | QAction *downloadButton; | ||
87 | }; | 93 | }; |
88 | 94 | ||
89 | #endif // READMAIL_H | 95 | #endif // READMAIL_H |
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index dcf0c6e..c75494e 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -21,10 +21,9 @@ | |||
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include "writemail.h" | 22 | #include "writemail.h" |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | 24 | ||
25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ) | 25 | WriteMail::WriteMail( QWidget* parent, const char* name, WFlags fl ):QMainWindow( parent, name, fl ) |
26 | : QMainWindow( parent, name, fl ) | ||
27 | { | 26 | { |
28 | showingAddressList = FALSE; | 27 | showingAddressList = FALSE; |
29 | init(); | 28 | init(); |
30 | 29 | ||
@@ -258,30 +257,36 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
258 | 257 | ||
259 | toInput->setText(mail.fromMail); | 258 | toInput->setText(mail.fromMail); |
260 | 259 | ||
261 | if (replyAll) | 260 | if (replyAll) |
262 | { | 261 | { |
263 | for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) | 262 | for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) |
264 | { | 263 | { |
265 | ccRecipients.append(*it); | 264 | ccRecipients.append(*it); |
266 | ccRecipients.append(";"); | 265 | ccRecipients.append(";"); |
267 | } | 266 | } |
268 | ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end | 267 | ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end |
269 | ccInput->setText(ccRecipients); | 268 | ccInput->setText(ccRecipients); |
270 | } | 269 | } |
271 | 270 | else ccInput->clear(); | |
272 | addRecipients(replyAll); | ||
273 | 271 | ||
274 | subjectInput->setText(tr("Re: ") + mail.subject); | 272 | subjectInput->setText(tr("Re: ") + mail.subject); |
275 | 273 | ||
274 | QString citation=mail.fromMail; | ||
275 | citation.append(tr(" wrote on ")); | ||
276 | citation.append(mail.date); | ||
277 | citation.append(":\n"); | ||
278 | |||
279 | |||
280 | //mail.body.insert(0,tr("On")); | ||
276 | pos = 0; | 281 | pos = 0; |
277 | mail.body.insert(pos, ">"); | 282 | mail.body.insert(pos, ">"); |
278 | while (pos != -1) { | 283 | while (pos != -1) { |
279 | pos = mail.body.find('\n', pos); | 284 | pos = mail.body.find('\n', pos); |
280 | if (pos != -1) | 285 | if (pos != -1) |
281 | mail.body.insert(++pos, ">>"); | 286 | mail.body.insert(++pos, ">>"); |
282 | } | 287 | } |
283 | 288 | mail.body.insert(0,citation); | |
284 | emailInput->setText(mail.body); | 289 | emailInput->setText(mail.body); |
285 | } | 290 | } |
286 | 291 | ||
287 | void WriteMail::forward(Email forwMail) | 292 | void WriteMail::forward(Email forwMail) |
@@ -307,25 +312,32 @@ bool WriteMail::getRecipients(bool ccField) | |||
307 | { | 312 | { |
308 | QString str, temp; | 313 | QString str, temp; |
309 | int pos = 0; | 314 | int pos = 0; |
310 | 315 | ||
311 | mail.recipients.clear(); | 316 | if (ccField) |
312 | 317 | { | |
313 | ccField ? temp = ccInput->text() : temp=toInput->text() ; | 318 | mail.carbonCopies.clear(); |
319 | temp = ccInput->text(); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | mail.recipients.clear(); | ||
324 | temp=toInput->text() ; | ||
325 | } | ||
314 | 326 | ||
315 | while ( (pos = temp.find(';')) != -1) { | 327 | while ( (pos = temp.find(';')) != -1) { |
316 | str = temp.left(pos).stripWhiteSpace(); | 328 | str = temp.left(pos).stripWhiteSpace(); |
317 | temp = temp.right(temp.length() - (pos + 1)); | 329 | temp = temp.right(temp.length() - (pos + 1)); |
318 | if ( str.find('@') == -1) | 330 | if ( str.find('@') == -1) |
319 | return false; | 331 | return false; |
320 | ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); | 332 | ccField ? mail.carbonCopies.append(str) : mail.recipients.append(str); |
321 | addressList->addContact(str, ""); | 333 | //addressList->addContact(str, ""); |
322 | } | 334 | } |
323 | temp = temp.stripWhiteSpace(); | 335 | temp = temp.stripWhiteSpace(); |
324 | if ( temp.find('@') == -1) | 336 | if ( temp.find('@') == -1) |
325 | return false; | 337 | return false; |
326 | ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); | 338 | ccField ? mail.carbonCopies.append(temp) : mail.recipients.append(temp); |
327 | addressList->addContact(temp, ""); | 339 | //addressList->addContact(temp, ""); |
328 | 340 | ||
329 | return TRUE; | 341 | return TRUE; |
330 | } | 342 | } |
331 | 343 | ||
@@ -382,8 +394,9 @@ void WriteMail::setRecipient(const QString &recipient) | |||
382 | 394 | ||
383 | void WriteMail::newMail() | 395 | void WriteMail::newMail() |
384 | { | 396 | { |
385 | toInput->clear(); | 397 | toInput->clear(); |
398 | ccInput->clear(); | ||
386 | subjectInput->clear(); | 399 | subjectInput->clear(); |
387 | emailInput->clear(); | 400 | emailInput->clear(); |
388 | setAddressList(addressList); | 401 | setAddressList(addressList); |
389 | } | 402 | } |