summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/accountview.cpp15
-rw-r--r--noncore/net/mail/editaccounts.cpp4
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp13
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp20
-rw-r--r--noncore/net/mail/libmailwrapper/mhwrapper.cpp0
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp9
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp29
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h7
-rw-r--r--noncore/net/mail/pop3configui.ui68
10 files changed, 140 insertions, 27 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp
index 662e555..0fe8475 100644
--- a/noncore/net/mail/accountview.cpp
+++ b/noncore/net/mail/accountview.cpp
@@ -54,45 +54,40 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int)
54} 54}
55 55
56void AccountView::populate( QList<Account> list ) 56void AccountView::populate( QList<Account> list )
57{ 57{
58 clear(); 58 clear();
59 59
60 imapAccounts.clear(); 60 imapAccounts.clear();
61 mhAccounts.clear(); 61 mhAccounts.clear();
62 62
63 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); 63 mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this));
64 64
65 Account *it; 65 Account *it;
66 for ( it = list.first(); it; it = list.next() ) 66 for ( it = list.first(); it; it = list.next() ) {
67 { 67 if ( it->getType() == MAILLIB::A_IMAP ) {
68 if ( it->getType() == MAILLIB::A_IMAP )
69 {
70 IMAPaccount *imap = static_cast<IMAPaccount *>(it); 68 IMAPaccount *imap = static_cast<IMAPaccount *>(it);
71 odebug << "added IMAP " + imap->getAccountName() << oendl; 69 odebug << "added IMAP " + imap->getAccountName() << oendl;
72 imapAccounts.append(new IMAPviewItem( imap, this )); 70 imapAccounts.append(new IMAPviewItem( imap, this ));
73 } 71 } else if ( it->getType() == MAILLIB::A_POP3 ) {
74 else if ( it->getType() == MAILLIB::A_POP3 )
75 {
76 POP3account *pop3 = static_cast<POP3account *>(it); 72 POP3account *pop3 = static_cast<POP3account *>(it);
77 odebug << "added POP3 " + pop3->getAccountName() << oendl; 73 odebug << "added POP3 " + pop3->getAccountName() << oendl;
78 /* must not be hold 'cause it isn't required */ 74 /* must not be hold 'cause it isn't required */
79 (void) new POP3viewItem( pop3, this ); 75 (void) new POP3viewItem( pop3, this );
80 } 76 } else if ( it->getType() == MAILLIB::A_NNTP ) {
81 else if ( it->getType() == MAILLIB::A_NNTP )
82 {
83 NNTPaccount *nntp = static_cast<NNTPaccount *>(it); 77 NNTPaccount *nntp = static_cast<NNTPaccount *>(it);
84 odebug << "added NNTP " + nntp->getAccountName() << oendl; 78 odebug << "added NNTP " + nntp->getAccountName() << oendl;
85 /* must not be hold 'cause it isn't required */ 79 /* must not be hold 'cause it isn't required */
86 (void) new NNTPviewItem( nntp, this ); 80 (void) new NNTPviewItem( nntp, this );
81 } else if ( it->getType() == MAILLIB::A_MH ) {
87 } 82 }
88 } 83 }
89} 84}
90 85
91void AccountView::refresh(QListViewItem *item) 86void AccountView::refresh(QListViewItem *item)
92{ 87{
93 88
94 odebug << "AccountView refresh..." << oendl; 89 odebug << "AccountView refresh..." << oendl;
95 if ( item ) 90 if ( item )
96 { 91 {
97 m_currentItem = item; 92 m_currentItem = item;
98 QValueList<RecMailP> headerlist; 93 QValueList<RecMailP> headerlist;
diff --git a/noncore/net/mail/editaccounts.cpp b/noncore/net/mail/editaccounts.cpp
index b0ce57d..b7c137d 100644
--- a/noncore/net/mail/editaccounts.cpp
+++ b/noncore/net/mail/editaccounts.cpp
@@ -413,34 +413,38 @@ void POP3config::slotConnectionToggle( int index )
413 portLine->setText( POP3_PORT ); 413 portLine->setText( POP3_PORT );
414 } 414 }
415} 415}
416 416
417void POP3config::fillValues() 417void POP3config::fillValues()
418{ 418{
419 accountLine->setText( data->getAccountName() ); 419 accountLine->setText( data->getAccountName() );
420 serverLine->setText( data->getServer() ); 420 serverLine->setText( data->getServer() );
421 portLine->setText( data->getPort() ); 421 portLine->setText( data->getPort() );
422 ComboBox1->setCurrentItem( data->ConnectionType() ); 422 ComboBox1->setCurrentItem( data->ConnectionType() );
423 userLine->setText( data->getUser() ); 423 userLine->setText( data->getUser() );
424 passLine->setText( data->getPassword() ); 424 passLine->setText( data->getPassword() );
425 m_CheckSize->setChecked(data->getCheckMaxSize());
426 m_MailLimitBox->setValue(data->getMaxSize());
425} 427}
426 428
427void POP3config::accept() 429void POP3config::accept()
428{ 430{
429 data->setAccountName( accountLine->text() ); 431 data->setAccountName( accountLine->text() );
430 data->setServer( serverLine->text() ); 432 data->setServer( serverLine->text() );
431 data->setPort( portLine->text() ); 433 data->setPort( portLine->text() );
432 data->setConnectionType( ComboBox1->currentItem() ); 434 data->setConnectionType( ComboBox1->currentItem() );
433 data->setUser( userLine->text() ); 435 data->setUser( userLine->text() );
434 data->setPassword( passLine->text() ); 436 data->setPassword( passLine->text() );
437 data->setMaxSize(m_MailLimitBox->value());
438 data->setCheckMaxSize(m_CheckSize->isChecked());
435 439
436 QDialog::accept(); 440 QDialog::accept();
437} 441}
438 442
439/** 443/**
440 * SMTPconfig 444 * SMTPconfig
441 */ 445 */
442 446
443SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 447SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
444 : SMTPconfigUI( parent, name, modal, flags ) 448 : SMTPconfigUI( parent, name, modal, flags )
445{ 449{
446 data = account; 450 data = account;
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index 1caa375..5ec9415 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -1,17 +1,19 @@
1#include "genericwrapper.h" 1#include "genericwrapper.h"
2#include <libetpan/libetpan.h> 2#include <libetpan/libetpan.h>
3#include "mailtypes.h" 3#include "mailtypes.h"
4 4
5#include <opie2/odebug.h> 5#include <opie2/odebug.h>
6#include <qpe/timestring.h>
7#include <qdatetime.h>
6 8
7using namespace Opie::Core; 9using namespace Opie::Core;
8Genericwrapper::Genericwrapper() 10Genericwrapper::Genericwrapper()
9 : AbstractMail() 11 : AbstractMail()
10{ 12{
11 bodyCache.clear(); 13 bodyCache.clear();
12 m_storage = 0; 14 m_storage = 0;
13 m_folder = 0; 15 m_folder = 0;
14} 16}
15 17
16Genericwrapper::~Genericwrapper() 18Genericwrapper::~Genericwrapper()
17{ 19{
@@ -234,30 +236,29 @@ RecBodyP Genericwrapper::parseMail( mailmessage * msg )
234 /* is bound to msg and will be freed there */ 236 /* is bound to msg and will be freed there */
235 mailmime * mime=0; 237 mailmime * mime=0;
236 RecBodyP body = new RecBody(); 238 RecBodyP body = new RecBody();
237 memset(&fields, 0, sizeof(struct mailmime_single_fields)); 239 memset(&fields, 0, sizeof(struct mailmime_single_fields));
238 err = mailmessage_get_bodystructure(msg,&mime); 240 err = mailmessage_get_bodystructure(msg,&mime);
239 QValueList<int>recList; 241 QValueList<int>recList;
240 traverseBody(body,msg,mime,recList); 242 traverseBody(body,msg,mime,recList);
241 return body; 243 return body;
242} 244}
243 245
244QString Genericwrapper::parseDateTime( mailimf_date_time *date ) 246QString Genericwrapper::parseDateTime( mailimf_date_time *date )
245{ 247{
246 char tmp[23]; 248 QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
247 249 QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
248 snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", 250 timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
249 date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 251 timestring.sprintf(timestring+" %+05i",date->dt_zone);
250 252 return timestring;
251 return QString( tmp );
252} 253}
253 254
254QString Genericwrapper::parseAddressList( mailimf_address_list *list ) 255QString Genericwrapper::parseAddressList( mailimf_address_list *list )
255{ 256{
256 QString result( "" ); 257 QString result( "" );
257 258
258 bool first = true; 259 bool first = true;
259 if (list == 0) return result; 260 if (list == 0) return result;
260 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { 261 for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) {
261 mailimf_address *addr = (mailimf_address *) current->data; 262 mailimf_address *addr = (mailimf_address *) current->data;
262 263
263 if ( !first ) { 264 if ( !first ) {
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 9b7c0e0..fe75a15 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -228,30 +228,34 @@ void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSma
228 } 228 }
229 229
230 int last = m_imap->imap_selection_info->sel_exists; 230 int last = m_imap->imap_selection_info->sel_exists;
231 231
232 if (last == 0) { 232 if (last == 0) {
233 Global::statusMessage(tr("Mailbox has no mails")); 233 Global::statusMessage(tr("Mailbox has no mails"));
234 return; 234 return;
235 } else { 235 } else {
236 } 236 }
237 237
238 /* the range has to start at 1!!! not with 0!!!! */ 238 /* the range has to start at 1!!! not with 0!!!! */
239 set = mailimap_set_new_interval( 1, last ); 239 set = mailimap_set_new_interval( 1, last );
240
241
242 fetchType = mailimap_fetch_type_new_all();
243/*
240 fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); 244 fetchType = mailimap_fetch_type_new_fetch_att_list_empty();
241 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); 245 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope());
242 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); 246 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags());
243 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); 247 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate());
244 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); 248 mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size());
245 249*/
246 err = mailimap_fetch( m_imap, set, fetchType, &result ); 250 err = mailimap_fetch( m_imap, set, fetchType, &result );
247 mailimap_set_free( set ); 251 mailimap_set_free( set );
248 mailimap_fetch_type_free( fetchType ); 252 mailimap_fetch_type_free( fetchType );
249 253
250 QString date,subject,from; 254 QString date,subject,from;
251 255
252 if ( err == MAILIMAP_NO_ERROR ) { 256 if ( err == MAILIMAP_NO_ERROR ) {
253 mailimap_msg_att * msg_att; 257 mailimap_msg_att * msg_att;
254 int i = 0; 258 int i = 0;
255 for (current = clist_begin(result); current != 0; current=clist_next(current)) { 259 for (current = clist_begin(result); current != 0; current=clist_next(current)) {
256 ++i; 260 ++i;
257 msg_att = (mailimap_msg_att*)current->data; 261 msg_att = (mailimap_msg_att*)current->data;
@@ -366,28 +370,28 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
366 RecMail * m = 0; 370 RecMail * m = 0;
367 mailimap_msg_att_item *item=0; 371 mailimap_msg_att_item *item=0;
368 clistcell *current,*c,*cf; 372 clistcell *current,*c,*cf;
369 mailimap_msg_att_dynamic*flist; 373 mailimap_msg_att_dynamic*flist;
370 mailimap_flag_fetch*cflag; 374 mailimap_flag_fetch*cflag;
371 int size; 375 int size;
372 QBitArray mFlags(7); 376 QBitArray mFlags(7);
373 QStringList addresslist; 377 QStringList addresslist;
374 378
375 if (!m_att) { 379 if (!m_att) {
376 return m; 380 return m;
377 } 381 }
382 size = 0;
378 m = new RecMail(); 383 m = new RecMail();
379 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { 384 for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) {
380 current = c; 385 current = c;
381 size = 0;
382 item = (mailimap_msg_att_item*)current->data; 386 item = (mailimap_msg_att_item*)current->data;
383 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { 387 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
384 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; 388 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
385 if (!flist->att_list) { 389 if (!flist->att_list) {
386 continue; 390 continue;
387 } 391 }
388 cf = flist->att_list->first; 392 cf = flist->att_list->first;
389 for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { 393 for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) {
390 cflag = (mailimap_flag_fetch*)cf->data; 394 cflag = (mailimap_flag_fetch*)cf->data;
391 if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { 395 if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
392 switch (cflag->fl_flag->fl_type) { 396 switch (cflag->fl_flag->fl_type) {
393 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ 397 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
@@ -456,41 +460,47 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
456 while (h.length()>0 && h[h.length()-1]=='>') { 460 while (h.length()>0 && h[h.length()-1]=='>') {
457 h.remove(h.length()-1,1); 461 h.remove(h.length()-1,1);
458 } 462 }
459 if (h.length()>0) { 463 if (h.length()>0) {
460 m->setInreply(QStringList(h)); 464 m->setInreply(QStringList(h));
461 } 465 }
462 } 466 }
463 if (head->env_message_id) { 467 if (head->env_message_id) {
464 m->setMsgid(QString(head->env_message_id)); 468 m->setMsgid(QString(head->env_message_id));
465 } 469 }
466 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { 470 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
467#if 0 471#if 0
468 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; 472 mailimap_date_time*date = item->att_data.att_static->att_data.att_internal_date;
473 if (date->dt_sec>60 || date->dt_sec<0) date->dt_sec=0;
474 //QDateTime da(QDate(d->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
475 QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
476 timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
477 timestring.sprintf(timestring+" %+05i",date->dt_zone);
478 m->setDate(timestring);
469 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); 479 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
470 odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl; 480 odebug << "" << d->dt_year << " " << d->dt_month << " " << d->dt_day << " - " << d->dt_hour << " " << d->dt_min << " " << d->dt_sec << "" << oendl;
471 odebug << da.toString() << oendl; 481 odebug << da.toString() << oendl;
472#endif 482#endif
473 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { 483 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) {
474 size = item->att_data.att_static->att_data.att_rfc822_size; 484 //size = item->att_data.att_static->att_data.att_rfc822_size;
485 m->setMsgsize(item->att_data.att_static->att_data.att_rfc822_size);
475 } 486 }
476 } 487 }
477 /* msg is already deleted */ 488 /* msg is already deleted */
478 if (mFlags.testBit(FLAG_DELETED) && m) { 489 if (mFlags.testBit(FLAG_DELETED) && m) {
479 delete m; 490 delete m;
480 m = 0; 491 m = 0;
481 } 492 }
482 if (m) { 493 if (m) {
483 m->setFlags(mFlags); 494 m->setFlags(mFlags);
484 m->setMsgsize(size);
485 } 495 }
486 return m; 496 return m;
487} 497}
488 498
489RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) 499RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail)
490{ 500{
491 RecBodyP body = new RecBody(); 501 RecBodyP body = new RecBody();
492 const char *mb; 502 const char *mb;
493 int err = MAILIMAP_NO_ERROR; 503 int err = MAILIMAP_NO_ERROR;
494 clist *result = 0; 504 clist *result = 0;
495 clistcell *current; 505 clistcell *current;
496 mailimap_fetch_att *fetchAtt = 0; 506 mailimap_fetch_att *fetchAtt = 0;
diff --git a/noncore/net/mail/libmailwrapper/mhwrapper.cpp b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
index 403afcf..765a21c 100644
--- a/noncore/net/mail/libmailwrapper/mhwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/mhwrapper.cpp
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 3cfd1ee..2d66fc9 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -1,32 +1,35 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include "pop3wrapper.h" 2#include "pop3wrapper.h"
3#include "mailtypes.h" 3#include "mailtypes.h"
4#include "logindialog.h" 4#include "logindialog.h"
5#include <libetpan/libetpan.h> 5#include <libetpan/libetpan.h>
6 6
7#include <opie2/odebug.h> 7#include <opie2/odebug.h>
8#include <qpe/global.h> 8#include <qpe/global.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qmessagebox.h>
10 11
11/* we don't fetch messages larger than 5 MB */ 12/* we don't fetch messages larger than 5 MB */
12#define HARD_MSG_SIZE_LIMIT 5242880 13#define HARD_MSG_SIZE_LIMIT 5242880
13 14
14using namespace Opie::Core; 15using namespace Opie::Core;
15POP3wrapper::POP3wrapper( POP3account *a ) 16POP3wrapper::POP3wrapper( POP3account *a )
16: Genericwrapper() { 17: Genericwrapper() {
17 account = a; 18 account = a;
18 m_pop3 = NULL; 19 m_pop3 = NULL;
19 msgTempName = a->getFileName()+"_msg_cache"; 20 msgTempName = a->getFileName()+"_msg_cache";
20 last_msg_id = 0; 21 last_msg_id = 0;
22 m_maxsize = account->getMaxSize();
23 m_checksize = account->getCheckMaxSize();
21} 24}
22 25
23POP3wrapper::~POP3wrapper() { 26POP3wrapper::~POP3wrapper() {
24 logout(); 27 logout();
25 QFile msg_cache(msgTempName); 28 QFile msg_cache(msgTempName);
26 if (msg_cache.exists()) { 29 if (msg_cache.exists()) {
27 msg_cache.remove(); 30 msg_cache.remove();
28 } 31 }
29} 32}
30 33
31void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 34void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
32 odebug << "POP3: " << current << " of " << maximum << "" << oendl; 35 odebug << "POP3: " << current << " of " << maximum << "" << oendl;
@@ -36,26 +39,30 @@ RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
36 int err = MAILPOP3_NO_ERROR; 39 int err = MAILPOP3_NO_ERROR;
37 char *message = 0; 40 char *message = 0;
38 size_t length = 0; 41 size_t length = 0;
39 42
40 RecBodyP body = new RecBody(); 43 RecBodyP body = new RecBody();
41 44
42 login(); 45 login();
43 if ( !m_pop3 ) { 46 if ( !m_pop3 ) {
44 return body; 47 return body;
45 } 48 }
46 49
47 mailmessage * mailmsg; 50 mailmessage * mailmsg;
48 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 51 if (mail->Msgsize()/1024>m_maxsize && m_checksize && mail->getNumber()!=last_msg_id) {
52 QString quest = QString(tr("Download mail?\nIt is %1 kByte but your limit is %2 kByte")).arg(mail->Msgsize()/1024).arg(m_maxsize);
53 int yesno = QMessageBox::warning(0,tr("Download message"),
54 quest,tr("Yes"),tr("No"),QString::null,0,1);
49 odebug << "Message to large: " << mail->Msgsize() << "" << oendl; 55 odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
56 if (yesno==1)
50 return body; 57 return body;
51 } 58 }
52 59
53 QFile msg_cache(msgTempName); 60 QFile msg_cache(msgTempName);
54 61
55 cleanMimeCache(); 62 cleanMimeCache();
56 63
57 if (mail->getNumber()!=last_msg_id) { 64 if (mail->getNumber()!=last_msg_id) {
58 if (msg_cache.exists()) { 65 if (msg_cache.exists()) {
59 msg_cache.remove(); 66 msg_cache.remove();
60 } 67 }
61 msg_cache.open(IO_ReadWrite|IO_Truncate); 68 msg_cache.open(IO_ReadWrite|IO_Truncate);
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h
index 5101fa5..8c36cf9 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.h
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h
@@ -28,15 +28,17 @@ public:
28 28
29 virtual RecBodyP fetchBody( const RecMailP &mail ); 29 virtual RecBodyP fetchBody( const RecMailP &mail );
30 virtual encodedString* fetchRawBody(const RecMailP&mail); 30 virtual encodedString* fetchRawBody(const RecMailP&mail);
31 virtual void logout(); 31 virtual void logout();
32 virtual MAILLIB::ATYPE getType()const; 32 virtual MAILLIB::ATYPE getType()const;
33 virtual const QString&getName()const; 33 virtual const QString&getName()const;
34 static void pop3_progress( size_t current, size_t maximum ); 34 static void pop3_progress( size_t current, size_t maximum );
35 35
36protected: 36protected:
37 void login(); 37 void login();
38 POP3account *account; 38 POP3account *account;
39 mailstorage*m_pop3; 39 mailstorage*m_pop3;
40 int m_maxsize;
41 bool m_checksize;
40}; 42};
41 43
42#endif 44#endif
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index 3c9b25c..09be91b 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -7,25 +7,24 @@
7#include "settings.h" 7#include "settings.h"
8//#include "defines.h" 8//#include "defines.h"
9 9
10#define IMAP_PORT "143" 10#define IMAP_PORT "143"
11#define IMAP_SSL_PORT "993" 11#define IMAP_SSL_PORT "993"
12#define SMTP_PORT "25" 12#define SMTP_PORT "25"
13#define SMTP_SSL_PORT "465" 13#define SMTP_SSL_PORT "465"
14#define POP3_PORT "110" 14#define POP3_PORT "110"
15#define POP3_SSL_PORT "995" 15#define POP3_SSL_PORT "995"
16#define NNTP_PORT "119" 16#define NNTP_PORT "119"
17#define NNTP_SSL_PORT "563" 17#define NNTP_SSL_PORT "563"
18 18
19
20Settings::Settings() 19Settings::Settings()
21 : QObject() 20 : QObject()
22{ 21{
23 updateAccounts(); 22 updateAccounts();
24} 23}
25 24
26void Settings::checkDirectory() 25void Settings::checkDirectory()
27{ 26{
28 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { 27 if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) {
29 system( "mkdir -p $HOME/Applications/opiemail" ); 28 system( "mkdir -p $HOME/Applications/opiemail" );
30 odebug << "$HOME/Applications/opiemail created" << oendl; 29 odebug << "$HOME/Applications/opiemail created" << oendl;
31 } 30 }
@@ -204,35 +203,39 @@ QString IMAPaccount::getFileName()
204 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; 203 return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file;
205} 204}
206 205
207POP3account::POP3account() 206POP3account::POP3account()
208 : Account() 207 : Account()
209{ 208{
210 file = POP3account::getUniqueFileName(); 209 file = POP3account::getUniqueFileName();
211 accountName = "New POP3 Account"; 210 accountName = "New POP3 Account";
212 ssl = false; 211 ssl = false;
213 connectionType = 1; 212 connectionType = 1;
214 type = MAILLIB::A_POP3; 213 type = MAILLIB::A_POP3;
215 port = POP3_PORT; 214 port = POP3_PORT;
215 m_CheckSize = true;
216 m_MaxSize = 1024;
216} 217}
217 218
218POP3account::POP3account( QString filename ) 219POP3account::POP3account( QString filename )
219 : Account() 220 : Account()
220{ 221{
221 file = filename; 222 file = filename;
222 accountName = "New POP3 Account"; 223 accountName = "New POP3 Account";
223 ssl = false; 224 ssl = false;
224 connectionType = 1; 225 connectionType = 1;
225 type = MAILLIB::A_POP3; 226 type = MAILLIB::A_POP3;
226 port = POP3_PORT; 227 port = POP3_PORT;
228 m_CheckSize = true;
229 m_MaxSize = 1024;
227} 230}
228 231
229QString POP3account::getUniqueFileName() 232QString POP3account::getUniqueFileName()
230{ 233{
231 int num = 0; 234 int num = 0;
232 QString unique; 235 QString unique;
233 236
234 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" ); 237 QDir dir( (QString) getenv( "HOME" ) + "/Applications/opiemail" );
235 238
236 QStringList imap = dir.entryList( "pop3-*" ); 239 QStringList imap = dir.entryList( "pop3-*" );
237 do { 240 do {
238 unique.setNum( num++ ); 241 unique.setNum( num++ );
@@ -244,52 +247,76 @@ QString POP3account::getUniqueFileName()
244void POP3account::read() 247void POP3account::read()
245{ 248{
246 Config *conf = new Config( getFileName(), Config::File ); 249 Config *conf = new Config( getFileName(), Config::File );
247 conf->setGroup( "POP3 Account" ); 250 conf->setGroup( "POP3 Account" );
248 accountName = conf->readEntry( "Account" ); 251 accountName = conf->readEntry( "Account" );
249 server = conf->readEntry( "Server" ); 252 server = conf->readEntry( "Server" );
250 port = conf->readEntry( "Port" ); 253 port = conf->readEntry( "Port" );
251 ssl = conf->readBoolEntry( "SSL" ); 254 ssl = conf->readBoolEntry( "SSL" );
252 connectionType = conf->readNumEntry( "ConnectionType" ); 255 connectionType = conf->readNumEntry( "ConnectionType" );
253 user = conf->readEntry( "User" ); 256 user = conf->readEntry( "User" );
254 password = conf->readEntryCrypt( "Password" ); 257 password = conf->readEntryCrypt( "Password" );
255 offline = conf->readBoolEntry("Offline",false); 258 offline = conf->readBoolEntry("Offline",false);
259 m_CheckSize = conf->readBoolEntry("Checkmaxsize",true);
260 m_MaxSize = conf->readNumEntry("Maxsize",1024);
256 delete conf; 261 delete conf;
257} 262}
258 263
259void POP3account::save() 264void POP3account::save()
260{ 265{
261 odebug << "saving " + getFileName() << oendl; 266 odebug << "saving " + getFileName() << oendl;
262 Settings::checkDirectory(); 267 Settings::checkDirectory();
263 268
264 Config *conf = new Config( getFileName(), Config::File ); 269 Config *conf = new Config( getFileName(), Config::File );
265 conf->setGroup( "POP3 Account" ); 270 conf->setGroup( "POP3 Account" );
266 conf->writeEntry( "Account", accountName ); 271 conf->writeEntry( "Account", accountName );
267 conf->writeEntry( "Server", server ); 272 conf->writeEntry( "Server", server );
268 conf->writeEntry( "Port", port ); 273 conf->writeEntry( "Port", port );
269 conf->writeEntry( "SSL", ssl ); 274 conf->writeEntry( "SSL", ssl );
270 conf->writeEntry( "ConnectionType", connectionType ); 275 conf->writeEntry( "ConnectionType", connectionType );
271 conf->writeEntry( "User", user ); 276 conf->writeEntry( "User", user );
272 conf->writeEntryCrypt( "Password", password ); 277 conf->writeEntryCrypt( "Password", password );
273 conf->writeEntry( "Offline",offline); 278 conf->writeEntry( "Offline",offline);
279 conf->writeEntry("Checkmaxsize",m_CheckSize);
280 conf->writeEntry("Maxsize",m_MaxSize);
274 conf->write(); 281 conf->write();
275 delete conf; 282 delete conf;
276} 283}
277 284
278 285
279QString POP3account::getFileName() 286QString POP3account::getFileName()
280{ 287{
281 return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file; 288 return (QString) getenv( "HOME" ) + "/Applications/opiemail/pop3-" + file;
282} 289}
283 290
291bool POP3account::getCheckMaxSize()const
292{
293 return m_CheckSize;
294}
295
296void POP3account::setCheckMaxSize(bool aValue)
297{
298 m_CheckSize = aValue;
299}
300
301int POP3account::getMaxSize()const
302{
303 return m_MaxSize;
304}
305
306void POP3account::setMaxSize(int aValue)
307{
308 m_MaxSize = aValue;
309}
310
284SMTPaccount::SMTPaccount() 311SMTPaccount::SMTPaccount()
285 : Account() 312 : Account()
286{ 313{
287 file = SMTPaccount::getUniqueFileName(); 314 file = SMTPaccount::getUniqueFileName();
288 accountName = "New SMTP Account"; 315 accountName = "New SMTP Account";
289 ssl = false; 316 ssl = false;
290 connectionType = 1; 317 connectionType = 1;
291 login = false; 318 login = false;
292 useCC = false; 319 useCC = false;
293 useBCC = false; 320 useBCC = false;
294 useReply = false; 321 useReply = false;
295 type = MAILLIB::A_SMTP; 322 type = MAILLIB::A_SMTP;
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index bf27b97..8683a05 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -80,28 +80,33 @@ private:
80class POP3account : public Account 80class POP3account : public Account
81{ 81{
82 82
83public: 83public:
84 POP3account(); 84 POP3account();
85 POP3account( QString filename ); 85 POP3account( QString filename );
86 86
87 static QString getUniqueFileName(); 87 static QString getUniqueFileName();
88 88
89 virtual void read(); 89 virtual void read();
90 virtual void save(); 90 virtual void save();
91 virtual QString getFileName(); 91 virtual QString getFileName();
92 virtual bool getCheckMaxSize()const;
93 virtual void setCheckMaxSize(bool);
94 virtual int getMaxSize()const;
95 virtual void setMaxSize(int);
92 96
93private: 97private:
94 QString file; 98 QString file;
95 99 bool m_CheckSize;
100 int m_MaxSize;
96}; 101};
97 102
98class SMTPaccount : public Account 103class SMTPaccount : public Account
99{ 104{
100 105
101public: 106public:
102 SMTPaccount(); 107 SMTPaccount();
103 SMTPaccount( QString filename ); 108 SMTPaccount( QString filename );
104 109
105 static QString getUniqueFileName(); 110 static QString getUniqueFileName();
106 111
107 virtual void read(); 112 virtual void read();
diff --git a/noncore/net/mail/pop3configui.ui b/noncore/net/mail/pop3configui.ui
index 1014ef4..e560661 100644
--- a/noncore/net/mail/pop3configui.ui
+++ b/noncore/net/mail/pop3configui.ui
@@ -2,46 +2,46 @@
2<class>POP3configUI</class> 2<class>POP3configUI</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>POP3configUI</cstring> 7 <cstring>POP3configUI</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>314</width> 14 <width>302</width>
15 <height>410</height> 15 <height>410</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Configure POP3</string> 20 <string>Configure POP3</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>11</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>3</number> 35 <number>6</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QLayoutWidget</class> 38 <class>QLayoutWidget</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>Layout12</cstring> 41 <cstring>Layout12</cstring>
42 </property> 42 </property>
43 <hbox> 43 <hbox>
44 <property stdset="1"> 44 <property stdset="1">
45 <name>margin</name> 45 <name>margin</name>
46 <number>0</number> 46 <number>0</number>
47 </property> 47 </property>
@@ -310,24 +310,82 @@
310 <name>name</name> 310 <name>name</name>
311 <cstring>passLine</cstring> 311 <cstring>passLine</cstring>
312 </property> 312 </property>
313 <property stdset="1"> 313 <property stdset="1">
314 <name>echoMode</name> 314 <name>echoMode</name>
315 <enum>Password</enum> 315 <enum>Password</enum>
316 </property> 316 </property>
317 </widget> 317 </widget>
318 </vbox> 318 </vbox>
319 </widget> 319 </widget>
320 </hbox> 320 </hbox>
321 </widget> 321 </widget>
322 <widget>
323 <class>QCheckBox</class>
324 <property stdset="1">
325 <name>name</name>
326 <cstring>m_CheckSize</cstring>
327 </property>
328 <property stdset="1">
329 <name>text</name>
330 <string>ask before downloading large mails</string>
331 </property>
332 </widget>
333 <widget>
334 <class>QLayoutWidget</class>
335 <property stdset="1">
336 <name>name</name>
337 <cstring>Layout9</cstring>
338 </property>
339 <grid>
340 <property stdset="1">
341 <name>margin</name>
342 <number>0</number>
343 </property>
344 <property stdset="1">
345 <name>spacing</name>
346 <number>6</number>
347 </property>
348 <widget row="0" column="0" >
349 <class>QLabel</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>m_MailLimitLabel</cstring>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string>Large mail size (kb):</string>
357 </property>
358 </widget>
359 <widget row="0" column="1" >
360 <class>QSpinBox</class>
361 <property stdset="1">
362 <name>name</name>
363 <cstring>m_MailLimitBox</cstring>
364 </property>
365 <property stdset="1">
366 <name>suffix</name>
367 <string> kB</string>
368 </property>
369 <property stdset="1">
370 <name>maxValue</name>
371 <number>5120</number>
372 </property>
373 <property stdset="1">
374 <name>minValue</name>
375 <number>1</number>
376 </property>
377 </widget>
378 </grid>
379 </widget>
322 <spacer> 380 <spacer>
323 <property> 381 <property>
324 <name>name</name> 382 <name>name</name>
325 <cstring>spacer</cstring> 383 <cstring>spacer</cstring>
326 </property> 384 </property>
327 <property stdset="1"> 385 <property stdset="1">
328 <name>orientation</name> 386 <name>orientation</name>
329 <enum>Vertical</enum> 387 <enum>Vertical</enum>
330 </property> 388 </property>
331 <property stdset="1"> 389 <property stdset="1">
332 <name>sizeType</name> 390 <name>sizeType</name>
333 <enum>Expanding</enum> 391 <enum>Expanding</enum>
@@ -337,16 +395,20 @@
337 <size> 395 <size>
338 <width>20</width> 396 <width>20</width>
339 <height>20</height> 397 <height>20</height>
340 </size> 398 </size>
341 </property> 399 </property>
342 </spacer> 400 </spacer>
343 </vbox> 401 </vbox>
344</widget> 402</widget>
345<tabstops> 403<tabstops>
346 <tabstop>accountLine</tabstop> 404 <tabstop>accountLine</tabstop>
347 <tabstop>serverLine</tabstop> 405 <tabstop>serverLine</tabstop>
348 <tabstop>portLine</tabstop> 406 <tabstop>portLine</tabstop>
407 <tabstop>ComboBox1</tabstop>
408 <tabstop>CommandEdit</tabstop>
349 <tabstop>userLine</tabstop> 409 <tabstop>userLine</tabstop>
350 <tabstop>passLine</tabstop> 410 <tabstop>passLine</tabstop>
411 <tabstop>m_CheckSize</tabstop>
412 <tabstop>m_MailLimitBox</tabstop>
351</tabstops> 413</tabstops>
352</UI> 414</UI>