summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mailit/emailclient.cpp75
-rw-r--r--noncore/net/mailit/emailclient.h3
-rw-r--r--noncore/net/mailit/emailhandler.cpp16
-rw-r--r--noncore/net/mailit/emailhandler.h1
-rw-r--r--noncore/net/mailit/mailitwindow.cpp26
-rw-r--r--noncore/net/mailit/popclient.cpp80
-rw-r--r--noncore/net/mailit/writemail.cpp28
-rw-r--r--noncore/unsupported/mailit/emailclient.cpp75
-rw-r--r--noncore/unsupported/mailit/emailclient.h3
-rw-r--r--noncore/unsupported/mailit/emailhandler.cpp16
-rw-r--r--noncore/unsupported/mailit/emailhandler.h1
-rw-r--r--noncore/unsupported/mailit/mailitwindow.cpp26
-rw-r--r--noncore/unsupported/mailit/popclient.cpp80
-rw-r--r--noncore/unsupported/mailit/writemail.cpp28
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
@@ -359,13 +359,13 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
359 else 359 else
360 { //mail arrived from server 360 { //mail arrived from server
361 newMail.serverId = mail.serverId; 361 newMail.serverId = mail.serverId;
362 newMail.size = mail.size; 362 newMail.size = mail.size;
363 newMail.downloaded = mail.downloaded; 363 newMail.downloaded = mail.downloaded;
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);
367 } 367 }
368 368
369 //add if read or not 369 //add if read or not
370 newMail.read = mailconf->readBoolEntry("mailread"); 370 newMail.read = mailconf->readBoolEntry("mailread");
371 371
@@ -477,17 +477,17 @@ void EmailClient::allMailArrived(int count)
477 477
478 // all headers downloaded from server, start downloading remaining mails 478 // all headers downloaded from server, start downloading remaining mails
479 previewingMail = FALSE; 479 previewingMail = FALSE;
480 status1Label->setText(currentAccount->accountName); 480 status1Label->setText(currentAccount->accountName);
481 progressBar->reset(); 481 progressBar->reset();
482 482
483 //emailHandler->getMailByList(&mailDownloadList); 483
484
485 mailboxView->setCurrentTab(0); 484 mailboxView->setCurrentTab(0);
486} 485}
487 486
487
488void EmailClient::moveMailFront(Email *mailPtr) 488void EmailClient::moveMailFront(Email *mailPtr)
489{ 489{
490 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 490 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
491 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 491 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
492 } 492 }
493} 493}
@@ -661,13 +661,13 @@ QString EmailClient::getPath(bool enclosurePath)
661 } 661 }
662 return (dir.path() + "/"); 662 return (dir.path() + "/");
663} 663}
664 664
665void EmailClient::readSettings() 665void EmailClient::readSettings()
666{ 666{
667 int y,acc_count, accountPos=0; 667 int y,acc_count;
668 668
669 mailconf->setGroup("mailitglobal"); 669 mailconf->setGroup("mailitglobal");
670 acc_count=mailconf->readNumEntry("Accounts",0); 670 acc_count=mailconf->readNumEntry("Accounts",0);
671 671
672 for (int accountPos = 0;accountPos<acc_count ; accountPos++) 672 for (int accountPos = 0;accountPos<acc_count ; accountPos++)
673 { 673 {
@@ -888,19 +888,27 @@ void EmailClient::setDownloadedSize(int size)
888 } 888 }
889} 889}
890 890
891void EmailClient::deleteItem() 891void EmailClient::deleteItem()
892{ 892{
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}
902 910
903void EmailClient::inboxItemPressed() 911void EmailClient::inboxItemPressed()
904{ 912{
905 //timerID=startTimer(500); 913 //timerID=startTimer(500);
906} 914}
@@ -936,46 +944,25 @@ Email* EmailClient::getCurrentMail()
936 if (eli!=NULL) 944 if (eli!=NULL)
937 return eli->getMail(); 945 return eli->getMail();
938 else 946 else
939 return NULL; 947 return NULL;
940} 948}
941 949
942/* 950void EmailClient::download(Email* mail)
943void EmailClient::reply()
944{
945 Email* mail=getCurrentMail();
946
947 if (mail!=NULL)
948 {
949 emit reply(*mail);
950 }
951}
952
953void EmailClient::replyAll()
954{
955 Email* mail=getCurrentMail();
956
957 if (mail!=NULL)
958 {
959 emit replyAll(*mail);
960 }
961}
962
963void 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
973void 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
@@ -67,12 +67,13 @@ class EmailClient : public QMainWindow
67 Q_OBJECT 67 Q_OBJECT
68 68
69public: 69public:
70 EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); 70 EmailClient( QWidget* parent, const char* name, WFlags fl = 0 );
71 ~EmailClient(); 71 ~EmailClient();
72 AddressList* getAdrListRef(); 72 AddressList* getAdrListRef();
73 void download(Email*);
73 74
74protected: 75protected:
75 void timerEvent(QTimerEvent*); 76 void timerEvent(QTimerEvent*);
76 77
77signals: 78signals:
78 void composeRequested(); 79 void composeRequested();
@@ -136,12 +137,14 @@ private:
136 137
137 EditAccount *editAccountView; 138 EditAccount *editAccountView;
138 EmailListItem *item; 139 EmailListItem *item;
139 EmailHandler *emailHandler; 140 EmailHandler *emailHandler;
140 QList<Email> quedMessages; 141 QList<Email> quedMessages;
141 MailList mailDownloadList; 142 MailList mailDownloadList;
143 MailList tempMailDownloadList;
144
142 bool sending, receiving, previewingMail, allAccounts; 145 bool sending, receiving, previewingMail, allAccounts;
143 QString lineShift; 146 QString lineShift;
144 MailAccount account, *currentAccount; 147 MailAccount account, *currentAccount;
145 148
146 QToolBar *bar; 149 QToolBar *bar;
147 QProgressBar *progressBar; 150 QProgressBar *progressBar;
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
@@ -124,24 +124,26 @@ void EmailHandler::getMailByList(MailList *mailList)
124 emit mailTransfered(0); 124 emit mailTransfered(0);
125 return; 125 return;
126 } 126 }
127 127
128 headers = FALSE; 128 headers = FALSE;
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
134void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) 136void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
135{ 137{
136 Email mail; 138 Email mail;
137 139
138 mail.rawMail = message; 140 mail.rawMail = message;
139 mail.serverId = id; 141 mail.serverId = id;
140 mail.size = size; 142 mail.size = size;
141 mail.downloaded = incomplete; 143 mail.downloaded = complete;
142 144
143 emit mailArrived(mail, FALSE); 145 emit mailArrived(mail, FALSE);
144} 146}
145 147
146bool EmailHandler::parse(QString in, QString lineShift, Email *mail) 148bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
147{ 149{
@@ -179,19 +181,17 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
179 mail->from = mail->from.stripWhiteSpace(); 181 mail->from = mail->from.stripWhiteSpace();
180 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { 182 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) {
181 mail->from = mail->from.left(mail->from.length() - 1); 183 mail->from = mail->from.left(mail->from.length() - 1);
182 mail->from = mail->from.right(mail->from.length() - 1); 184 mail->from = mail->from.right(mail->from.length() - 1);
183 } 185 }
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);
193 if (mail->fromMail.at(mail->fromMail.length()-1) == '>') 193 if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
194 mail->fromMail.truncate(mail->fromMail.length() - 1); 194 mail->fromMail.truncate(mail->fromMail.length() - 1);
195 mail->from=mail->fromMail; 195 mail->from=mail->fromMail;
196 } 196 }
197 } 197 }
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
@@ -108,12 +108,13 @@ class EmailHandler : public QObject
108{ 108{
109 Q_OBJECT 109 Q_OBJECT
110 110
111public: 111public:
112 EmailHandler(); 112 EmailHandler();
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);
115 void getMail(); 116 void getMail();
116 void getMailHeaders(); 117 void getMailHeaders();
117 void getMailByList(MailList *mailList); 118 void getMailByList(MailList *mailList);
118 bool parse(QString in, QString lineShift, Email *mail); 119 bool parse(QString in, QString lineShift, Email *mail);
119 bool getEnclosure(Enclosure *ePtr); 120 bool getEnclosure(Enclosure *ePtr);
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
@@ -15,12 +15,13 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21#include <qmessagebox.h>
21#include "mailitwindow.h" 22#include "mailitwindow.h"
22 23
23MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) 24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
24 : QMainWindow(parent, name, WStyle_ContextHelp) 25 : QMainWindow(parent, name, WStyle_ContextHelp)
25{ 26{
26 currentCaption = "Mailit"; 27 currentCaption = "Mailit";
@@ -57,14 +58,13 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
57 SLOT(deleteMail(EmailListItem *, bool &)) ); 58 SLOT(deleteMail(EmailListItem *, bool &)) );
58 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, 59 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
59 SLOT(moveMailFront(Email *)) ); 60 SLOT(moveMailFront(Email *)) );
60 61
61 connect(emailClient, SIGNAL(newCaption(const QString &)), 62 connect(emailClient, SIGNAL(newCaption(const QString &)),
62 this, SLOT(updateCaption(const QString &)) ); 63 this, SLOT(updateCaption(const QString &)) );
63 viewingMail = FALSE; 64 viewingMail = FALSE;
64
65} 65}
66 66
67MailItWindow::~MailItWindow() 67MailItWindow::~MailItWindow()
68{ 68{
69} 69}
70 70
@@ -81,12 +81,13 @@ void MailItWindow::compose()
81{ 81{
82 viewingMail = FALSE; 82 viewingMail = FALSE;
83 emailClient->hide(); 83 emailClient->hide();
84 readMail->hide(); 84 readMail->hide();
85 views->raiseWidget(writeMail); 85 views->raiseWidget(writeMail);
86 writeMail->setAddressList(emailClient->getAdrListRef()); 86 writeMail->setAddressList(emailClient->getAdrListRef());
87 writeMail->newMail();
87 setCaption( tr( "Write mail" ) ); 88 setCaption( tr( "Write mail" ) );
88} 89}
89 90
90void MailItWindow::composeReply(Email &mail, bool& replyAll) 91void MailItWindow::composeReply(Email &mail, bool& replyAll)
91{ 92{
92 compose(); 93 compose();
@@ -110,12 +111,33 @@ void MailItWindow::showEmailClient()
110} 111}
111 112
112void MailItWindow::viewMail(QListView *view, Email *mail) 113void MailItWindow::viewMail(QListView *view, Email *mail)
113{ 114{
114 viewingMail = TRUE; 115 viewingMail = TRUE;
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);
117 views->raiseWidget(readMail); 139 views->raiseWidget(readMail);
118 setCaption( tr( "Examine mail" ) ); 140 setCaption( tr( "Examine mail" ) );
119} 141}
120 142
121void MailItWindow::updateMailView(Email *mail) 143void MailItWindow::updateMailView(Email *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
@@ -57,13 +57,13 @@ void PopClient::newConnection(QString target, int port)
57 } 57 }
58 58
59 status = Init; 59 status = Init;
60 60
61 socket->connectToHost(target, port); 61 socket->connectToHost(target, port);
62 receiving = TRUE; 62 receiving = TRUE;
63 selected = FALSE; 63 //selected = FALSE;
64 64
65 emit updateStatus("DNS lookup"); 65 emit updateStatus("DNS lookup");
66} 66}
67 67
68void PopClient::setAccount(QString popUser, QString popPasswd) 68void PopClient::setAccount(QString popUser, QString popPasswd)
69{ 69{
@@ -181,19 +181,20 @@ void PopClient::incomingData()
181 //messages deleted from server, reload all 181 //messages deleted from server, reload all
182 if (newMessages < lastSync) 182 if (newMessages < lastSync)
183 lastSync = 0; 183 lastSync = 0;
184 messageCount = 1; 184 messageCount = 1;
185 } 185 }
186 186
187 if (selected) { 187 if (selected) {
188 int *ptr = mailList->first(); 188 int *ptr = mailList->first();
189 if (ptr != 0) { 189 if (ptr != 0) {
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);
195 } 196 }
196 //Read message number x, count upwards to messageCount 197 //Read message number x, count upwards to messageCount
197 case List: { 198 case List: {
198 if (messageCount <= newMessages) { 199 if (messageCount <= newMessages) {
199 *stream << "LIST " << messageCount << "\r\n"; 200 *stream << "LIST " << messageCount << "\r\n";
@@ -201,18 +202,18 @@ void PopClient::incomingData()
201 temp2.setNum(newMessages - lastSync); 202 temp2.setNum(newMessages - lastSync);
202 temp.setNum(messageCount - lastSync); 203 temp.setNum(messageCount - lastSync);
203 if (!selected) { 204 if (!selected) {
204 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 205 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
205 } else { 206 } else {
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 }
214 break; 215 break;
215 } else { 216 } else {
216 emit updateStatus(tr("No new Messages")); 217 emit updateStatus(tr("No new Messages"));
217 status = Quit; 218 status = Quit;
218 } 219 }
@@ -234,13 +235,13 @@ void PopClient::incomingData()
234 } 235 }
235 } 236 }
236 } 237 }
237 //Read message number x, count upwards to messageCount 238 //Read message number x, count upwards to messageCount
238 case Retr: { 239 case Retr: {
239 if (status != Quit) { 240 if (status != Quit) {
240 if (mailSize <= headerLimit) 241 if ((selected)||(mailSize <= headerLimit))
241 { 242 {
242 *stream << "RETR " << messageCount << "\r\n"; 243 *stream << "RETR " << messageCount << "\r\n";
243 } else { //only header 244 } else { //only header
244 *stream << "TOP " << messageCount << " 0\r\n"; 245 *stream << "TOP " << messageCount << " 0\r\n";
245 } 246 }
246 messageCount++; 247 messageCount++;
@@ -269,56 +270,42 @@ void PopClient::incomingData()
269 } 270 }
270 emit downloadedSize(message.length()); 271 emit downloadedSize(message.length());
271 int x = message.find("\r\n.\r\n",-5); 272 int x = message.find("\r\n.\r\n",-5);
272 if (x == -1) { 273 if (x == -1) {
273 break; 274 break;
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 {
279 emit newMessage(message, messageCount-1, mailSize, TRUE); 279 emit newMessage(message, messageCount-1, mailSize, TRUE);
280 } else { //incomplete mail downloaded 280 } else { //incomplete mail downloaded
281 emit newMessage(message, messageCount-1, mailSize, FALSE); 281 emit newMessage(message, messageCount-1, mailSize, FALSE);
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--;
303 status = Quit; 289 status = Quit;
304 } 290 }
305 } else { 291 }
292 else
293 {
306 *stream << "LIST " << messageCount << "\r\n"; 294 *stream << "LIST " << messageCount << "\r\n";
307 status = Size; 295 status = Size;
308 temp2.setNum(newMessages - lastSync); 296 temp2.setNum(newMessages - lastSync);
309 temp.setNum(messageCount - lastSync); 297 temp.setNum(messageCount - lastSync);
310 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 298 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
311 299
312 break; 300 break;
313 } 301 }
314 } 302 }
315 } 303 }
316 if (status != Quit) 304 if (status != Quit)
317 break; 305 break;
318 }
319 } 306 }
320 case Quit: { 307 case Quit: {
321 *stream << "Quit\r\n"; 308 *stream << "Quit\r\n";
322 status = Done; 309 status = Done;
323 int newM = newMessages - lastSync; 310 int newM = newMessages - lastSync;
324 if (newM > 0) { 311 if (newM > 0) {
@@ -333,35 +320,6 @@ void PopClient::incomingData()
333 emit mailTransfered(newM); 320 emit mailTransfered(newM);
334 break; 321 break;
335 } 322 }
336 } 323 }
337 324
338} 325}
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
@@ -120,22 +120,22 @@ void WriteMail::init()
120 grid->addWidget( addressButton, 0, 2 ); 120 grid->addWidget( addressButton, 0, 2 );
121 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); 121 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) );
122 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); 122 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook"));
123 123
124 emailInput = new QMultiLineEdit( widget, "emailInput" ); 124 emailInput = new QMultiLineEdit( widget, "emailInput" );
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
128 addressView = new QListView( widget, "addressView"); 128 addressView = new QListView( widget, "addressView");
129 addressView->addColumn("Name"); 129 addressView->addColumn("Name");
130 addressView->addColumn("EMail"); 130 addressView->addColumn("EMail");
131 addressView->setAllColumnsShowFocus(TRUE); 131 addressView->setAllColumnsShowFocus(TRUE);
132 addressView->setMultiSelection(TRUE); 132 addressView->setMultiSelection(TRUE);
133 addressView->hide(); 133 addressView->hide();
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
137 okButton = new QToolButton(bar, "ok"); 137 okButton = new QToolButton(bar, "ok");
138 okButton->setPixmap( Resource::loadPixmap("enter") ); 138 okButton->setPixmap( Resource::loadPixmap("enter") );
139 okButton->hide(); 139 okButton->hide();
140 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); 140 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) );
141 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); 141 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here"));
@@ -145,13 +145,12 @@ void WriteMail::init()
145 145
146void WriteMail::reject() 146void WriteMail::reject()
147{ 147{
148 emit cancelMail(); 148 emit cancelMail();
149} 149}
150 150
151// need to insert date
152void WriteMail::accept() 151void WriteMail::accept()
153{ 152{
154 QStringList attachedFiles, attachmentsType; 153 QStringList attachedFiles, attachmentsType;
155 int idCount = 0; 154 int idCount = 0;
156 155
157 if (toInput->text() == "") 156 if (toInput->text() == "")
@@ -249,19 +248,30 @@ void WriteMail::attachFile()
249 addAtt->showMaximized(); 248 addAtt->showMaximized();
250} 249}
251 250
252void WriteMail::reply(Email replyMail, bool replyAll) 251void WriteMail::reply(Email replyMail, bool replyAll)
253{ 252{
254 int pos; 253 int pos;
254 QString ccRecipients;
255 255
256 mail = replyMail; 256 mail = replyMail;
257 mail.files.clear(); 257 mail.files.clear();
258 258
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);
263 273
264 subjectInput->setText(tr("Re: ") + mail.subject); 274 subjectInput->setText(tr("Re: ") + mail.subject);
265 275
266 pos = 0; 276 pos = 0;
267 mail.body.insert(pos, ">"); 277 mail.body.insert(pos, ">");
@@ -318,29 +328,28 @@ bool WriteMail::getRecipients(bool ccField)
318 328
319 return TRUE; 329 return TRUE;
320} 330}
321 331
322void WriteMail::addRecipients() 332void WriteMail::addRecipients()
323{ 333{
324 334 toInput->isVisible() ? addRecipients(false) : addRecipients(true);
325 addRecipients(false);
326 } 335 }
327 336
328void WriteMail::addRecipients(bool ccField) 337void WriteMail::addRecipients(bool ccField)
329{ 338{
330 QString recipients = ""; 339 QString recipients = "";
331 340
332 mail.recipients.clear(); 341 mail.recipients.clear();
333 342
334 QListViewItem *item = addressView->firstChild(); 343 QListViewItem *item = addressView->firstChild();
335 while (item != NULL) { 344 while (item != NULL) {
336 if ( item->isSelected() ) { 345 if ( item->isSelected() ) {
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 }
342 } 351 }
343 item = item->nextSibling(); 352 item = item->nextSibling();
344 } 353 }
345 354
346 ccField ? ccInput->setText(recipients):toInput->setText(recipients); 355 ccField ? ccInput->setText(recipients):toInput->setText(recipients);
@@ -373,9 +382,8 @@ void WriteMail::setRecipient(const QString &recipient)
373 382
374void WriteMail::newMail() 383void WriteMail::newMail()
375{ 384{
376 toInput->clear(); 385 toInput->clear();
377 subjectInput->clear(); 386 subjectInput->clear();
378 emailInput->clear(); 387 emailInput->clear();
379 //to clear selected
380 setAddressList(addressList); 388 setAddressList(addressList);
381} 389}
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
@@ -359,13 +359,13 @@ void EmailClient::mailArrived(const Email &mail, bool fromDisk)
359 else 359 else
360 { //mail arrived from server 360 { //mail arrived from server
361 newMail.serverId = mail.serverId; 361 newMail.serverId = mail.serverId;
362 newMail.size = mail.size; 362 newMail.size = mail.size;
363 newMail.downloaded = mail.downloaded; 363 newMail.downloaded = mail.downloaded;
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);
367 } 367 }
368 368
369 //add if read or not 369 //add if read or not
370 newMail.read = mailconf->readBoolEntry("mailread"); 370 newMail.read = mailconf->readBoolEntry("mailread");
371 371
@@ -477,17 +477,17 @@ void EmailClient::allMailArrived(int count)
477 477
478 // all headers downloaded from server, start downloading remaining mails 478 // all headers downloaded from server, start downloading remaining mails
479 previewingMail = FALSE; 479 previewingMail = FALSE;
480 status1Label->setText(currentAccount->accountName); 480 status1Label->setText(currentAccount->accountName);
481 progressBar->reset(); 481 progressBar->reset();
482 482
483 //emailHandler->getMailByList(&mailDownloadList); 483
484
485 mailboxView->setCurrentTab(0); 484 mailboxView->setCurrentTab(0);
486} 485}
487 486
487
488void EmailClient::moveMailFront(Email *mailPtr) 488void EmailClient::moveMailFront(Email *mailPtr)
489{ 489{
490 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) { 490 if ( (receiving) && (mailPtr->fromAccountId == currentAccount->id) ) {
491 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size); 491 mailDownloadList.moveFront(mailPtr->serverId, mailPtr->size);
492 } 492 }
493} 493}
@@ -661,13 +661,13 @@ QString EmailClient::getPath(bool enclosurePath)
661 } 661 }
662 return (dir.path() + "/"); 662 return (dir.path() + "/");
663} 663}
664 664
665void EmailClient::readSettings() 665void EmailClient::readSettings()
666{ 666{
667 int y,acc_count, accountPos=0; 667 int y,acc_count;
668 668
669 mailconf->setGroup("mailitglobal"); 669 mailconf->setGroup("mailitglobal");
670 acc_count=mailconf->readNumEntry("Accounts",0); 670 acc_count=mailconf->readNumEntry("Accounts",0);
671 671
672 for (int accountPos = 0;accountPos<acc_count ; accountPos++) 672 for (int accountPos = 0;accountPos<acc_count ; accountPos++)
673 { 673 {
@@ -888,19 +888,27 @@ void EmailClient::setDownloadedSize(int size)
888 } 888 }
889} 889}
890 890
891void EmailClient::deleteItem() 891void EmailClient::deleteItem()
892{ 892{
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}
902 910
903void EmailClient::inboxItemPressed() 911void EmailClient::inboxItemPressed()
904{ 912{
905 //timerID=startTimer(500); 913 //timerID=startTimer(500);
906} 914}
@@ -936,46 +944,25 @@ Email* EmailClient::getCurrentMail()
936 if (eli!=NULL) 944 if (eli!=NULL)
937 return eli->getMail(); 945 return eli->getMail();
938 else 946 else
939 return NULL; 947 return NULL;
940} 948}
941 949
942/* 950void EmailClient::download(Email* mail)
943void EmailClient::reply()
944{
945 Email* mail=getCurrentMail();
946
947 if (mail!=NULL)
948 {
949 emit reply(*mail);
950 }
951}
952
953void EmailClient::replyAll()
954{
955 Email* mail=getCurrentMail();
956
957 if (mail!=NULL)
958 {
959 emit replyAll(*mail);
960 }
961}
962
963void 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
973void 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
@@ -67,12 +67,13 @@ class EmailClient : public QMainWindow
67 Q_OBJECT 67 Q_OBJECT
68 68
69public: 69public:
70 EmailClient( QWidget* parent, const char* name, WFlags fl = 0 ); 70 EmailClient( QWidget* parent, const char* name, WFlags fl = 0 );
71 ~EmailClient(); 71 ~EmailClient();
72 AddressList* getAdrListRef(); 72 AddressList* getAdrListRef();
73 void download(Email*);
73 74
74protected: 75protected:
75 void timerEvent(QTimerEvent*); 76 void timerEvent(QTimerEvent*);
76 77
77signals: 78signals:
78 void composeRequested(); 79 void composeRequested();
@@ -136,12 +137,14 @@ private:
136 137
137 EditAccount *editAccountView; 138 EditAccount *editAccountView;
138 EmailListItem *item; 139 EmailListItem *item;
139 EmailHandler *emailHandler; 140 EmailHandler *emailHandler;
140 QList<Email> quedMessages; 141 QList<Email> quedMessages;
141 MailList mailDownloadList; 142 MailList mailDownloadList;
143 MailList tempMailDownloadList;
144
142 bool sending, receiving, previewingMail, allAccounts; 145 bool sending, receiving, previewingMail, allAccounts;
143 QString lineShift; 146 QString lineShift;
144 MailAccount account, *currentAccount; 147 MailAccount account, *currentAccount;
145 148
146 QToolBar *bar; 149 QToolBar *bar;
147 QProgressBar *progressBar; 150 QProgressBar *progressBar;
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
@@ -124,24 +124,26 @@ void EmailHandler::getMailByList(MailList *mailList)
124 emit mailTransfered(0); 124 emit mailTransfered(0);
125 return; 125 return;
126 } 126 }
127 127
128 headers = FALSE; 128 headers = FALSE;
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
134void EmailHandler::messageArrived(const QString &message, int id, uint size, bool incomplete) 136void EmailHandler::messageArrived(const QString &message, int id, uint size, bool complete)
135{ 137{
136 Email mail; 138 Email mail;
137 139
138 mail.rawMail = message; 140 mail.rawMail = message;
139 mail.serverId = id; 141 mail.serverId = id;
140 mail.size = size; 142 mail.size = size;
141 mail.downloaded = incomplete; 143 mail.downloaded = complete;
142 144
143 emit mailArrived(mail, FALSE); 145 emit mailArrived(mail, FALSE);
144} 146}
145 147
146bool EmailHandler::parse(QString in, QString lineShift, Email *mail) 148bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
147{ 149{
@@ -179,19 +181,17 @@ bool EmailHandler::parse(QString in, QString lineShift, Email *mail)
179 mail->from = mail->from.stripWhiteSpace(); 181 mail->from = mail->from.stripWhiteSpace();
180 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) { 182 if ( (mail->from.length() > 2) && (mail->from[0] == '"') ) {
181 mail->from = mail->from.left(mail->from.length() - 1); 183 mail->from = mail->from.left(mail->from.length() - 1);
182 mail->from = mail->from.right(mail->from.length() - 1); 184 mail->from = mail->from.right(mail->from.length() - 1);
183 } 185 }
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);
193 if (mail->fromMail.at(mail->fromMail.length()-1) == '>') 193 if (mail->fromMail.at(mail->fromMail.length()-1) == '>')
194 mail->fromMail.truncate(mail->fromMail.length() - 1); 194 mail->fromMail.truncate(mail->fromMail.length() - 1);
195 mail->from=mail->fromMail; 195 mail->from=mail->fromMail;
196 } 196 }
197 } 197 }
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
@@ -108,12 +108,13 @@ class EmailHandler : public QObject
108{ 108{
109 Q_OBJECT 109 Q_OBJECT
110 110
111public: 111public:
112 EmailHandler(); 112 EmailHandler();
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);
115 void getMail(); 116 void getMail();
116 void getMailHeaders(); 117 void getMailHeaders();
117 void getMailByList(MailList *mailList); 118 void getMailByList(MailList *mailList);
118 bool parse(QString in, QString lineShift, Email *mail); 119 bool parse(QString in, QString lineShift, Email *mail);
119 bool getEnclosure(Enclosure *ePtr); 120 bool getEnclosure(Enclosure *ePtr);
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
@@ -15,12 +15,13 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21#include <qmessagebox.h>
21#include "mailitwindow.h" 22#include "mailitwindow.h"
22 23
23MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl) 24MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
24 : QMainWindow(parent, name, WStyle_ContextHelp) 25 : QMainWindow(parent, name, WStyle_ContextHelp)
25{ 26{
26 currentCaption = "Mailit"; 27 currentCaption = "Mailit";
@@ -57,14 +58,13 @@ MailItWindow::MailItWindow(QWidget *parent, const char *name, WFlags fl)
57 SLOT(deleteMail(EmailListItem *, bool &)) ); 58 SLOT(deleteMail(EmailListItem *, bool &)) );
58 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient, 59 connect(readMail, SIGNAL(viewingMail(Email *)), emailClient,
59 SLOT(moveMailFront(Email *)) ); 60 SLOT(moveMailFront(Email *)) );
60 61
61 connect(emailClient, SIGNAL(newCaption(const QString &)), 62 connect(emailClient, SIGNAL(newCaption(const QString &)),
62 this, SLOT(updateCaption(const QString &)) ); 63 this, SLOT(updateCaption(const QString &)) );
63 viewingMail = FALSE; 64 viewingMail = FALSE;
64
65} 65}
66 66
67MailItWindow::~MailItWindow() 67MailItWindow::~MailItWindow()
68{ 68{
69} 69}
70 70
@@ -81,12 +81,13 @@ void MailItWindow::compose()
81{ 81{
82 viewingMail = FALSE; 82 viewingMail = FALSE;
83 emailClient->hide(); 83 emailClient->hide();
84 readMail->hide(); 84 readMail->hide();
85 views->raiseWidget(writeMail); 85 views->raiseWidget(writeMail);
86 writeMail->setAddressList(emailClient->getAdrListRef()); 86 writeMail->setAddressList(emailClient->getAdrListRef());
87 writeMail->newMail();
87 setCaption( tr( "Write mail" ) ); 88 setCaption( tr( "Write mail" ) );
88} 89}
89 90
90void MailItWindow::composeReply(Email &mail, bool& replyAll) 91void MailItWindow::composeReply(Email &mail, bool& replyAll)
91{ 92{
92 compose(); 93 compose();
@@ -110,12 +111,33 @@ void MailItWindow::showEmailClient()
110} 111}
111 112
112void MailItWindow::viewMail(QListView *view, Email *mail) 113void MailItWindow::viewMail(QListView *view, Email *mail)
113{ 114{
114 viewingMail = TRUE; 115 viewingMail = TRUE;
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);
117 views->raiseWidget(readMail); 139 views->raiseWidget(readMail);
118 setCaption( tr( "Examine mail" ) ); 140 setCaption( tr( "Examine mail" ) );
119} 141}
120 142
121void MailItWindow::updateMailView(Email *mail) 143void MailItWindow::updateMailView(Email *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
@@ -57,13 +57,13 @@ void PopClient::newConnection(QString target, int port)
57 } 57 }
58 58
59 status = Init; 59 status = Init;
60 60
61 socket->connectToHost(target, port); 61 socket->connectToHost(target, port);
62 receiving = TRUE; 62 receiving = TRUE;
63 selected = FALSE; 63 //selected = FALSE;
64 64
65 emit updateStatus("DNS lookup"); 65 emit updateStatus("DNS lookup");
66} 66}
67 67
68void PopClient::setAccount(QString popUser, QString popPasswd) 68void PopClient::setAccount(QString popUser, QString popPasswd)
69{ 69{
@@ -181,19 +181,20 @@ void PopClient::incomingData()
181 //messages deleted from server, reload all 181 //messages deleted from server, reload all
182 if (newMessages < lastSync) 182 if (newMessages < lastSync)
183 lastSync = 0; 183 lastSync = 0;
184 messageCount = 1; 184 messageCount = 1;
185 } 185 }
186 186
187 if (selected) { 187 if (selected) {
188 int *ptr = mailList->first(); 188 int *ptr = mailList->first();
189 if (ptr != 0) { 189 if (ptr != 0) {
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);
195 } 196 }
196 //Read message number x, count upwards to messageCount 197 //Read message number x, count upwards to messageCount
197 case List: { 198 case List: {
198 if (messageCount <= newMessages) { 199 if (messageCount <= newMessages) {
199 *stream << "LIST " << messageCount << "\r\n"; 200 *stream << "LIST " << messageCount << "\r\n";
@@ -201,18 +202,18 @@ void PopClient::incomingData()
201 temp2.setNum(newMessages - lastSync); 202 temp2.setNum(newMessages - lastSync);
202 temp.setNum(messageCount - lastSync); 203 temp.setNum(messageCount - lastSync);
203 if (!selected) { 204 if (!selected) {
204 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 205 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
205 } else { 206 } else {
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 }
214 break; 215 break;
215 } else { 216 } else {
216 emit updateStatus(tr("No new Messages")); 217 emit updateStatus(tr("No new Messages"));
217 status = Quit; 218 status = Quit;
218 } 219 }
@@ -234,13 +235,13 @@ void PopClient::incomingData()
234 } 235 }
235 } 236 }
236 } 237 }
237 //Read message number x, count upwards to messageCount 238 //Read message number x, count upwards to messageCount
238 case Retr: { 239 case Retr: {
239 if (status != Quit) { 240 if (status != Quit) {
240 if (mailSize <= headerLimit) 241 if ((selected)||(mailSize <= headerLimit))
241 { 242 {
242 *stream << "RETR " << messageCount << "\r\n"; 243 *stream << "RETR " << messageCount << "\r\n";
243 } else { //only header 244 } else { //only header
244 *stream << "TOP " << messageCount << " 0\r\n"; 245 *stream << "TOP " << messageCount << " 0\r\n";
245 } 246 }
246 messageCount++; 247 messageCount++;
@@ -269,56 +270,42 @@ void PopClient::incomingData()
269 } 270 }
270 emit downloadedSize(message.length()); 271 emit downloadedSize(message.length());
271 int x = message.find("\r\n.\r\n",-5); 272 int x = message.find("\r\n.\r\n",-5);
272 if (x == -1) { 273 if (x == -1) {
273 break; 274 break;
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 {
279 emit newMessage(message, messageCount-1, mailSize, TRUE); 279 emit newMessage(message, messageCount-1, mailSize, TRUE);
280 } else { //incomplete mail downloaded 280 } else { //incomplete mail downloaded
281 emit newMessage(message, messageCount-1, mailSize, FALSE); 281 emit newMessage(message, messageCount-1, mailSize, FALSE);
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--;
303 status = Quit; 289 status = Quit;
304 } 290 }
305 } else { 291 }
292 else
293 {
306 *stream << "LIST " << messageCount << "\r\n"; 294 *stream << "LIST " << messageCount << "\r\n";
307 status = Size; 295 status = Size;
308 temp2.setNum(newMessages - lastSync); 296 temp2.setNum(newMessages - lastSync);
309 temp.setNum(messageCount - lastSync); 297 temp.setNum(messageCount - lastSync);
310 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); 298 emit updateStatus(tr("Retrieving ") + temp + "/" + temp2);
311 299
312 break; 300 break;
313 } 301 }
314 } 302 }
315 } 303 }
316 if (status != Quit) 304 if (status != Quit)
317 break; 305 break;
318 }
319 } 306 }
320 case Quit: { 307 case Quit: {
321 *stream << "Quit\r\n"; 308 *stream << "Quit\r\n";
322 status = Done; 309 status = Done;
323 int newM = newMessages - lastSync; 310 int newM = newMessages - lastSync;
324 if (newM > 0) { 311 if (newM > 0) {
@@ -333,35 +320,6 @@ void PopClient::incomingData()
333 emit mailTransfered(newM); 320 emit mailTransfered(newM);
334 break; 321 break;
335 } 322 }
336 } 323 }
337 324
338} 325}
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
@@ -120,22 +120,22 @@ void WriteMail::init()
120 grid->addWidget( addressButton, 0, 2 ); 120 grid->addWidget( addressButton, 0, 2 );
121 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) ); 121 connect(addressButton, SIGNAL(clicked()), this, SLOT(getAddress()) );
122 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook")); 122 QWhatsThis::add(addressButton,QWidget::tr("This button opens the address selector with all mail adresses from your OPIE addressbook"));
123 123
124 emailInput = new QMultiLineEdit( widget, "emailInput" ); 124 emailInput = new QMultiLineEdit( widget, "emailInput" );
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
128 addressView = new QListView( widget, "addressView"); 128 addressView = new QListView( widget, "addressView");
129 addressView->addColumn("Name"); 129 addressView->addColumn("Name");
130 addressView->addColumn("EMail"); 130 addressView->addColumn("EMail");
131 addressView->setAllColumnsShowFocus(TRUE); 131 addressView->setAllColumnsShowFocus(TRUE);
132 addressView->setMultiSelection(TRUE); 132 addressView->setMultiSelection(TRUE);
133 addressView->hide(); 133 addressView->hide();
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
137 okButton = new QToolButton(bar, "ok"); 137 okButton = new QToolButton(bar, "ok");
138 okButton->setPixmap( Resource::loadPixmap("enter") ); 138 okButton->setPixmap( Resource::loadPixmap("enter") );
139 okButton->hide(); 139 okButton->hide();
140 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) ); 140 connect(okButton, SIGNAL(clicked()), this, SLOT(addRecipients()) );
141 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here")); 141 QWhatsThis::add(okButton,QWidget::tr("Queue your mail by clicking here"));
@@ -145,13 +145,12 @@ void WriteMail::init()
145 145
146void WriteMail::reject() 146void WriteMail::reject()
147{ 147{
148 emit cancelMail(); 148 emit cancelMail();
149} 149}
150 150
151// need to insert date
152void WriteMail::accept() 151void WriteMail::accept()
153{ 152{
154 QStringList attachedFiles, attachmentsType; 153 QStringList attachedFiles, attachmentsType;
155 int idCount = 0; 154 int idCount = 0;
156 155
157 if (toInput->text() == "") 156 if (toInput->text() == "")
@@ -249,19 +248,30 @@ void WriteMail::attachFile()
249 addAtt->showMaximized(); 248 addAtt->showMaximized();
250} 249}
251 250
252void WriteMail::reply(Email replyMail, bool replyAll) 251void WriteMail::reply(Email replyMail, bool replyAll)
253{ 252{
254 int pos; 253 int pos;
254 QString ccRecipients;
255 255
256 mail = replyMail; 256 mail = replyMail;
257 mail.files.clear(); 257 mail.files.clear();
258 258
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);
263 273
264 subjectInput->setText(tr("Re: ") + mail.subject); 274 subjectInput->setText(tr("Re: ") + mail.subject);
265 275
266 pos = 0; 276 pos = 0;
267 mail.body.insert(pos, ">"); 277 mail.body.insert(pos, ">");
@@ -318,29 +328,28 @@ bool WriteMail::getRecipients(bool ccField)
318 328
319 return TRUE; 329 return TRUE;
320} 330}
321 331
322void WriteMail::addRecipients() 332void WriteMail::addRecipients()
323{ 333{
324 334 toInput->isVisible() ? addRecipients(false) : addRecipients(true);
325 addRecipients(false);
326 } 335 }
327 336
328void WriteMail::addRecipients(bool ccField) 337void WriteMail::addRecipients(bool ccField)
329{ 338{
330 QString recipients = ""; 339 QString recipients = "";
331 340
332 mail.recipients.clear(); 341 mail.recipients.clear();
333 342
334 QListViewItem *item = addressView->firstChild(); 343 QListViewItem *item = addressView->firstChild();
335 while (item != NULL) { 344 while (item != NULL) {
336 if ( item->isSelected() ) { 345 if ( item->isSelected() ) {
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 }
342 } 351 }
343 item = item->nextSibling(); 352 item = item->nextSibling();
344 } 353 }
345 354
346 ccField ? ccInput->setText(recipients):toInput->setText(recipients); 355 ccField ? ccInput->setText(recipients):toInput->setText(recipients);
@@ -373,9 +382,8 @@ void WriteMail::setRecipient(const QString &recipient)
373 382
374void WriteMail::newMail() 383void WriteMail::newMail()
375{ 384{
376 toInput->clear(); 385 toInput->clear();
377 subjectInput->clear(); 386 subjectInput->clear();
378 emailInput->clear(); 387 emailInput->clear();
379 //to clear selected
380 setAddressList(addressList); 388 setAddressList(addressList);
381} 389}