-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) - newMail.fromAccountId = currentAccount->id; + newMail.fromAccountId = emailHandler->getAccount()->id; mailconf->writeEntry("fromaccountid", newMail.fromAccountId); @@ -482,4 +482,3 @@ void EmailClient::allMailArrived(int count) - //emailHandler->getMailByList(&mailDownloadList); - + mailboxView->setCurrentTab(0); @@ -487,2 +486,3 @@ void EmailClient::allMailArrived(int count) + void EmailClient::moveMailFront(Email *mailPtr) @@ -666,3 +666,3 @@ void EmailClient::readSettings() { - int y,acc_count, accountPos=0; + int y,acc_count; @@ -893,9 +893,17 @@ 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 + } } @@ -941,41 +949,20 @@ Email* EmailClient::getCurrentMail() -/* -void EmailClient::reply() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit reply(*mail); - } -} - -void EmailClient::replyAll() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit replyAll(*mail); - } -} - -void EmailClient::forward() +void EmailClient::download(Email* mail) { - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit reply(*mail); - } + MailAccount* acc=0; + + tempMailDownloadList.clear(); + tempMailDownloadList.sizeInsert(mail->serverId, mail->size); + if (accountList.count()>0) + qDebug("Accounts present"); + + acc=accountList.at(mail->fromAccountId-1); + if (acc) + { + emailHandler->setAccount(*acc); + emailHandler->getMailByList(&tempMailDownloadList); + } + 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"); } - -void EmailClient::remove() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit remove(*mail); - } -}*/ 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: AddressList* getAdrListRef(); + void download(Email*); @@ -141,2 +142,4 @@ private: MailList mailDownloadList; + MailList tempMailDownloadList; + 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) 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) { @@ -140,3 +142,3 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo mail.size = size; - mail.downloaded = incomplete; + mail.downloaded = complete; @@ -184,9 +186,7 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) 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); 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: void setAccount(MailAccount account); + MailAccount* getAccount(){return &mailAccount;} 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 @@ #include <qwhatsthis.h> +#include <qmessagebox.h> #include "mailitwindow.h" @@ -62,4 +63,3 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) this, SLOT(updateCaption(const QString &)) ); - viewingMail = FALSE; - + viewingMail = FALSE; } @@ -86,2 +86,3 @@ void MailItWindow::compose() writeMail->setAddressList(emailClient->getAdrListRef()); + writeMail->newMail(); setCaption( tr( "Write mail" ) ); @@ -115,2 +116,23 @@ void MailItWindow::viewMail(QListView *view, Email *mail) 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); 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) receiving = TRUE; - selected = FALSE; + //selected = FALSE; @@ -186,3 +186,3 @@ void PopClient::incomingData() - if (selected) { + if (selected) { int *ptr = mailList->first(); @@ -190,5 +190,6 @@ void PopClient::incomingData() newMessages++; //to ensure no early jumpout - messageCount = *(mailList->first()); - } else newMessages = 0; - } + messageCount = *ptr; + } else newMessages = 0; + } + } else errorHandling(ErrUnknownResponse); @@ -206,8 +207,8 @@ void PopClient::incomingData() //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); - } + //} } @@ -239,3 +240,3 @@ void PopClient::incomingData() if (status != Quit) { - if (mailSize <= headerLimit) + if ((selected)||(mailSize <= headerLimit)) { @@ -274,5 +275,4 @@ void PopClient::incomingData() } 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 { @@ -282,21 +282,7 @@ void PopClient::incomingData() } - 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--; @@ -304,3 +290,5 @@ void PopClient::incomingData() } - } else { + } + else + { *stream << "LIST " << messageCount << "\r\n"; @@ -312,3 +300,3 @@ void PopClient::incomingData() break; - } + } } @@ -317,3 +305,2 @@ void PopClient::incomingData() break; - } } @@ -338,30 +325 @@ 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 @@ -125,3 +125,3 @@ void WriteMail::init() 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")); @@ -134,3 +134,3 @@ void WriteMail::init() 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")); @@ -150,3 +150,2 @@ void WriteMail::reject() -// need to insert date void WriteMail::accept() @@ -254,2 +253,3 @@ void WriteMail::reply(Email replyMail, bool replyAll) int pos; + QString ccRecipients; @@ -259,4 +259,14 @@ void WriteMail::reply(Email replyMail, bool replyAll) 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); @@ -323,6 +333,5 @@ void WriteMail::addRecipients() { - - addRecipients(false); + toInput->isVisible() ? addRecipients(false) : addRecipients(true); } - + void WriteMail::addRecipients(bool ccField) @@ -337,5 +346,5 @@ void WriteMail::addRecipients(bool ccField) if (recipients == "") { - recipients = item->text(0); + recipients = item->text(1); } else { - recipients += "; " + item->text(0); + recipients += "; " + item->text(1); } @@ -378,3 +387,2 @@ void WriteMail::newMail() 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 @@ -364,3 +364,3 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk) - newMail.fromAccountId = currentAccount->id; + newMail.fromAccountId = emailHandler->getAccount()->id; mailconf->writeEntry("fromaccountid", newMail.fromAccountId); @@ -482,4 +482,3 @@ void EmailClient::allMailArrived(int count) - //emailHandler->getMailByList(&mailDownloadList); - + mailboxView->setCurrentTab(0); @@ -487,2 +486,3 @@ void EmailClient::allMailArrived(int count) + void EmailClient::moveMailFront(Email *mailPtr) @@ -666,3 +666,3 @@ void EmailClient::readSettings() { - int y,acc_count, accountPos=0; + int y,acc_count; @@ -893,9 +893,17 @@ 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 + } } @@ -941,41 +949,20 @@ Email* EmailClient::getCurrentMail() -/* -void EmailClient::reply() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit reply(*mail); - } -} - -void EmailClient::replyAll() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit replyAll(*mail); - } -} - -void EmailClient::forward() +void EmailClient::download(Email* mail) { - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit reply(*mail); - } + MailAccount* acc=0; + + tempMailDownloadList.clear(); + tempMailDownloadList.sizeInsert(mail->serverId, mail->size); + if (accountList.count()>0) + qDebug("Accounts present"); + + acc=accountList.at(mail->fromAccountId-1); + if (acc) + { + emailHandler->setAccount(*acc); + emailHandler->getMailByList(&tempMailDownloadList); + } + 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"); } - -void EmailClient::remove() -{ - Email* mail=getCurrentMail(); - - if (mail!=NULL) - { - emit remove(*mail); - } -}*/ 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: AddressList* getAdrListRef(); + void download(Email*); @@ -141,2 +142,4 @@ private: MailList mailDownloadList; + MailList tempMailDownloadList; + 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) 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) { @@ -140,3 +142,3 @@ void EmailHandler::messageArrived(const QString &message, int id, uint size, boo mail.size = size; - mail.downloaded = incomplete; + mail.downloaded = complete; @@ -184,9 +186,7 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail) 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); 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: void setAccount(MailAccount account); + MailAccount* getAccount(){return &mailAccount;} 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 @@ #include <qwhatsthis.h> +#include <qmessagebox.h> #include "mailitwindow.h" @@ -62,4 +63,3 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) this, SLOT(updateCaption(const QString &)) ); - viewingMail = FALSE; - + viewingMail = FALSE; } @@ -86,2 +86,3 @@ void MailItWindow::compose() writeMail->setAddressList(emailClient->getAdrListRef()); + writeMail->newMail(); setCaption( tr( "Write mail" ) ); @@ -115,2 +116,23 @@ void MailItWindow::viewMail(QListView *view, Email *mail) 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); 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) receiving = TRUE; - selected = FALSE; + //selected = FALSE; @@ -186,3 +186,3 @@ void PopClient::incomingData() - if (selected) { + if (selected) { int *ptr = mailList->first(); @@ -190,5 +190,6 @@ void PopClient::incomingData() newMessages++; //to ensure no early jumpout - messageCount = *(mailList->first()); - } else newMessages = 0; - } + messageCount = *ptr; + } else newMessages = 0; + } + } else errorHandling(ErrUnknownResponse); @@ -206,8 +207,8 @@ void PopClient::incomingData() //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); - } + //} } @@ -239,3 +240,3 @@ void PopClient::incomingData() if (status != Quit) { - if (mailSize <= headerLimit) + if ((selected)||(mailSize <= headerLimit)) { @@ -274,5 +275,4 @@ void PopClient::incomingData() } 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 { @@ -282,21 +282,7 @@ void PopClient::incomingData() } - 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--; @@ -304,3 +290,5 @@ void PopClient::incomingData() } - } else { + } + else + { *stream << "LIST " << messageCount << "\r\n"; @@ -312,3 +300,3 @@ void PopClient::incomingData() break; - } + } } @@ -317,3 +305,2 @@ void PopClient::incomingData() break; - } } @@ -338,30 +325 @@ 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 @@ -125,3 +125,3 @@ void WriteMail::init() 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")); @@ -134,3 +134,3 @@ void WriteMail::init() 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")); @@ -150,3 +150,2 @@ void WriteMail::reject() -// need to insert date void WriteMail::accept() @@ -254,2 +253,3 @@ void WriteMail::reply(Email replyMail, bool replyAll) int pos; + QString ccRecipients; @@ -259,4 +259,14 @@ void WriteMail::reply(Email replyMail, bool replyAll) 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); @@ -323,6 +333,5 @@ void WriteMail::addRecipients() { - - addRecipients(false); + toInput->isVisible() ? addRecipients(false) : addRecipients(true); } - + void WriteMail::addRecipients(bool ccField) @@ -337,5 +346,5 @@ void WriteMail::addRecipients(bool ccField) if (recipients == "") { - recipients = item->text(0); + recipients = item->text(1); } else { - recipients += "; " + item->text(0); + recipients += "; " + item->text(1); } @@ -378,3 +387,2 @@ void WriteMail::newMail() emailInput->clear(); - //to clear selected setAddressList(addressList); |