-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 75 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.h | 3 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.cpp | 26 | ||||
-rw-r--r-- | noncore/net/mailit/popclient.cpp | 80 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 28 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 75 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 16 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 26 | ||||
-rw-r--r-- | noncore/unsupported/mailit/popclient.cpp | 80 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 28 |
14 files changed, 208 insertions, 250 deletions
diff --git a/noncore/net/mailit/emailclient.cpp b/noncore/net/mailit/emailclient.cpp index 23059cf..dff1888 100644 --- a/noncore/net/mailit/emailclient.cpp +++ b/noncore/net/mailit/emailclient.cpp | |||
@@ -364,3 +364,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
364 | 364 | ||
365 | newMail.fromAccountId = currentAccount->id; | 365 | newMail.fromAccountId = emailHandler->getAccount()->id; |
366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
@@ -482,4 +482,3 @@ void EmailClient::allMailArrived(int count) | |||
482 | 482 | ||
483 | //emailHandler->getMailByList(&mailDownloadList); | 483 | |
484 | |||
485 | mailboxView->setCurrentTab(0); | 484 | mailboxView->setCurrentTab(0); |
@@ -487,2 +486,3 @@ void EmailClient::allMailArrived(int count) | |||
487 | 486 | ||
487 | |||
488 | void EmailClient::moveMailFront(Email *mailPtr) | 488 | void EmailClient::moveMailFront(Email *mailPtr) |
@@ -666,3 +666,3 @@ void EmailClient::readSettings() | |||
666 | { | 666 | { |
667 | int y,acc_count, accountPos=0; | 667 | int y,acc_count; |
668 | 668 | ||
@@ -893,9 +893,17 @@ void EmailClient::deleteItem() | |||
893 | bool inbox=mailboxView->currentTab()==0; | 893 | bool inbox=mailboxView->currentTab()==0; |
894 | QListView* box; | ||
894 | 895 | ||
895 | EmailListItem* eli; | 896 | EmailListItem* eli; |
897 | int pos; | ||
898 | |||
899 | inbox ? box=inboxView : box=outboxView; | ||
896 | 900 | ||
897 | inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); | 901 | eli=(EmailListItem*)box->selectedItem(); |
898 | 902 | ||
899 | if (eli) | 903 | if (eli) |
900 | deleteMail(eli,(bool&)inbox); | 904 | { |
905 | box->setSelected(eli->itemBelow(),true);//select the previous item | ||
906 | |||
907 | deleteMail(eli,(bool&)inbox); //remove mail entry | ||
908 | } | ||
901 | } | 909 | } |
@@ -941,41 +949,20 @@ Email* EmailClient::getCurrentMail() | |||
941 | 949 | ||
942 | /* | 950 | void EmailClient::download(Email* mail) |
943 | void EmailClient::reply() | ||
944 | { | ||
945 | Email* mail=getCurrentMail(); | ||
946 | |||
947 | if (mail!=NULL) | ||
948 | { | ||
949 | emit reply(*mail); | ||
950 | } | ||
951 | } | ||
952 | |||
953 | void EmailClient::replyAll() | ||
954 | { | ||
955 | Email* mail=getCurrentMail(); | ||
956 | |||
957 | if (mail!=NULL) | ||
958 | { | ||
959 | emit replyAll(*mail); | ||
960 | } | ||
961 | } | ||
962 | |||
963 | void EmailClient::forward() | ||
964 | { | 951 | { |
965 | Email* mail=getCurrentMail(); | 952 | MailAccount* acc=0; |
966 | 953 | ||
967 | if (mail!=NULL) | 954 | tempMailDownloadList.clear(); |
968 | { | 955 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
969 | emit reply(*mail); | 956 | if (accountList.count()>0) |
970 | } | 957 | qDebug("Accounts present"); |
958 | |||
959 | acc=accountList.at(mail->fromAccountId-1); | ||
960 | if (acc) | ||
961 | { | ||
962 | emailHandler->setAccount(*acc); | ||
963 | emailHandler->getMailByList(&tempMailDownloadList); | ||
964 | } | ||
965 | else | ||
966 | 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"); | ||
971 | } | 968 | } |
972 | |||
973 | void EmailClient::remove() | ||
974 | { | ||
975 | Email* mail=getCurrentMail(); | ||
976 | |||
977 | if (mail!=NULL) | ||
978 | { | ||
979 | emit remove(*mail); | ||
980 | } | ||
981 | }*/ | ||
diff --git a/noncore/net/mailit/emailclient.h b/noncore/net/mailit/emailclient.h index 0890dcf..549683b 100644 --- a/noncore/net/mailit/emailclient.h +++ b/noncore/net/mailit/emailclient.h | |||
@@ -72,2 +72,3 @@ public: | |||
72 | AddressList* getAdrListRef(); | 72 | AddressList* getAdrListRef(); |
73 | void download(Email*); | ||
73 | 74 | ||
@@ -141,2 +142,4 @@ private: | |||
141 | MailList mailDownloadList; | 142 | MailList mailDownloadList; |
143 | MailList tempMailDownloadList; | ||
144 | |||
142 | bool sending, receiving, previewingMail, allAccounts; | 145 | bool sending, receiving, previewingMail, allAccounts; |
diff --git a/noncore/net/mailit/emailhandler.cpp b/noncore/net/mailit/emailhandler.cpp index b180051..fbbada7 100644 --- a/noncore/net/mailit/emailhandler.cpp +++ b/noncore/net/mailit/emailhandler.cpp | |||
@@ -129,7 +129,9 @@ void EmailHandler::getMailByList(MailList *mailList) | |||
129 | popClient->headersOnly(FALSE, 0); | 129 | popClient->headersOnly(FALSE, 0); |
130 | popClient->newConnection(mailAccount.popServer, 110); | 130 | |
131 | popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd); | ||
131 | popClient->setSelectedMails(mailList); | 132 | popClient->setSelectedMails(mailList); |
132 | } | 133 | popClient->newConnection(mailAccount.popServer, 110); |
134 | } | ||
133 | 135 | ||
134 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) | 136 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) |
135 | { | 137 | { |
@@ -140,3 +142,3 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo | |||
140 | mail.size = size; | 142 | mail.size = size; |
141 | mail.downloaded = incomplete; | 143 | mail.downloaded = complete; |
142 | 144 | ||
@@ -184,9 +186,7 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
184 | pos++; | 186 | pos++; |
185 | |||
186 | mail->fromMail = p.getString(&pos, '>', false); | 187 | mail->fromMail = p.getString(&pos, '>', false); |
187 | } else { | 188 | } else { |
188 | if ((p.separatorAt(pos) == '<') | 189 | if (p.separatorAt(pos) == '<') //No name.. nasty |
189 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | ||
190 | pos++; | ||
191 | pos++; | 190 | pos++; |
191 | //pos++; | ||
192 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 192 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
diff --git a/noncore/net/mailit/emailhandler.h b/noncore/net/mailit/emailhandler.h index e47fd9a..b645868 100644 --- a/noncore/net/mailit/emailhandler.h +++ b/noncore/net/mailit/emailhandler.h | |||
@@ -113,2 +113,3 @@ public: | |||
113 | void setAccount(MailAccount account); | 113 | void setAccount(MailAccount account); |
114 | MailAccount* getAccount(){return &mailAccount;} | ||
114 | void sendMail(QList<Email> *mailList); | 115 | void sendMail(QList<Email> *mailList); |
diff --git a/noncore/net/mailit/mailitwindow.cpp b/noncore/net/mailit/mailitwindow.cpp index 7181adf..ffee67e 100644 --- a/noncore/net/mailit/mailitwindow.cpp +++ b/noncore/net/mailit/mailitwindow.cpp | |||
@@ -20,2 +20,3 @@ | |||
20 | #include <qwhatsthis.h> | 20 | #include <qwhatsthis.h> |
21 | #include <qmessagebox.h> | ||
21 | #include "mailitwindow.h" | 22 | #include "mailitwindow.h" |
@@ -62,4 +63,3 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
62 | this, SLOT(updateCaption(const QString &)) ); | 63 | this, SLOT(updateCaption(const QString &)) ); |
63 | viewingMail = FALSE; | 64 | viewingMail = FALSE; |
64 | |||
65 | } | 65 | } |
@@ -86,2 +86,3 @@ void MailItWindow::compose() | |||
86 | writeMail->setAddressList(emailClient->getAdrListRef()); | 86 | writeMail->setAddressList(emailClient->getAdrListRef()); |
87 | writeMail->newMail(); | ||
87 | setCaption( tr( "Write mail" ) ); | 88 | setCaption( tr( "Write mail" ) ); |
@@ -115,2 +116,23 @@ void MailItWindow::viewMail(QListView *view, Email *mail) | |||
115 | emailClient->hide(); | 116 | emailClient->hide(); |
117 | |||
118 | int result=0; | ||
119 | |||
120 | if ((mail->received)&&(!mail->downloaded)) | ||
121 | { | ||
122 | QMessageBox mb( tr("Mail not downloaded"), | ||
123 | tr("The mail you have clicked \n" | ||
124 | "has not been downloaded yet.\n " | ||
125 | "Would you like to do it now ?"), | ||
126 | QMessageBox::Information, | ||
127 | QMessageBox::Yes | QMessageBox::Default, | ||
128 | QMessageBox::No | QMessageBox::Escape,0 ); | ||
129 | |||
130 | result=mb.exec(); | ||
131 | |||
132 | if (result==QMessageBox::Yes) | ||
133 | { | ||
134 | emailClient->download(mail); | ||
135 | } | ||
136 | } | ||
137 | |||
116 | readMail->update(view, mail); | 138 | readMail->update(view, mail); |
diff --git a/noncore/net/mailit/popclient.cpp b/noncore/net/mailit/popclient.cpp index 67306be..6105d09 100644 --- a/noncore/net/mailit/popclient.cpp +++ b/noncore/net/mailit/popclient.cpp | |||
@@ -62,3 +62,3 @@ void PopClient::newConnection(QString target, int port) | |||
62 | receiving = TRUE; | 62 | receiving = TRUE; |
63 | selected = FALSE; | 63 | //selected = FALSE; |
64 | 64 | ||
@@ -186,3 +186,3 @@ void PopClient::incomingData() | |||
186 | 186 | ||
187 | if (selected) { | 187 | if (selected) { |
188 | int *ptr = mailList->first(); | 188 | int *ptr = mailList->first(); |
@@ -190,5 +190,6 @@ void PopClient::incomingData() | |||
190 | newMessages++; //to ensure no early jumpout | 190 | newMessages++; //to ensure no early jumpout |
191 | messageCount = *(mailList->first()); | 191 | messageCount = *ptr; |
192 | } else newMessages = 0; | 192 | } else newMessages = 0; |
193 | } | 193 | } |
194 | |||
194 | } else errorHandling(ErrUnknownResponse); | 195 | } else errorHandling(ErrUnknownResponse); |
@@ -206,8 +207,8 @@ void PopClient::incomingData() | |||
206 | //completing a previously closed transfer | 207 | //completing a previously closed transfer |
207 | if ( (messageCount - lastSync) <= 0) { | 208 | /* if ( (messageCount - lastSync) <= 0) { |
208 | temp.setNum(messageCount); | 209 | temp.setNum(messageCount); |
209 | emit updateStatus(tr("Previous message ") + temp); | 210 | emit updateStatus(tr("Previous message ") + temp); |
210 | } else { | 211 | } else {*/ |
211 | emit updateStatus(tr("Completing message ") + temp); | 212 | emit updateStatus(tr("Completing message ") + temp); |
212 | } | 213 | //} |
213 | } | 214 | } |
@@ -239,3 +240,3 @@ void PopClient::incomingData() | |||
239 | if (status != Quit) { | 240 | if (status != Quit) { |
240 | if (mailSize <= headerLimit) | 241 | if ((selected)||(mailSize <= headerLimit)) |
241 | { | 242 | { |
@@ -274,5 +275,4 @@ void PopClient::incomingData() | |||
274 | } else { //message reach entire size | 275 | } else { //message reach entire size |
275 | //complete mail downloaded | 276 | |
276 | //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ | 277 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active |
277 | if ( mailSize <= headerLimit) | ||
278 | { | 278 | { |
@@ -282,21 +282,7 @@ void PopClient::incomingData() | |||
282 | } | 282 | } |
283 | if (messageCount > newMessages) //that was the last message | 283 | |
284 | if ((messageCount > newMessages)||(selected)) //last message ? | ||
285 | { | ||
284 | status = Quit; | 286 | status = Quit; |
285 | else { //ask for new message | ||
286 | if (selected) { //grab next from queue | 287 | if (selected) { //grab next from queue |
287 | int *ptr = mailList->next(); | ||
288 | if (ptr != 0) { | ||
289 | messageCount = *ptr; | ||
290 | *stream << "LIST " << messageCount << "\r\n"; | ||
291 | status = Size; | ||
292 | //completing a previously closed transfer | ||
293 | if ( (messageCount - lastSync) <= 0) { | ||
294 | temp.setNum(messageCount); | ||
295 | emit updateStatus(tr("Previous message ") + temp); | ||
296 | } else { | ||
297 | temp.setNum(messageCount - lastSync); | ||
298 | emit updateStatus(tr("Completing message ") + temp); | ||
299 | } | ||
300 | break; | ||
301 | } else { | ||
302 | newMessages--; | 288 | newMessages--; |
@@ -304,3 +290,5 @@ void PopClient::incomingData() | |||
304 | } | 290 | } |
305 | } else { | 291 | } |
292 | else | ||
293 | { | ||
306 | *stream << "LIST " << messageCount << "\r\n"; | 294 | *stream << "LIST " << messageCount << "\r\n"; |
@@ -312,3 +300,3 @@ void PopClient::incomingData() | |||
312 | break; | 300 | break; |
313 | } | 301 | } |
314 | } | 302 | } |
@@ -317,3 +305,2 @@ void PopClient::incomingData() | |||
317 | break; | 305 | break; |
318 | } | ||
319 | } | 306 | } |
@@ -338,30 +325 @@ void PopClient::incomingData() | |||
338 | } | } | |
339 | |||
340 | // if( bAPOPAuthentication ) | ||
341 | // { | ||
342 | // if( m_strTimeStamp.IsEmpty() ) | ||
343 | // { | ||
344 | // SetLastError("Apop error!"); | ||
345 | // return false; | ||
346 | // } | ||
347 | // strMD5Source = m_strTimeStamp+pszPassword; | ||
348 | // strMD5Dst = MD5_GetMD5( (BYTE*)(const char*)strMD5Source , strMD5Source.GetLength() ); | ||
349 | // sprintf(msg , "apop %s %s\r\n" , pszUser , strMD5Dst); | ||
350 | // ret = send(m_sPop3Socket , msg , strlen(msg) , NULL); | ||
351 | // if(ret == SOCKET_ERROR) | ||
352 | // { | ||
353 | // SetLastError("Socket error!"); | ||
354 | // m_bSocketOK = false; | ||
355 | // m_bConnected = false; | ||
356 | // return false; | ||
357 | // } | ||
358 | // if( !GetSocketResult(&strResult , COMMAND_END_FLAG) ) | ||
359 | // return false; | ||
360 | // if( 0 == strResult.Find('-' , 0) ) | ||
361 | // { | ||
362 | // SetLastError("Username or Password error!"); | ||
363 | // return false; | ||
364 | // } | ||
365 | // m_bConnected = true; | ||
366 | |||
367 | // } | ||
diff --git a/noncore/net/mailit/writemail.cpp b/noncore/net/mailit/writemail.cpp index 0336c83..dcf0c6e 100644 --- a/noncore/net/mailit/writemail.cpp +++ b/noncore/net/mailit/writemail.cpp | |||
@@ -125,3 +125,3 @@ void WriteMail::init() | |||
125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
126 | QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); | 126 | QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); |
127 | 127 | ||
@@ -134,3 +134,3 @@ void WriteMail::init() | |||
134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
135 | QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); | 135 | QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); |
136 | 136 | ||
@@ -150,3 +150,2 @@ void WriteMail::reject() | |||
150 | 150 | ||
151 | // need to insert date | ||
152 | void WriteMail::accept() | 151 | void WriteMail::accept() |
@@ -254,2 +253,3 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
254 | int pos; | 253 | int pos; |
254 | QString ccRecipients; | ||
255 | 255 | ||
@@ -259,4 +259,14 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
259 | toInput->setText(mail.fromMail); | 259 | toInput->setText(mail.fromMail); |
260 | //replyAll ? ccInput->setText(mail.c) | ||
261 | 260 | ||
261 | if (replyAll) | ||
262 | { | ||
263 | for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) | ||
264 | { | ||
265 | ccRecipients.append(*it); | ||
266 | ccRecipients.append(";"); | ||
267 | } | ||
268 | ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end | ||
269 | ccInput->setText(ccRecipients); | ||
270 | } | ||
271 | |||
262 | addRecipients(replyAll); | 272 | addRecipients(replyAll); |
@@ -323,6 +333,5 @@ void WriteMail::addRecipients() | |||
323 | { | 333 | { |
324 | 334 | toInput->isVisible() ? addRecipients(false) : addRecipients(true); | |
325 | addRecipients(false); | ||
326 | } | 335 | } |
327 | 336 | ||
328 | void WriteMail::addRecipients(bool ccField) | 337 | void WriteMail::addRecipients(bool ccField) |
@@ -337,5 +346,5 @@ void WriteMail::addRecipients(bool ccField) | |||
337 | if (recipients == "") { | 346 | if (recipients == "") { |
338 | recipients = item->text(0); | 347 | recipients = item->text(1); |
339 | } else { | 348 | } else { |
340 | recipients += "; " + item->text(0); | 349 | recipients += "; " + item->text(1); |
341 | } | 350 | } |
@@ -378,3 +387,2 @@ void WriteMail::newMail() | |||
378 | emailInput->clear(); | 387 | emailInput->clear(); |
379 | //to clear selected | ||
380 | setAddressList(addressList); | 388 | setAddressList(addressList); |
diff --git a/noncore/unsupported/mailit/emailclient.cpp b/noncore/unsupported/mailit/emailclient.cpp index 23059cf..dff1888 100644 --- a/noncore/unsupported/mailit/emailclient.cpp +++ b/noncore/unsupported/mailit/emailclient.cpp | |||
@@ -364,3 +364,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) | |||
364 | 364 | ||
365 | newMail.fromAccountId = currentAccount->id; | 365 | newMail.fromAccountId = emailHandler->getAccount()->id; |
366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); | 366 | mailconf->writeEntry("fromaccountid", newMail.fromAccountId); |
@@ -482,4 +482,3 @@ void EmailClient::allMailArrived(int count) | |||
482 | 482 | ||
483 | //emailHandler->getMailByList(&mailDownloadList); | 483 | |
484 | |||
485 | mailboxView->setCurrentTab(0); | 484 | mailboxView->setCurrentTab(0); |
@@ -487,2 +486,3 @@ void EmailClient::allMailArrived(int count) | |||
487 | 486 | ||
487 | |||
488 | void EmailClient::moveMailFront(Email *mailPtr) | 488 | void EmailClient::moveMailFront(Email *mailPtr) |
@@ -666,3 +666,3 @@ void EmailClient::readSettings() | |||
666 | { | 666 | { |
667 | int y,acc_count, accountPos=0; | 667 | int y,acc_count; |
668 | 668 | ||
@@ -893,9 +893,17 @@ void EmailClient::deleteItem() | |||
893 | bool inbox=mailboxView->currentTab()==0; | 893 | bool inbox=mailboxView->currentTab()==0; |
894 | QListView* box; | ||
894 | 895 | ||
895 | EmailListItem* eli; | 896 | EmailListItem* eli; |
897 | int pos; | ||
898 | |||
899 | inbox ? box=inboxView : box=outboxView; | ||
896 | 900 | ||
897 | inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); | 901 | eli=(EmailListItem*)box->selectedItem(); |
898 | 902 | ||
899 | if (eli) | 903 | if (eli) |
900 | deleteMail(eli,(bool&)inbox); | 904 | { |
905 | box->setSelected(eli->itemBelow(),true);//select the previous item | ||
906 | |||
907 | deleteMail(eli,(bool&)inbox); //remove mail entry | ||
908 | } | ||
901 | } | 909 | } |
@@ -941,41 +949,20 @@ Email* EmailClient::getCurrentMail() | |||
941 | 949 | ||
942 | /* | 950 | void EmailClient::download(Email* mail) |
943 | void EmailClient::reply() | ||
944 | { | ||
945 | Email* mail=getCurrentMail(); | ||
946 | |||
947 | if (mail!=NULL) | ||
948 | { | ||
949 | emit reply(*mail); | ||
950 | } | ||
951 | } | ||
952 | |||
953 | void EmailClient::replyAll() | ||
954 | { | ||
955 | Email* mail=getCurrentMail(); | ||
956 | |||
957 | if (mail!=NULL) | ||
958 | { | ||
959 | emit replyAll(*mail); | ||
960 | } | ||
961 | } | ||
962 | |||
963 | void EmailClient::forward() | ||
964 | { | 951 | { |
965 | Email* mail=getCurrentMail(); | 952 | MailAccount* acc=0; |
966 | 953 | ||
967 | if (mail!=NULL) | 954 | tempMailDownloadList.clear(); |
968 | { | 955 | tempMailDownloadList.sizeInsert(mail->serverId, mail->size); |
969 | emit reply(*mail); | 956 | if (accountList.count()>0) |
970 | } | 957 | qDebug("Accounts present"); |
958 | |||
959 | acc=accountList.at(mail->fromAccountId-1); | ||
960 | if (acc) | ||
961 | { | ||
962 | emailHandler->setAccount(*acc); | ||
963 | emailHandler->getMailByList(&tempMailDownloadList); | ||
964 | } | ||
965 | else | ||
966 | 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"); | ||
971 | } | 968 | } |
972 | |||
973 | void EmailClient::remove() | ||
974 | { | ||
975 | Email* mail=getCurrentMail(); | ||
976 | |||
977 | if (mail!=NULL) | ||
978 | { | ||
979 | emit remove(*mail); | ||
980 | } | ||
981 | }*/ | ||
diff --git a/noncore/unsupported/mailit/emailclient.h b/noncore/unsupported/mailit/emailclient.h index 0890dcf..549683b 100644 --- a/noncore/unsupported/mailit/emailclient.h +++ b/noncore/unsupported/mailit/emailclient.h | |||
@@ -72,2 +72,3 @@ public: | |||
72 | AddressList* getAdrListRef(); | 72 | AddressList* getAdrListRef(); |
73 | void download(Email*); | ||
73 | 74 | ||
@@ -141,2 +142,4 @@ private: | |||
141 | MailList mailDownloadList; | 142 | MailList mailDownloadList; |
143 | MailList tempMailDownloadList; | ||
144 | |||
142 | bool sending, receiving, previewingMail, allAccounts; | 145 | bool sending, receiving, previewingMail, allAccounts; |
diff --git a/noncore/unsupported/mailit/emailhandler.cpp b/noncore/unsupported/mailit/emailhandler.cpp index b180051..fbbada7 100644 --- a/noncore/unsupported/mailit/emailhandler.cpp +++ b/noncore/unsupported/mailit/emailhandler.cpp | |||
@@ -129,7 +129,9 @@ void EmailHandler::getMailByList(MailList *mailList) | |||
129 | popClient->headersOnly(FALSE, 0); | 129 | popClient->headersOnly(FALSE, 0); |
130 | popClient->newConnection(mailAccount.popServer, 110); | 130 | |
131 | popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd); | ||
131 | popClient->setSelectedMails(mailList); | 132 | popClient->setSelectedMails(mailList); |
132 | } | 133 | popClient->newConnection(mailAccount.popServer, 110); |
134 | } | ||
133 | 135 | ||
134 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) | 136 | void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) |
135 | { | 137 | { |
@@ -140,3 +142,3 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo | |||
140 | mail.size = size; | 142 | mail.size = size; |
141 | mail.downloaded = incomplete; | 143 | mail.downloaded = complete; |
142 | 144 | ||
@@ -184,9 +186,7 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) | |||
184 | pos++; | 186 | pos++; |
185 | |||
186 | mail->fromMail = p.getString(&pos, '>', false); | 187 | mail->fromMail = p.getString(&pos, '>', false); |
187 | } else { | 188 | } else { |
188 | if ((p.separatorAt(pos) == '<') | 189 | if (p.separatorAt(pos) == '<') //No name.. nasty |
189 | || (p.separatorAt(pos) == ' ')) //No name.. nasty | ||
190 | pos++; | ||
191 | pos++; | 190 | pos++; |
191 | //pos++; | ||
192 | mail->fromMail = p.getString(&pos, 'z', TRUE); | 192 | mail->fromMail = p.getString(&pos, 'z', TRUE); |
diff --git a/noncore/unsupported/mailit/emailhandler.h b/noncore/unsupported/mailit/emailhandler.h index e47fd9a..b645868 100644 --- a/noncore/unsupported/mailit/emailhandler.h +++ b/noncore/unsupported/mailit/emailhandler.h | |||
@@ -113,2 +113,3 @@ public: | |||
113 | void setAccount(MailAccount account); | 113 | void setAccount(MailAccount account); |
114 | MailAccount* getAccount(){return &mailAccount;} | ||
114 | void sendMail(QList<Email> *mailList); | 115 | void sendMail(QList<Email> *mailList); |
diff --git a/noncore/unsupported/mailit/mailitwindow.cpp b/noncore/unsupported/mailit/mailitwindow.cpp index 7181adf..ffee67e 100644 --- a/noncore/unsupported/mailit/mailitwindow.cpp +++ b/noncore/unsupported/mailit/mailitwindow.cpp | |||
@@ -20,2 +20,3 @@ | |||
20 | #include <qwhatsthis.h> | 20 | #include <qwhatsthis.h> |
21 | #include <qmessagebox.h> | ||
21 | #include "mailitwindow.h" | 22 | #include "mailitwindow.h" |
@@ -62,4 +63,3 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) | |||
62 | this, SLOT(updateCaption(const QString &)) ); | 63 | this, SLOT(updateCaption(const QString &)) ); |
63 | viewingMail = FALSE; | 64 | viewingMail = FALSE; |
64 | |||
65 | } | 65 | } |
@@ -86,2 +86,3 @@ void MailItWindow::compose() | |||
86 | writeMail->setAddressList(emailClient->getAdrListRef()); | 86 | writeMail->setAddressList(emailClient->getAdrListRef()); |
87 | writeMail->newMail(); | ||
87 | setCaption( tr( "Write mail" ) ); | 88 | setCaption( tr( "Write mail" ) ); |
@@ -115,2 +116,23 @@ void MailItWindow::viewMail(QListView *view, Email *mail) | |||
115 | emailClient->hide(); | 116 | emailClient->hide(); |
117 | |||
118 | int result=0; | ||
119 | |||
120 | if ((mail->received)&&(!mail->downloaded)) | ||
121 | { | ||
122 | QMessageBox mb( tr("Mail not downloaded"), | ||
123 | tr("The mail you have clicked \n" | ||
124 | "has not been downloaded yet.\n " | ||
125 | "Would you like to do it now ?"), | ||
126 | QMessageBox::Information, | ||
127 | QMessageBox::Yes | QMessageBox::Default, | ||
128 | QMessageBox::No | QMessageBox::Escape,0 ); | ||
129 | |||
130 | result=mb.exec(); | ||
131 | |||
132 | if (result==QMessageBox::Yes) | ||
133 | { | ||
134 | emailClient->download(mail); | ||
135 | } | ||
136 | } | ||
137 | |||
116 | readMail->update(view, mail); | 138 | readMail->update(view, mail); |
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index 67306be..6105d09 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp | |||
@@ -62,3 +62,3 @@ void PopClient::newConnection(QString target, int port) | |||
62 | receiving = TRUE; | 62 | receiving = TRUE; |
63 | selected = FALSE; | 63 | //selected = FALSE; |
64 | 64 | ||
@@ -186,3 +186,3 @@ void PopClient::incomingData() | |||
186 | 186 | ||
187 | if (selected) { | 187 | if (selected) { |
188 | int *ptr = mailList->first(); | 188 | int *ptr = mailList->first(); |
@@ -190,5 +190,6 @@ void PopClient::incomingData() | |||
190 | newMessages++; //to ensure no early jumpout | 190 | newMessages++; //to ensure no early jumpout |
191 | messageCount = *(mailList->first()); | 191 | messageCount = *ptr; |
192 | } else newMessages = 0; | 192 | } else newMessages = 0; |
193 | } | 193 | } |
194 | |||
194 | } else errorHandling(ErrUnknownResponse); | 195 | } else errorHandling(ErrUnknownResponse); |
@@ -206,8 +207,8 @@ void PopClient::incomingData() | |||
206 | //completing a previously closed transfer | 207 | //completing a previously closed transfer |
207 | if ( (messageCount - lastSync) <= 0) { | 208 | /* if ( (messageCount - lastSync) <= 0) { |
208 | temp.setNum(messageCount); | 209 | temp.setNum(messageCount); |
209 | emit updateStatus(tr("Previous message ") + temp); | 210 | emit updateStatus(tr("Previous message ") + temp); |
210 | } else { | 211 | } else {*/ |
211 | emit updateStatus(tr("Completing message ") + temp); | 212 | emit updateStatus(tr("Completing message ") + temp); |
212 | } | 213 | //} |
213 | } | 214 | } |
@@ -239,3 +240,3 @@ void PopClient::incomingData() | |||
239 | if (status != Quit) { | 240 | if (status != Quit) { |
240 | if (mailSize <= headerLimit) | 241 | if ((selected)||(mailSize <= headerLimit)) |
241 | { | 242 | { |
@@ -274,5 +275,4 @@ void PopClient::incomingData() | |||
274 | } else { //message reach entire size | 275 | } else { //message reach entire size |
275 | //complete mail downloaded | 276 | |
276 | //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ | 277 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active |
277 | if ( mailSize <= headerLimit) | ||
278 | { | 278 | { |
@@ -282,21 +282,7 @@ void PopClient::incomingData() | |||
282 | } | 282 | } |
283 | if (messageCount > newMessages) //that was the last message | 283 | |
284 | if ((messageCount > newMessages)||(selected)) //last message ? | ||
285 | { | ||
284 | status = Quit; | 286 | status = Quit; |
285 | else { //ask for new message | ||
286 | if (selected) { //grab next from queue | 287 | if (selected) { //grab next from queue |
287 | int *ptr = mailList->next(); | ||
288 | if (ptr != 0) { | ||
289 | messageCount = *ptr; | ||
290 | *stream << "LIST " << messageCount << "\r\n"; | ||
291 | status = Size; | ||
292 | //completing a previously closed transfer | ||
293 | if ( (messageCount - lastSync) <= 0) { | ||
294 | temp.setNum(messageCount); | ||
295 | emit updateStatus(tr("Previous message ") + temp); | ||
296 | } else { | ||
297 | temp.setNum(messageCount - lastSync); | ||
298 | emit updateStatus(tr("Completing message ") + temp); | ||
299 | } | ||
300 | break; | ||
301 | } else { | ||
302 | newMessages--; | 288 | newMessages--; |
@@ -304,3 +290,5 @@ void PopClient::incomingData() | |||
304 | } | 290 | } |
305 | } else { | 291 | } |
292 | else | ||
293 | { | ||
306 | *stream << "LIST " << messageCount << "\r\n"; | 294 | *stream << "LIST " << messageCount << "\r\n"; |
@@ -312,3 +300,3 @@ void PopClient::incomingData() | |||
312 | break; | 300 | break; |
313 | } | 301 | } |
314 | } | 302 | } |
@@ -317,3 +305,2 @@ void PopClient::incomingData() | |||
317 | break; | 305 | break; |
318 | } | ||
319 | } | 306 | } |
@@ -338,30 +325 @@ void PopClient::incomingData() | |||
338 | } | } | |
339 | |||
340 | // if( bAPOPAuthentication ) | ||
341 | // { | ||
342 | // if( m_strTimeStamp.IsEmpty() ) | ||
343 | // { | ||
344 | // SetLastError("Apop error!"); | ||
345 | // return false; | ||
346 | // } | ||
347 | // strMD5Source = m_strTimeStamp+pszPassword; | ||
348 | // strMD5Dst = MD5_GetMD5( (BYTE*)(const char*)strMD5Source , strMD5Source.GetLength() ); | ||
349 | // sprintf(msg , "apop %s %s\r\n" , pszUser , strMD5Dst); | ||
350 | // ret = send(m_sPop3Socket , msg , strlen(msg) , NULL); | ||
351 | // if(ret == SOCKET_ERROR) | ||
352 | // { | ||
353 | // SetLastError("Socket error!"); | ||
354 | // m_bSocketOK = false; | ||
355 | // m_bConnected = false; | ||
356 | // return false; | ||
357 | // } | ||
358 | // if( !GetSocketResult(&strResult , COMMAND_END_FLAG) ) | ||
359 | // return false; | ||
360 | // if( 0 == strResult.Find('-' , 0) ) | ||
361 | // { | ||
362 | // SetLastError("Username or Password error!"); | ||
363 | // return false; | ||
364 | // } | ||
365 | // m_bConnected = true; | ||
366 | |||
367 | // } | ||
diff --git a/noncore/unsupported/mailit/writemail.cpp b/noncore/unsupported/mailit/writemail.cpp index 0336c83..dcf0c6e 100644 --- a/noncore/unsupported/mailit/writemail.cpp +++ b/noncore/unsupported/mailit/writemail.cpp | |||
@@ -125,3 +125,3 @@ void WriteMail::init() | |||
125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); | 125 | grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); |
126 | QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); | 126 | QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); |
127 | 127 | ||
@@ -134,3 +134,3 @@ void WriteMail::init() | |||
134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); | 134 | grid->addMultiCellWidget( addressView, 3, 3, 0, 2); |
135 | QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); | 135 | QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); |
136 | 136 | ||
@@ -150,3 +150,2 @@ void WriteMail::reject() | |||
150 | 150 | ||
151 | // need to insert date | ||
152 | void WriteMail::accept() | 151 | void WriteMail::accept() |
@@ -254,2 +253,3 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
254 | int pos; | 253 | int pos; |
254 | QString ccRecipients; | ||
255 | 255 | ||
@@ -259,4 +259,14 @@ void WriteMail::reply(Email replyMail, bool replyAll) | |||
259 | toInput->setText(mail.fromMail); | 259 | toInput->setText(mail.fromMail); |
260 | //replyAll ? ccInput->setText(mail.c) | ||
261 | 260 | ||
261 | if (replyAll) | ||
262 | { | ||
263 | for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) | ||
264 | { | ||
265 | ccRecipients.append(*it); | ||
266 | ccRecipients.append(";"); | ||
267 | } | ||
268 | ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end | ||
269 | ccInput->setText(ccRecipients); | ||
270 | } | ||
271 | |||
262 | addRecipients(replyAll); | 272 | addRecipients(replyAll); |
@@ -323,6 +333,5 @@ void WriteMail::addRecipients() | |||
323 | { | 333 | { |
324 | 334 | toInput->isVisible() ? addRecipients(false) : addRecipients(true); | |
325 | addRecipients(false); | ||
326 | } | 335 | } |
327 | 336 | ||
328 | void WriteMail::addRecipients(bool ccField) | 337 | void WriteMail::addRecipients(bool ccField) |
@@ -337,5 +346,5 @@ void WriteMail::addRecipients(bool ccField) | |||
337 | if (recipients == "") { | 346 | if (recipients == "") { |
338 | recipients = item->text(0); | 347 | recipients = item->text(1); |
339 | } else { | 348 | } else { |
340 | recipients += "; " + item->text(0); | 349 | recipients += "; " + item->text(1); |
341 | } | 350 | } |
@@ -378,3 +387,2 @@ void WriteMail::newMail() | |||
378 | emailInput->clear(); | 387 | emailInput->clear(); |
379 | //to clear selected | ||
380 | setAddressList(addressList); | 388 | setAddressList(addressList); |