-rw-r--r-- | noncore/net/mailit/emailclient.cpp | 65 | ||||
-rw-r--r-- | noncore/net/mailit/emailclient.h | 3 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.cpp | 14 | ||||
-rw-r--r-- | noncore/net/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/net/mailit/mailitwindow.cpp | 24 | ||||
-rw-r--r-- | noncore/net/mailit/popclient.cpp | 72 | ||||
-rw-r--r-- | noncore/net/mailit/writemail.cpp | 26 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.cpp | 65 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailclient.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.cpp | 14 | ||||
-rw-r--r-- | noncore/unsupported/mailit/emailhandler.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/mailit/mailitwindow.cpp | 24 | ||||
-rw-r--r-- | noncore/unsupported/mailit/popclient.cpp | 72 | ||||
-rw-r--r-- | noncore/unsupported/mailit/writemail.cpp | 26 |
14 files changed, 184 insertions, 226 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 @@ -362,7 +362,7 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.size = mail.size; newMail.downloaded = mail.downloaded; - newMail.fromAccountId = currentAccount->id; + newMail.fromAccountId = emailHandler->getAccount()->id; mailconf->writeEntry("fromaccountid", newMail.fromAccountId); } @@ -480,11 +480,11 @@ void EmailClient::allMailArrived(int count) status1Label->setText(currentAccount->accountName); progressBar->reset(); - //emailHandler->getMailByList(&mailDownloadList); mailboxView->setCurrentTab(0); } + void EmailClient::moveMailFront(Email *mailPtr) { if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { @@ -664,7 +664,7 @@ QString EmailClient::getPath(bool enclosurePath) void EmailClient::readSettings() { - int y,acc_count, accountPos=0; + int y,acc_count; mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); @@ -891,13 +891,21 @@ void EmailClient::setDownloadedSize(int size) void EmailClient::deleteItem() { bool inbox=mailboxView->currentTab()==0; + QListView* box; EmailListItem* eli; + int pos; + + inbox ? box=inboxView : box=outboxView; - inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); + eli=(EmailListItem*)box->selectedItem(); if (eli) - deleteMail(eli,(bool&)inbox); + { + box->setSelected(eli->itemBelow(),true); //select the previous item + + deleteMail(eli,(bool&)inbox); //remove mail entry + } } void EmailClient::inboxItemPressed() @@ -939,43 +947,22 @@ Email* EmailClient::getCurrentMail() return NULL; } -/* -void EmailClient::reply() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) +void EmailClient::download(Email* mail) { - emit reply(*mail); - } -} + MailAccount* acc=0; -void EmailClient::replyAll() -{ - Email* mail=getCurrentMail(); + tempMailDownloadList.clear(); + tempMailDownloadList.sizeInsert(mail->serverId, mail->size); + if (accountList.count()>0) + qDebug("Accounts present"); - if (mail!=NULL) + acc=accountList.at(mail->fromAccountId-1); + if (acc) { - emit replyAll(*mail); - } + emailHandler->setAccount(*acc); + emailHandler->getMailByList(&tempMailDownloadList); } - -void EmailClient::forward() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit reply(*mail); - } -} - -void EmailClient::remove() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit remove(*mail); + else + QMessageBox::warning(qApp->activeWindow(), + tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); } -}*/ 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 @@ -70,6 +70,7 @@ public: EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); ~EmailClient(); AddressList* getAdrListRef(); + void download(Email*); protected: void timerEvent(QTimerEvent*); @@ -139,6 +140,8 @@ private: EmailHandler *emailHandler; QList<Email> quedMessages; MailList mailDownloadList; + MailList tempMailDownloadList; + bool sending, receiving, previewingMail, allAccounts; QString lineShift; MailAccount account, *currentAccount; 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 @@ -127,18 +127,20 @@ void EmailHandler::getMailByList(MailList *mailList) headers = FALSE; popClient->headersOnly(FALSE, 0); - popClient->newConnection(mailAccount.popServer, 110); + + popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd); popClient->setSelectedMails(mailList); + popClient->newConnection(mailAccount.popServer, 110); } -void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) +void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) { Email mail; mail.rawMail = message; mail.serverId = id; mail.size = size; - mail.downloaded = incomplete; + mail.downloaded = complete; emit mailArrived(mail, FALSE); } @@ -182,13 +184,11 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) mail->from = mail->from.right(mail->from.length() - 1); } pos++; - mail->fromMail = p.getString(&pos, '>', false); } else { - if ((p.separatorAt(pos) == '<') - || (p.separatorAt(pos) == ' ')) //No name.. nasty - pos++; + if (p.separatorAt(pos) == '<') //No name.. nasty pos++; + //pos++; mail->fromMail = p.getString(&pos, 'z', TRUE); if (mail->fromMail.at(mail->fromMail.length()-1) == '>') mail->fromMail.truncate(mail->fromMail.length() - 1); 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 @@ -111,6 +111,7 @@ class EmailHandler : public QObject public: EmailHandler(); void setAccount(MailAccount account); + MailAccount* getAccount(){return &mailAccount;} void sendMail(QList<Email> *mailList); void getMail(); void getMailHeaders(); 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 @@ -18,6 +18,7 @@ ** **********************************************************************/ #include <qwhatsthis.h> +#include <qmessagebox.h> #include "mailitwindow.h" MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) @@ -61,7 +62,6 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) connect(emailClient, SIGNAL(newCaption(const QString &)), this, SLOT(updateCaption(const QString &)) ); viewingMail = FALSE; - } MailItWindow::~MailItWindow() @@ -84,6 +84,7 @@ void MailItWindow::compose() readMail->hide(); views->raiseWidget(writeMail); writeMail->setAddressList(emailClient->getAdrListRef()); + writeMail->newMail(); setCaption( tr( "Write mail" ) ); } @@ -113,6 +114,27 @@ void MailItWindow::viewMail(QListView *view, Email *mail) { viewingMail = TRUE; emailClient->hide(); + + int result=0; + + if ((mail->received)&&(!mail->downloaded)) + { + QMessageBox mb( tr("Mail not downloaded"), + tr("The mail you have clicked \n" + "has not been downloaded yet.\n " + "Would you like to do it now ?"), + QMessageBox::Information, + QMessageBox::Yes | QMessageBox::Default, + QMessageBox::No | QMessageBox::Escape,0 ); + + result=mb.exec(); + + if (result==QMessageBox::Yes) + { + emailClient->download(mail); + } + } + readMail->update(view, mail); views->raiseWidget(readMail); setCaption( tr( "Examine 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 @@ -60,7 +60,7 @@ void PopClient::newConnection(QString target, int port) socket->connectToHost(target, port); receiving = TRUE; - selected = FALSE; + //selected = FALSE; emit updateStatus("DNS lookup"); } @@ -188,9 +188,10 @@ void PopClient::incomingData() int *ptr = mailList->first(); if (ptr != 0) { newMessages++; //to ensure no early jumpout - messageCount = *(mailList->first()); + messageCount = *ptr; } else newMessages = 0; } + } else errorHandling(ErrUnknownResponse); } //Read message number x, count upwards to messageCount @@ -204,12 +205,12 @@ void PopClient::incomingData() emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); } else { //completing a previously closed transfer - if ( (messageCount - lastSync) <= 0) { + /* if ( (messageCount - lastSync) <= 0) { temp.setNum(messageCount); emit updateStatus(tr("Previous message ") + temp); - } else { + } else {*/ emit updateStatus(tr("Completing message ") + temp); - } + //} } break; } else { @@ -237,7 +238,7 @@ void PopClient::incomingData() //Read message number x, count upwards to messageCount case Retr: { if (status != Quit) { - if (mailSize <= headerLimit) + if ((selected)||(mailSize <= headerLimit)) { *stream << "RETR " << messageCount << "\r\n"; } else { //only header @@ -272,37 +273,24 @@ void PopClient::incomingData() if (x == -1) { break; } else { //message reach entire size - //complete mail downloaded - //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ - if ( mailSize <= headerLimit) + + if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active { emit newMessage(message, messageCount-1, mailSize, TRUE); } else { //incomplete mail downloaded emit newMessage(message, messageCount-1, mailSize, FALSE); } - if (messageCount > newMessages) //that was the last message + + if ((messageCount > newMessages)||(selected)) //last message ? + { status = Quit; - else { //ask for new message if (selected) { //grab next from queue - int *ptr = mailList->next(); - if (ptr != 0) { - messageCount = *ptr; - *stream << "LIST " << messageCount << "\r\n"; - status = Size; - //completing a previously closed transfer - if ( (messageCount - lastSync) <= 0) { - temp.setNum(messageCount); - emit updateStatus(tr("Previous message ") + temp); - } else { - temp.setNum(messageCount - lastSync); - emit updateStatus(tr("Completing message ") + temp); - } - break; - } else { newMessages--; status = Quit; } - } else { + } + else + { *stream << "LIST " << messageCount << "\r\n"; status = Size; temp2.setNum(newMessages - lastSync); @@ -316,7 +304,6 @@ void PopClient::incomingData() if (status != Quit) break; } - } case Quit: { *stream << "Quit\r\n"; status = Done; @@ -336,32 +323,3 @@ void PopClient::incomingData() } } - -// if( bAPOPAuthentication ) -// { -// if( m_strTimeStamp.IsEmpty() ) -// { -// SetLastError("Apop error!"); -// return false; -// } -// strMD5Source = m_strTimeStamp+pszPassword; -// strMD5Dst = MD5_GetMD5( (BYTE*)(const char*)strMD5Source , strMD5Source.GetLength() ); -// sprintf(msg , "apop %s %s\r\n" , pszUser , strMD5Dst); -// ret = send(m_sPop3Socket , msg , strlen(msg) , NULL); -// if(ret == SOCKET_ERROR) -// { -// SetLastError("Socket error!"); -// m_bSocketOK = false; -// m_bConnected = false; -// return false; -// } -// if( !GetSocketResult(&strResult , COMMAND_END_FLAG) ) -// return false; -// if( 0 == strResult.Find('-' , 0) ) -// { -// SetLastError("Username or Password error!"); -// return false; -// } -// m_bConnected = true; - -// } 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 @@ -123,7 +123,7 @@ void WriteMail::init() emailInput = new QMultiLineEdit( widget, "emailInput" ); grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); - QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); + QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); addressView = new QListView( widget, "addressView"); addressView->addColumn("Name"); @@ -132,7 +132,7 @@ void WriteMail::init() addressView->setMultiSelection(TRUE); addressView->hide(); grid->addMultiCellWidget( addressView, 3, 3, 0, 2); - QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); + QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); okButton = new QToolButton(bar, "ok"); okButton->setPixmap( Resource::loadPixmap("enter") ); @@ -148,7 +148,6 @@ void WriteMail::reject() emit cancelMail(); } -// need to insert date void WriteMail::accept() { QStringList attachedFiles, attachmentsType; @@ -252,12 +251,23 @@ void WriteMail::attachFile() void WriteMail::reply(Email replyMail, bool replyAll) { int pos; + QString ccRecipients; mail = replyMail; mail.files.clear(); toInput->setText(mail.fromMail); - //replyAll ? ccInput->setText(mail.c) + + if (replyAll) + { + for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) + { + ccRecipients.append(*it); + ccRecipients.append(";"); + } + ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end + ccInput->setText(ccRecipients); + } addRecipients(replyAll); @@ -321,8 +331,7 @@ bool WriteMail::getRecipients(bool ccField) void WriteMail::addRecipients() { - - addRecipients(false); + toInput->isVisible() ? addRecipients(false) : addRecipients(true); } void WriteMail::addRecipients(bool ccField) @@ -335,9 +344,9 @@ void WriteMail::addRecipients(bool ccField) while (item != NULL) { if ( item->isSelected() ) { if (recipients == "") { - recipients = item->text(0); + recipients = item->text(1); } else { - recipients += "; " + item->text(0); + recipients += "; " + item->text(1); } } item = item->nextSibling(); @@ -376,6 +385,5 @@ void WriteMail::newMail() toInput->clear(); subjectInput->clear(); emailInput->clear(); - //to clear selected 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 @@ -362,7 +362,7 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) newMail.size = mail.size; newMail.downloaded = mail.downloaded; - newMail.fromAccountId = currentAccount->id; + newMail.fromAccountId = emailHandler->getAccount()->id; mailconf->writeEntry("fromaccountid", newMail.fromAccountId); } @@ -480,11 +480,11 @@ void EmailClient::allMailArrived(int count) status1Label->setText(currentAccount->accountName); progressBar->reset(); - //emailHandler->getMailByList(&mailDownloadList); mailboxView->setCurrentTab(0); } + void EmailClient::moveMailFront(Email *mailPtr) { if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { @@ -664,7 +664,7 @@ QString EmailClient::getPath(bool enclosurePath) void EmailClient::readSettings() { - int y,acc_count, accountPos=0; + int y,acc_count; mailconf->setGroup("mailitglobal"); acc_count=mailconf->readNumEntry("Accounts",0); @@ -891,13 +891,21 @@ void EmailClient::setDownloadedSize(int size) void EmailClient::deleteItem() { bool inbox=mailboxView->currentTab()==0; + QListView* box; EmailListItem* eli; + int pos; + + inbox ? box=inboxView : box=outboxView; - inbox ? eli=(EmailListItem*)inboxView->selectedItem():eli=(EmailListItem*)outboxView->selectedItem(); + eli=(EmailListItem*)box->selectedItem(); if (eli) - deleteMail(eli,(bool&)inbox); + { + box->setSelected(eli->itemBelow(),true); //select the previous item + + deleteMail(eli,(bool&)inbox); //remove mail entry + } } void EmailClient::inboxItemPressed() @@ -939,43 +947,22 @@ Email* EmailClient::getCurrentMail() return NULL; } -/* -void EmailClient::reply() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) +void EmailClient::download(Email* mail) { - emit reply(*mail); - } -} + MailAccount* acc=0; -void EmailClient::replyAll() -{ - Email* mail=getCurrentMail(); + tempMailDownloadList.clear(); + tempMailDownloadList.sizeInsert(mail->serverId, mail->size); + if (accountList.count()>0) + qDebug("Accounts present"); - if (mail!=NULL) + acc=accountList.at(mail->fromAccountId-1); + if (acc) { - emit replyAll(*mail); - } + emailHandler->setAccount(*acc); + emailHandler->getMailByList(&tempMailDownloadList); } - -void EmailClient::forward() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit reply(*mail); - } -} - -void EmailClient::remove() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit remove(*mail); + else + QMessageBox::warning(qApp->activeWindow(), + tr("No account associated"), tr("There is no active account \nassociated to this mail\n it can not be downloaded"), "Abort\n"); } -}*/ 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 @@ -70,6 +70,7 @@ public: EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); ~EmailClient(); AddressList* getAdrListRef(); + void download(Email*); protected: void timerEvent(QTimerEvent*); @@ -139,6 +140,8 @@ private: EmailHandler *emailHandler; QList<Email> quedMessages; MailList mailDownloadList; + MailList tempMailDownloadList; + bool sending, receiving, previewingMail, allAccounts; QString lineShift; MailAccount account, *currentAccount; 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 @@ -127,18 +127,20 @@ void EmailHandler::getMailByList(MailList *mailList) headers = FALSE; popClient->headersOnly(FALSE, 0); - popClient->newConnection(mailAccount.popServer, 110); + + popClient->setAccount(mailAccount.popUserName,mailAccount.popPasswd); popClient->setSelectedMails(mailList); + popClient->newConnection(mailAccount.popServer, 110); } -void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) +void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete) { Email mail; mail.rawMail = message; mail.serverId = id; mail.size = size; - mail.downloaded = incomplete; + mail.downloaded = complete; emit mailArrived(mail, FALSE); } @@ -182,13 +184,11 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) mail->from = mail->from.right(mail->from.length() - 1); } pos++; - mail->fromMail = p.getString(&pos, '>', false); } else { - if ((p.separatorAt(pos) == '<') - || (p.separatorAt(pos) == ' ')) //No name.. nasty - pos++; + if (p.separatorAt(pos) == '<') //No name.. nasty pos++; + //pos++; mail->fromMail = p.getString(&pos, 'z', TRUE); if (mail->fromMail.at(mail->fromMail.length()-1) == '>') mail->fromMail.truncate(mail->fromMail.length() - 1); 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 @@ -111,6 +111,7 @@ class EmailHandler : public QObject public: EmailHandler(); void setAccount(MailAccount account); + MailAccount* getAccount(){return &mailAccount;} void sendMail(QList<Email> *mailList); void getMail(); void getMailHeaders(); 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 @@ -18,6 +18,7 @@ ** **********************************************************************/ #include <qwhatsthis.h> +#include <qmessagebox.h> #include "mailitwindow.h" MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) @@ -61,7 +62,6 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) connect(emailClient, SIGNAL(newCaption(const QString &)), this, SLOT(updateCaption(const QString &)) ); viewingMail = FALSE; - } MailItWindow::~MailItWindow() @@ -84,6 +84,7 @@ void MailItWindow::compose() readMail->hide(); views->raiseWidget(writeMail); writeMail->setAddressList(emailClient->getAdrListRef()); + writeMail->newMail(); setCaption( tr( "Write mail" ) ); } @@ -113,6 +114,27 @@ void MailItWindow::viewMail(QListView *view, Email *mail) { viewingMail = TRUE; emailClient->hide(); + + int result=0; + + if ((mail->received)&&(!mail->downloaded)) + { + QMessageBox mb( tr("Mail not downloaded"), + tr("The mail you have clicked \n" + "has not been downloaded yet.\n " + "Would you like to do it now ?"), + QMessageBox::Information, + QMessageBox::Yes | QMessageBox::Default, + QMessageBox::No | QMessageBox::Escape,0 ); + + result=mb.exec(); + + if (result==QMessageBox::Yes) + { + emailClient->download(mail); + } + } + readMail->update(view, mail); views->raiseWidget(readMail); setCaption( tr( "Examine 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 @@ -60,7 +60,7 @@ void PopClient::newConnection(QString target, int port) socket->connectToHost(target, port); receiving = TRUE; - selected = FALSE; + //selected = FALSE; emit updateStatus("DNS lookup"); } @@ -188,9 +188,10 @@ void PopClient::incomingData() int *ptr = mailList->first(); if (ptr != 0) { newMessages++; //to ensure no early jumpout - messageCount = *(mailList->first()); + messageCount = *ptr; } else newMessages = 0; } + } else errorHandling(ErrUnknownResponse); } //Read message number x, count upwards to messageCount @@ -204,12 +205,12 @@ void PopClient::incomingData() emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); } else { //completing a previously closed transfer - if ( (messageCount - lastSync) <= 0) { + /* if ( (messageCount - lastSync) <= 0) { temp.setNum(messageCount); emit updateStatus(tr("Previous message ") + temp); - } else { + } else {*/ emit updateStatus(tr("Completing message ") + temp); - } + //} } break; } else { @@ -237,7 +238,7 @@ void PopClient::incomingData() //Read message number x, count upwards to messageCount case Retr: { if (status != Quit) { - if (mailSize <= headerLimit) + if ((selected)||(mailSize <= headerLimit)) { *stream << "RETR " << messageCount << "\r\n"; } else { //only header @@ -272,37 +273,24 @@ void PopClient::incomingData() if (x == -1) { break; } else { //message reach entire size - //complete mail downloaded - //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ - if ( mailSize <= headerLimit) + + if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active { emit newMessage(message, messageCount-1, mailSize, TRUE); } else { //incomplete mail downloaded emit newMessage(message, messageCount-1, mailSize, FALSE); } - if (messageCount > newMessages) //that was the last message + + if ((messageCount > newMessages)||(selected)) //last message ? + { status = Quit; - else { //ask for new message if (selected) { //grab next from queue - int *ptr = mailList->next(); - if (ptr != 0) { - messageCount = *ptr; - *stream << "LIST " << messageCount << "\r\n"; - status = Size; - //completing a previously closed transfer - if ( (messageCount - lastSync) <= 0) { - temp.setNum(messageCount); - emit updateStatus(tr("Previous message ") + temp); - } else { - temp.setNum(messageCount - lastSync); - emit updateStatus(tr("Completing message ") + temp); - } - break; - } else { newMessages--; status = Quit; } - } else { + } + else + { *stream << "LIST " << messageCount << "\r\n"; status = Size; temp2.setNum(newMessages - lastSync); @@ -316,7 +304,6 @@ void PopClient::incomingData() if (status != Quit) break; } - } case Quit: { *stream << "Quit\r\n"; status = Done; @@ -336,32 +323,3 @@ void PopClient::incomingData() } } - -// if( bAPOPAuthentication ) -// { -// if( m_strTimeStamp.IsEmpty() ) -// { -// SetLastError("Apop error!"); -// return false; -// } -// strMD5Source = m_strTimeStamp+pszPassword; -// strMD5Dst = MD5_GetMD5( (BYTE*)(const char*)strMD5Source , strMD5Source.GetLength() ); -// sprintf(msg , "apop %s %s\r\n" , pszUser , strMD5Dst); -// ret = send(m_sPop3Socket , msg , strlen(msg) , NULL); -// if(ret == SOCKET_ERROR) -// { -// SetLastError("Socket error!"); -// m_bSocketOK = false; -// m_bConnected = false; -// return false; -// } -// if( !GetSocketResult(&strResult , COMMAND_END_FLAG) ) -// return false; -// if( 0 == strResult.Find('-' , 0) ) -// { -// SetLastError("Username or Password error!"); -// return false; -// } -// m_bConnected = true; - -// } 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 @@ -123,7 +123,7 @@ void WriteMail::init() emailInput = new QMultiLineEdit( widget, "emailInput" ); grid->addMultiCellWidget( emailInput, 2, 2, 0, 2); - QWhatsThis::add(recipientsBox,QWidget::tr("Enter your mail text here")); + QWhatsThis::add(emailInput,QWidget::tr("Enter your mail text here")); addressView = new QListView( widget, "addressView"); addressView->addColumn("Name"); @@ -132,7 +132,7 @@ void WriteMail::init() addressView->setMultiSelection(TRUE); addressView->hide(); grid->addMultiCellWidget( addressView, 3, 3, 0, 2); - QWhatsThis::add(recipientsBox,QWidget::tr("Chose the recipients from this list")); + QWhatsThis::add(recipientsBox,QWidget::tr("Choose the recipients from this list")); okButton = new QToolButton(bar, "ok"); okButton->setPixmap( Resource::loadPixmap("enter") ); @@ -148,7 +148,6 @@ void WriteMail::reject() emit cancelMail(); } -// need to insert date void WriteMail::accept() { QStringList attachedFiles, attachmentsType; @@ -252,12 +251,23 @@ void WriteMail::attachFile() void WriteMail::reply(Email replyMail, bool replyAll) { int pos; + QString ccRecipients; mail = replyMail; mail.files.clear(); toInput->setText(mail.fromMail); - //replyAll ? ccInput->setText(mail.c) + + if (replyAll) + { + for (QStringList::Iterator it = mail.carbonCopies.begin();it != mail.carbonCopies.end(); ++it) + { + ccRecipients.append(*it); + ccRecipients.append(";"); + } + ccRecipients.truncate(ccRecipients.length()-1); //no ; at the end + ccInput->setText(ccRecipients); + } addRecipients(replyAll); @@ -321,8 +331,7 @@ bool WriteMail::getRecipients(bool ccField) void WriteMail::addRecipients() { - - addRecipients(false); + toInput->isVisible() ? addRecipients(false) : addRecipients(true); } void WriteMail::addRecipients(bool ccField) @@ -335,9 +344,9 @@ void WriteMail::addRecipients(bool ccField) while (item != NULL) { if ( item->isSelected() ) { if (recipients == "") { - recipients = item->text(0); + recipients = item->text(1); } else { - recipients += "; " + item->text(0); + recipients += "; " + item->text(1); } } item = item->nextSibling(); @@ -376,6 +385,5 @@ void WriteMail::newMail() toInput->clear(); subjectInput->clear(); emailInput->clear(); - //to clear selected setAddressList(addressList); } |