summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-09-10 22:52:50 (UTC)
committer zautrix <zautrix>2004-09-10 22:52:50 (UTC)
commit1b41a0e3bf63364940daf132446939e3570c57ad (patch) (unidiff)
tree81db8e427beadcf3bbd5356962b5d08b970a87e4 /kmicromail
parentc280882f788b31f874f928e23fc29c2aaca991eb (diff)
downloadkdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.zip
kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.tar.gz
kdepimpi-1b41a0e3bf63364940daf132446939e3570c57ad.tar.bz2
Added pop3 settings
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp12
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp2
-rw-r--r--kmicromail/libmailwrapper/settings.cpp10
-rw-r--r--kmicromail/libmailwrapper/settings.h9
-rw-r--r--kmicromail/pop3configui.ui94
5 files changed, 122 insertions, 5 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index d272c3b..e7d2750 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,114 +1,115 @@
1 1
2#include "defines.h" 2#include "defines.h"
3#include "editaccounts.h" 3#include "editaccounts.h"
4#include "kapplication.h" 4#include "kapplication.h"
5/* OPIE */ 5/* OPIE */
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7 7
8/* QT */ 8/* QT */
9#include <qstringlist.h> 9#include <qstringlist.h>
10 10
11#include <qcombobox.h> 11#include <qcombobox.h>
12#include <qcheckbox.h> 12#include <qcheckbox.h>
13#include <qmessagebox.h> 13#include <qmessagebox.h>
14#include <qpushbutton.h> 14#include <qpushbutton.h>
15#include <qlineedit.h> 15#include <qlineedit.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qtabwidget.h> 17#include <qtabwidget.h>
18#include <qlistview.h> 18#include <qlistview.h>
19#include <qspinbox.h>
19 20
20#include <libmailwrapper/nntpwrapper.h> 21#include <libmailwrapper/nntpwrapper.h>
21 22
22using namespace Opie::Core; 23using namespace Opie::Core;
23 24
24AccountListItem::AccountListItem( QListView *parent, Account *a) 25AccountListItem::AccountListItem( QListView *parent, Account *a)
25 : QListViewItem( parent ) 26 : QListViewItem( parent )
26{ 27{
27 account = a; 28 account = a;
28 setText( 0, account->getAccountName() ); 29 setText( 0, account->getAccountName() );
29 QString ttext = ""; 30 QString ttext = "";
30 switch (account->getType()) { 31 switch (account->getType()) {
31 case MAILLIB::A_NNTP: 32 case MAILLIB::A_NNTP:
32 ttext="NNTP"; 33 ttext="NNTP";
33 break; 34 break;
34 case MAILLIB::A_POP3: 35 case MAILLIB::A_POP3:
35 ttext = "POP3"; 36 ttext = "POP3";
36 break; 37 break;
37 case MAILLIB::A_IMAP: 38 case MAILLIB::A_IMAP:
38 ttext = "IMAP"; 39 ttext = "IMAP";
39 break; 40 break;
40 case MAILLIB::A_SMTP: 41 case MAILLIB::A_SMTP:
41 ttext = "SMTP"; 42 ttext = "SMTP";
42 break; 43 break;
43 default: 44 default:
44 ttext = "UNKNOWN"; 45 ttext = "UNKNOWN";
45 break; 46 break;
46 } 47 }
47 setText( 1, ttext); 48 setText( 1, ttext);
48} 49}
49 50
50EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 51EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
51 : EditAccountsUI( parent, name, modal, flags ) 52 : EditAccountsUI( parent, name, modal, flags )
52{ 53{
53 settings = s; 54 settings = s;
54 55
55 mailList->addColumn( tr( "Account" ) ); 56 mailList->addColumn( tr( "Account" ) );
56 mailList->addColumn( tr( "Type" ) ); 57 mailList->addColumn( tr( "Type" ) );
57 58
58 newsList->addColumn( tr( "Account" ) ); 59 newsList->addColumn( tr( "Account" ) );
59 60
60 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 61 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
61 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 62 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
62 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 63 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
63 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 64 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
64 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 65 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
65 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 66 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
66 67
67 slotFillLists(); 68 slotFillLists();
68} 69}
69 70
70void EditAccounts::slotFillLists() 71void EditAccounts::slotFillLists()
71{ 72{
72 mailList->clear(); 73 mailList->clear();
73 newsList->clear(); 74 newsList->clear();
74 75
75 QList<Account> accounts = settings->getAccounts(); 76 QList<Account> accounts = settings->getAccounts();
76 Account *it; 77 Account *it;
77 for ( it = accounts.first(); it; it = accounts.next() ) 78 for ( it = accounts.first(); it; it = accounts.next() )
78 { 79 {
79 if ( it->getType()==MAILLIB::A_NNTP ) 80 if ( it->getType()==MAILLIB::A_NNTP )
80 { 81 {
81 (void) new AccountListItem( newsList, it ); 82 (void) new AccountListItem( newsList, it );
82 } 83 }
83 else 84 else
84 { 85 {
85 (void) new AccountListItem( mailList, it ); 86 (void) new AccountListItem( mailList, it );
86 } 87 }
87 } 88 }
88} 89}
89 90
90void EditAccounts::slotNewMail() 91void EditAccounts::slotNewMail()
91{ 92{
92 QString *selection = new QString(); 93 QString *selection = new QString();
93 SelectMailType selType( selection, this, 0, true ); 94 SelectMailType selType( selection, this, 0, true );
94 selType.show(); 95 selType.show();
95 if ( QDialog::Accepted == selType.exec() ) 96 if ( QDialog::Accepted == selType.exec() )
96 { 97 {
97 slotNewAccount( *selection ); 98 slotNewAccount( *selection );
98 } 99 }
99} 100}
100 101
101void EditAccounts::slotNewAccount( const QString &type ) 102void EditAccounts::slotNewAccount( const QString &type )
102{ 103{
103 if ( type.compare( "IMAP" ) == 0 ) 104 if ( type.compare( "IMAP" ) == 0 )
104 { 105 {
105 IMAPaccount *account = new IMAPaccount(); 106 IMAPaccount *account = new IMAPaccount();
106 IMAPconfig imap( account, this, 0, true ); 107 IMAPconfig imap( account, this, 0, true );
107 imap.showMaximized(); 108 imap.showMaximized();
108 if ( QDialog::Accepted == imap.exec() ) 109 if ( QDialog::Accepted == imap.exec() )
109 { 110 {
110 settings->addAccount( account ); 111 settings->addAccount( account );
111 account->save(); 112 account->save();
112 slotFillLists(); 113 slotFillLists();
113 } 114 }
114 else 115 else
@@ -327,202 +328,213 @@ IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name,
327 328
328 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 329 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
329 ComboBox1->insertItem( "Only if available", 0 ); 330 ComboBox1->insertItem( "Only if available", 0 );
330 ComboBox1->insertItem( "Always, Negotiated", 1 ); 331 ComboBox1->insertItem( "Always, Negotiated", 1 );
331 ComboBox1->insertItem( "Connect on secure port", 2 ); 332 ComboBox1->insertItem( "Connect on secure port", 2 );
332 ComboBox1->insertItem( "Run command instead", 3 ); 333 ComboBox1->insertItem( "Run command instead", 3 );
333 CommandEdit->hide(); 334 CommandEdit->hide();
334 ComboBox1->setCurrentItem( data->ConnectionType() ); 335 ComboBox1->setCurrentItem( data->ConnectionType() );
335} 336}
336 337
337void IMAPconfig::slotConnectionToggle( int index ) 338void IMAPconfig::slotConnectionToggle( int index )
338{ 339{
339 if ( index == 2 ) 340 if ( index == 2 )
340 { 341 {
341 portLine->setText( IMAP_SSL_PORT ); 342 portLine->setText( IMAP_SSL_PORT );
342 } 343 }
343 else if ( index == 3 ) 344 else if ( index == 3 )
344 { 345 {
345 portLine->setText( IMAP_PORT ); 346 portLine->setText( IMAP_PORT );
346 CommandEdit->show(); 347 CommandEdit->show();
347 } 348 }
348 else 349 else
349 { 350 {
350 portLine->setText( IMAP_PORT ); 351 portLine->setText( IMAP_PORT );
351 } 352 }
352} 353}
353 354
354void IMAPconfig::fillValues() 355void IMAPconfig::fillValues()
355{ 356{
356 accountLine->setText( data->getAccountName() ); 357 accountLine->setText( data->getAccountName() );
357 serverLine->setText( data->getServer() ); 358 serverLine->setText( data->getServer() );
358 portLine->setText( data->getPort() ); 359 portLine->setText( data->getPort() );
359 ComboBox1->setCurrentItem( data->ConnectionType() ); 360 ComboBox1->setCurrentItem( data->ConnectionType() );
360 userLine->setText( data->getUser() ); 361 userLine->setText( data->getUser() );
361 passLine->setText( data->getPassword() ); 362 passLine->setText( data->getPassword() );
362 prefixLine->setText(data->getPrefix()); 363 prefixLine->setText(data->getPrefix());
363} 364}
364 365
365void IMAPconfig::accept() 366void IMAPconfig::accept()
366{ 367{
367 data->setAccountName( accountLine->text() ); 368 data->setAccountName( accountLine->text() );
368 data->setServer( serverLine->text() ); 369 data->setServer( serverLine->text() );
369 data->setPort( portLine->text() ); 370 data->setPort( portLine->text() );
370 data->setConnectionType( ComboBox1->currentItem() ); 371 data->setConnectionType( ComboBox1->currentItem() );
371 data->setUser( userLine->text() ); 372 data->setUser( userLine->text() );
372 data->setPassword( passLine->text() ); 373 data->setPassword( passLine->text() );
373 data->setPrefix(prefixLine->text()); 374 data->setPrefix(prefixLine->text());
374 375
375 QDialog::accept(); 376 QDialog::accept();
376} 377}
377 378
378/** 379/**
379 * POP3config 380 * POP3config
380 */ 381 */
381 382
382POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 383POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
383 : POP3configUI( parent, name, modal, flags ) 384 : POP3configUI( parent, name, modal, flags )
384{ 385{
385 data = account; 386 data = account;
386 fillValues(); 387 fillValues();
387 388
388 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 389 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
389 ComboBox1->insertItem( "Only if available", 0 ); 390 ComboBox1->insertItem( "Only if available", 0 );
390 ComboBox1->insertItem( "Always, Negotiated", 1 ); 391 ComboBox1->insertItem( "Always, Negotiated", 1 );
391 ComboBox1->insertItem( "Connect on secure port", 2 ); 392 ComboBox1->insertItem( "Connect on secure port", 2 );
392 ComboBox1->insertItem( "Run command instead", 3 ); 393 ComboBox1->insertItem( "Run command instead", 3 );
393 CommandEdit->hide(); 394 CommandEdit->hide();
394 ComboBox1->setCurrentItem( data->ConnectionType() ); 395 ComboBox1->setCurrentItem( data->ConnectionType() );
395} 396}
396 397
397void POP3config::slotConnectionToggle( int index ) 398void POP3config::slotConnectionToggle( int index )
398{ 399{
399 // 2 is ssl connection 400 // 2 is ssl connection
400 if ( index == 2 ) 401 if ( index == 2 )
401 { 402 {
402 portLine->setText( POP3_SSL_PORT ); 403 portLine->setText( POP3_SSL_PORT );
403 } 404 }
404 else if ( index == 3 ) 405 else if ( index == 3 )
405 { 406 {
406 portLine->setText( POP3_PORT ); 407 portLine->setText( POP3_PORT );
407 CommandEdit->show(); 408 CommandEdit->show();
408 } 409 }
409 else 410 else
410 { 411 {
411 portLine->setText( POP3_PORT ); 412 portLine->setText( POP3_PORT );
412 } 413 }
413} 414}
414 415
415void POP3config::fillValues() 416void POP3config::fillValues()
416{ 417{
417 accountLine->setText( data->getAccountName() ); 418 accountLine->setText( data->getAccountName() );
418 serverLine->setText( data->getServer() ); 419 serverLine->setText( data->getServer() );
419 portLine->setText( data->getPort() ); 420 portLine->setText( data->getPort() );
420 ComboBox1->setCurrentItem( data->ConnectionType() ); 421 ComboBox1->setCurrentItem( data->ConnectionType() );
421 userLine->setText( data->getUser() ); 422 userLine->setText( data->getUser() );
422 passLine->setText( data->getPassword() ); 423 passLine->setText( data->getPassword() );
424 localFolder->setText( data->getLocalFolder() );
425 int max = data->getMaxMailSize() ;
426 if ( max ) {
427 CheckBoxDown->setChecked( true );
428 SpinBoxDown->setValue ( max );
429 } else {
430 CheckBoxDown->setChecked( false );
431 SpinBoxDown->setValue ( 5 );
432 }
423} 433}
424 434
425void POP3config::accept() 435void POP3config::accept()
426{ 436{
427 data->setAccountName( accountLine->text() ); 437 data->setAccountName( accountLine->text() );
428 data->setServer( serverLine->text() ); 438 data->setServer( serverLine->text() );
429 data->setPort( portLine->text() ); 439 data->setPort( portLine->text() );
430 data->setConnectionType( ComboBox1->currentItem() ); 440 data->setConnectionType( ComboBox1->currentItem() );
431 data->setUser( userLine->text() ); 441 data->setUser( userLine->text() );
432 data->setPassword( passLine->text() ); 442 data->setPassword( passLine->text() );
443 data->setLocalFolder( localFolder->text() );
444 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
433 445
434 QDialog::accept(); 446 QDialog::accept();
435} 447}
436 448
437/** 449/**
438 * SMTPconfig 450 * SMTPconfig
439 */ 451 */
440 452
441SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 453SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
442 : SMTPconfigUI( parent, name, modal, flags ) 454 : SMTPconfigUI( parent, name, modal, flags )
443{ 455{
444 data = account; 456 data = account;
445 457
446 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 458 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
447 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 459 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
448 460
449 fillValues(); 461 fillValues();
450 462
451 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 463 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
452 ComboBox1->insertItem( "Only if available", 0 ); 464 ComboBox1->insertItem( "Only if available", 0 );
453 ComboBox1->insertItem( "Always, Negotiated", 1 ); 465 ComboBox1->insertItem( "Always, Negotiated", 1 );
454 ComboBox1->insertItem( "Connect on secure port", 2 ); 466 ComboBox1->insertItem( "Connect on secure port", 2 );
455 ComboBox1->insertItem( "Run command instead", 3 ); 467 ComboBox1->insertItem( "Run command instead", 3 );
456 CommandEdit->hide(); 468 CommandEdit->hide();
457 ComboBox1->setCurrentItem( data->ConnectionType() ); 469 ComboBox1->setCurrentItem( data->ConnectionType() );
458} 470}
459 471
460void SMTPconfig::slotConnectionToggle( int index ) 472void SMTPconfig::slotConnectionToggle( int index )
461{ 473{
462 // 2 is ssl connection 474 // 2 is ssl connection
463 if ( index == 2 ) 475 if ( index == 2 )
464 { 476 {
465 portLine->setText( SMTP_SSL_PORT ); 477 portLine->setText( SMTP_SSL_PORT );
466 } 478 }
467 else if ( index == 3 ) 479 else if ( index == 3 )
468 { 480 {
469 portLine->setText( SMTP_PORT ); 481 portLine->setText( SMTP_PORT );
470 CommandEdit->show(); 482 CommandEdit->show();
471 } 483 }
472 else 484 else
473 { 485 {
474 portLine->setText( SMTP_PORT ); 486 portLine->setText( SMTP_PORT );
475 } 487 }
476} 488}
477 489
478void SMTPconfig::fillValues() 490void SMTPconfig::fillValues()
479{ 491{
480 accountLine->setText( data->getAccountName() ); 492 accountLine->setText( data->getAccountName() );
481 serverLine->setText( data->getServer() ); 493 serverLine->setText( data->getServer() );
482 portLine->setText( data->getPort() ); 494 portLine->setText( data->getPort() );
483 ComboBox1->setCurrentItem( data->ConnectionType() ); 495 ComboBox1->setCurrentItem( data->ConnectionType() );
484 loginBox->setChecked( data->getLogin() ); 496 loginBox->setChecked( data->getLogin() );
485 userLine->setText( data->getUser() ); 497 userLine->setText( data->getUser() );
486 passLine->setText( data->getPassword() ); 498 passLine->setText( data->getPassword() );
487} 499}
488 500
489void SMTPconfig::accept() 501void SMTPconfig::accept()
490{ 502{
491 data->setAccountName( accountLine->text() ); 503 data->setAccountName( accountLine->text() );
492 data->setServer( serverLine->text() ); 504 data->setServer( serverLine->text() );
493 data->setPort( portLine->text() ); 505 data->setPort( portLine->text() );
494 data->setConnectionType( ComboBox1->currentItem() ); 506 data->setConnectionType( ComboBox1->currentItem() );
495 data->setLogin( loginBox->isChecked() ); 507 data->setLogin( loginBox->isChecked() );
496 data->setUser( userLine->text() ); 508 data->setUser( userLine->text() );
497 data->setPassword( passLine->text() ); 509 data->setPassword( passLine->text() );
498 510
499 QDialog::accept(); 511 QDialog::accept();
500} 512}
501 513
502/** 514/**
503 * NNTPconfig 515 * NNTPconfig
504 */ 516 */
505 517
506NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 518NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
507 : NNTPconfigUI( parent, name, modal, flags ) 519 : NNTPconfigUI( parent, name, modal, flags )
508{ 520{
509 data = account; 521 data = account;
510 522
511 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 523 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
512 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 524 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
513 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 525 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
514 fillValues(); 526 fillValues();
515 527
516 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 528 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
517} 529}
518 530
519void NNTPconfig::slotGetNG() { 531void NNTPconfig::slotGetNG() {
520 save(); 532 save();
521 data->save(); 533 data->save();
522 NNTPwrapper* tmp = new NNTPwrapper( data ); 534 NNTPwrapper* tmp = new NNTPwrapper( data );
523 QStringList list = tmp->listAllNewsgroups(); 535 QStringList list = tmp->listAllNewsgroups();
524 536
525 ListViewGroups->clear(); 537 ListViewGroups->clear();
526 538
527 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 539 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
528 QCheckListItem *item; 540 QCheckListItem *item;
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 8d2f778..1edec9e 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -29,193 +29,193 @@ POP3wrapper::~POP3wrapper() {
29 if (msg_cache.exists()) { 29 if (msg_cache.exists()) {
30 msg_cache.remove(); 30 msg_cache.remove();
31 } 31 }
32} 32}
33 33
34void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { 34void POP3wrapper::pop3_progress( size_t current, size_t maximum ) {
35 ; // odebug << "POP3: " << current << " of " << maximum << "" << oendl; 35 ; // odebug << "POP3: " << current << " of " << maximum << "" << oendl;
36} 36}
37 37
38RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { 38RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) {
39 int err = MAILPOP3_NO_ERROR; 39 int err = MAILPOP3_NO_ERROR;
40 char *message = 0; 40 char *message = 0;
41 size_t length = 0; 41 size_t length = 0;
42 42
43 RecBodyP body = new RecBody(); 43 RecBodyP body = new RecBody();
44 44
45 login(); 45 login();
46 if ( !m_pop3 ) { 46 if ( !m_pop3 ) {
47 return body; 47 return body;
48 } 48 }
49 49
50 mailmessage * mailmsg; 50 mailmessage * mailmsg;
51 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { 51 if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) {
52 ; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl; 52 ; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl;
53 return body; 53 return body;
54 } 54 }
55 55
56 QFile msg_cache(msgTempName); 56 QFile msg_cache(msgTempName);
57 57
58 cleanMimeCache(); 58 cleanMimeCache();
59 59
60 if (mail->getNumber()!=last_msg_id) { 60 if (mail->getNumber()!=last_msg_id) {
61 if (msg_cache.exists()) { 61 if (msg_cache.exists()) {
62 msg_cache.remove(); 62 msg_cache.remove();
63 } 63 }
64 msg_cache.open(IO_ReadWrite|IO_Truncate); 64 msg_cache.open(IO_ReadWrite|IO_Truncate);
65 last_msg_id = mail->getNumber(); 65 last_msg_id = mail->getNumber();
66 err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); 66 err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg);
67 err = mailmessage_fetch(mailmsg,&message,&length); 67 err = mailmessage_fetch(mailmsg,&message,&length);
68 msg_cache.writeBlock(message,length); 68 msg_cache.writeBlock(message,length);
69 } else { 69 } else {
70 QString msg=""; 70 QString msg="";
71 msg_cache.open(IO_ReadOnly); 71 msg_cache.open(IO_ReadOnly);
72 message = new char[4096]; 72 message = new char[4096];
73 memset(message,0,4096); 73 memset(message,0,4096);
74 while (msg_cache.readBlock(message,4095)>0) { 74 while (msg_cache.readBlock(message,4095)>0) {
75 msg+=message; 75 msg+=message;
76 memset(message,0,4096); 76 memset(message,0,4096);
77 } 77 }
78 delete message; 78 delete message;
79 message = (char*)malloc(msg.length()+1*sizeof(char)); 79 message = (char*)malloc(msg.length()+1*sizeof(char));
80 memset(message,0,msg.length()+1); 80 memset(message,0,msg.length()+1);
81 memcpy(message,msg.latin1(),msg.length()); 81 memcpy(message,msg.latin1(),msg.length());
82 /* transform to libetpan stuff */ 82 /* transform to libetpan stuff */
83 mailmsg = mailmessage_new(); 83 mailmsg = mailmessage_new();
84 mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); 84 mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message));
85 generic_message_t * msg_data; 85 generic_message_t * msg_data;
86 msg_data = (generic_message_t *)mailmsg->msg_data; 86 msg_data = (generic_message_t *)mailmsg->msg_data;
87 msg_data->msg_fetched = 1; 87 msg_data->msg_fetched = 1;
88 msg_data->msg_message = message; 88 msg_data->msg_message = message;
89 msg_data->msg_length = strlen(message); 89 msg_data->msg_length = strlen(message);
90 } 90 }
91 body = parseMail(mailmsg); 91 body = parseMail(mailmsg);
92 92
93 /* clean up */ 93 /* clean up */
94 if (mailmsg) 94 if (mailmsg)
95 mailmessage_free(mailmsg); 95 mailmessage_free(mailmsg);
96 if (message) 96 if (message)
97 free(message); 97 free(message);
98 98
99 return body; 99 return body;
100} 100}
101 101
102void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) 102void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb )
103{ 103{
104 login(); 104 login();
105 if (!m_pop3) 105 if (!m_pop3)
106 return; 106 return;
107 uint32_t res_messages,res_recent,res_unseen; 107 uint32_t res_messages,res_recent,res_unseen;
108 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); 108 mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen);
109 parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); 109 parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb);
110 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); 110 Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages));
111} 111}
112 112
113void POP3wrapper::login() 113void POP3wrapper::login()
114{ 114{
115 if (account->getOffline()) 115 if (account->getOffline())
116 return; 116 return;
117 /* we'll hold the line */ 117 /* we'll hold the line */
118 if ( m_pop3 != NULL ) 118 if ( m_pop3 != NULL )
119 return; 119 return;
120 120
121 QString server,user, pass; 121 QString server,user, pass;
122 uint16_t port; 122 uint16_t port;
123 int err = MAILPOP3_NO_ERROR; 123 int err = MAILPOP3_NO_ERROR;
124 124
125 server = account->getServer().latin1(); 125 server = account->getServer();
126 port = account->getPort().toUInt(); 126 port = account->getPort().toUInt();
127 127
128 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { 128 if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
129 qApp->processEvents(); 129 qApp->processEvents();
130 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); 130 LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
131 login.show(); 131 login.show();
132 if ( QDialog::Accepted == login.exec() ) { 132 if ( QDialog::Accepted == login.exec() ) {
133 // ok 133 // ok
134 user = login.getUser(); 134 user = login.getUser();
135 pass = login.getPassword(); 135 pass = login.getPassword();
136 } else { 136 } else {
137 // cancel 137 // cancel
138 ; // odebug << "POP3: Login canceled" << oendl; 138 ; // odebug << "POP3: Login canceled" << oendl;
139 return; 139 return;
140 } 140 }
141 } else { 141 } else {
142 user = account->getUser(); 142 user = account->getUser();
143 pass = account->getPassword(); 143 pass = account->getPassword();
144 } 144 }
145 // bool ssl = account->getSSL(); 145 // bool ssl = account->getSSL();
146 146
147 m_pop3=mailstorage_new(NULL); 147 m_pop3=mailstorage_new(NULL);
148 int conntypeset = account->ConnectionType(); 148 int conntypeset = account->ConnectionType();
149 int conntype = 0; 149 int conntype = 0;
150 if ( conntypeset == 3 ) { 150 if ( conntypeset == 3 ) {
151 conntype = CONNECTION_TYPE_COMMAND; 151 conntype = CONNECTION_TYPE_COMMAND;
152 } else if ( conntypeset == 2 ) { 152 } else if ( conntypeset == 2 ) {
153 conntype = CONNECTION_TYPE_TLS; 153 conntype = CONNECTION_TYPE_TLS;
154 } else if ( conntypeset == 1 ) { 154 } else if ( conntypeset == 1 ) {
155 conntype = CONNECTION_TYPE_STARTTLS; 155 conntype = CONNECTION_TYPE_STARTTLS;
156 } else if ( conntypeset == 0 ) { 156 } else if ( conntypeset == 0 ) {
157 conntype = CONNECTION_TYPE_TRY_STARTTLS; 157 conntype = CONNECTION_TYPE_TRY_STARTTLS;
158 } 158 }
159 159
160 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); 160 //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
161 161
162 pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, 162 pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
163 (char*)user.latin1(),(char*)pass.latin1(),0,0,0); 163 (char*)user.latin1(),(char*)pass.latin1(),0,0,0);
164 164
165 err = mailstorage_connect(m_pop3); 165 err = mailstorage_connect(m_pop3);
166 if (err != MAIL_NO_ERROR) { 166 if (err != MAIL_NO_ERROR) {
167 ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; 167 ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
168 Global::statusMessage(tr("Error %1 initializing folder").arg( err )); 168 Global::statusMessage(tr("Error %1 initializing folder").arg( err ));
169 mailstorage_free(m_pop3); 169 mailstorage_free(m_pop3);
170 m_pop3 = 0; 170 m_pop3 = 0;
171 } else { 171 } else {
172 mailsession * session = m_pop3->sto_session; 172 mailsession * session = m_pop3->sto_session;
173 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; 173 mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session;
174 if (mail) { 174 if (mail) {
175 mail->pop3_progr_fun = &pop3_progress; 175 mail->pop3_progr_fun = &pop3_progress;
176 } 176 }
177 } 177 }
178} 178}
179 179
180void POP3wrapper::logout() 180void POP3wrapper::logout()
181{ 181{
182 if ( m_pop3 == NULL ) 182 if ( m_pop3 == NULL )
183 return; 183 return;
184 mailstorage_free(m_pop3); 184 mailstorage_free(m_pop3);
185 m_pop3 = 0; 185 m_pop3 = 0;
186} 186}
187 187
188 188
189QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { 189QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() {
190 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); 190 QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>();
191 FolderP inb=new Folder("INBOX","/"); 191 FolderP inb=new Folder("INBOX","/");
192 folders->append(inb); 192 folders->append(inb);
193 return folders; 193 return folders;
194} 194}
195 195
196void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) 196void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target)
197{ 197{
198 login(); 198 login();
199 if (!m_pop3) 199 if (!m_pop3)
200 return; 200 return;
201 int iii = 0; 201 int iii = 0;
202 int count = target.count(); 202 int count = target.count();
203 QWidget wid; 203 QWidget wid;
204 wid.show(); 204 wid.show();
205 while (iii < count ) { 205 while (iii < count ) {
206 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); 206 Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count));
207 wid.raise(); 207 wid.raise();
208 qApp->processEvents(); 208 qApp->processEvents();
209 //qDebug("delete "); 209 //qDebug("delete ");
210 RecMailP mail = (*target.at( iii )); 210 RecMailP mail = (*target.at( iii ));
211 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); 211 int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber());
212 if (err != MAIL_NO_ERROR) { 212 if (err != MAIL_NO_ERROR) {
213 Global::statusMessage(tr("Error deleting mail")); 213 Global::statusMessage(tr("Error deleting mail"));
214 } 214 }
215 ++iii; 215 ++iii;
216 } 216 }
217} 217}
218void POP3wrapper::deleteMail(const RecMailP&mail) { 218void POP3wrapper::deleteMail(const RecMailP&mail) {
219 login(); 219 login();
220 if (!m_pop3) 220 if (!m_pop3)
221 return; 221 return;
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp
index b0a539e..90e32fa 100644
--- a/kmicromail/libmailwrapper/settings.cpp
+++ b/kmicromail/libmailwrapper/settings.cpp
@@ -162,209 +162,219 @@ void IMAPaccount::read()
162{ 162{
163 Config *conf = new Config( getFileName(), Config::File ); 163 Config *conf = new Config( getFileName(), Config::File );
164 conf->setGroup( "IMAP Account" ); 164 conf->setGroup( "IMAP Account" );
165 accountName = conf->readEntry( "Account","" ); 165 accountName = conf->readEntry( "Account","" );
166 if (accountName.isNull()) accountName = ""; 166 if (accountName.isNull()) accountName = "";
167 server = conf->readEntry( "Server","" ); 167 server = conf->readEntry( "Server","" );
168 if (server.isNull()) server=""; 168 if (server.isNull()) server="";
169 port = conf->readEntry( "Port","" ); 169 port = conf->readEntry( "Port","" );
170 if (port.isNull()) port="143"; 170 if (port.isNull()) port="143";
171 connectionType = conf->readNumEntry( "ConnectionType" ); 171 connectionType = conf->readNumEntry( "ConnectionType" );
172 ssl = conf->readBoolEntry( "SSL",false ); 172 ssl = conf->readBoolEntry( "SSL",false );
173 user = conf->readEntry( "User","" ); 173 user = conf->readEntry( "User","" );
174 if (user.isNull()) user = ""; 174 if (user.isNull()) user = "";
175 password = conf->readEntryCrypt( "Password","" ); 175 password = conf->readEntryCrypt( "Password","" );
176 if (password.isNull()) password = ""; 176 if (password.isNull()) password = "";
177 prefix = conf->readEntry("MailPrefix",""); 177 prefix = conf->readEntry("MailPrefix","");
178 if (prefix.isNull()) prefix = ""; 178 if (prefix.isNull()) prefix = "";
179 offline = conf->readBoolEntry("Offline",false); 179 offline = conf->readBoolEntry("Offline",false);
180 delete conf; 180 delete conf;
181} 181}
182 182
183void IMAPaccount::save() 183void IMAPaccount::save()
184{ 184{
185 qDebug("saving %s ",getFileName().latin1() ); 185 qDebug("saving %s ",getFileName().latin1() );
186 Settings::checkDirectory(); 186 Settings::checkDirectory();
187 187
188 Config *conf = new Config( getFileName(), Config::File ); 188 Config *conf = new Config( getFileName(), Config::File );
189 conf->setGroup( "IMAP Account" ); 189 conf->setGroup( "IMAP Account" );
190 conf->writeEntry( "Account", accountName ); 190 conf->writeEntry( "Account", accountName );
191 conf->writeEntry( "Server", server ); 191 conf->writeEntry( "Server", server );
192 conf->writeEntry( "Port", port ); 192 conf->writeEntry( "Port", port );
193 conf->writeEntry( "SSL", ssl ); 193 conf->writeEntry( "SSL", ssl );
194 conf->writeEntry( "ConnectionType", connectionType ); 194 conf->writeEntry( "ConnectionType", connectionType );
195 conf->writeEntry( "User", user ); 195 conf->writeEntry( "User", user );
196 conf->writeEntryCrypt( "Password", password ); 196 conf->writeEntryCrypt( "Password", password );
197 conf->writeEntry( "MailPrefix",prefix); 197 conf->writeEntry( "MailPrefix",prefix);
198 conf->writeEntry( "Offline",offline); 198 conf->writeEntry( "Offline",offline);
199 conf->write(); 199 conf->write();
200 delete conf; 200 delete conf;
201} 201}
202 202
203 203
204QString IMAPaccount::getFileName() 204QString IMAPaccount::getFileName()
205{ 205{
206 return locateLocal("data", "kopiemail" ) +"/imap-" + file; 206 return locateLocal("data", "kopiemail" ) +"/imap-" + file;
207} 207}
208 208
209POP3account::POP3account() 209POP3account::POP3account()
210 : Account() 210 : Account()
211{ 211{
212 file = POP3account::getUniqueFileName(); 212 file = POP3account::getUniqueFileName();
213 accountName = "New POP3 Account"; 213 accountName = "New POP3 Account";
214 ssl = false; 214 ssl = false;
215 connectionType = 1; 215 connectionType = 1;
216 type = MAILLIB::A_POP3; 216 type = MAILLIB::A_POP3;
217 port = POP3_PORT; 217 port = POP3_PORT;
218} 218}
219 219
220POP3account::POP3account( QString filename ) 220POP3account::POP3account( QString filename )
221 : Account() 221 : Account()
222{ 222{
223 file = filename; 223 file = filename;
224 accountName = "New POP3 Account"; 224 accountName = "New POP3 Account";
225 ssl = false; 225 ssl = false;
226 connectionType = 1; 226 connectionType = 1;
227 type = MAILLIB::A_POP3; 227 type = MAILLIB::A_POP3;
228 port = POP3_PORT; 228 port = POP3_PORT;
229} 229}
230 230
231QString POP3account::getUniqueFileName() 231QString POP3account::getUniqueFileName()
232{ 232{
233 int num = 0; 233 int num = 0;
234 QString unique; 234 QString unique;
235 235
236 QDir dir( locateLocal("data", "kopiemail" ) ); 236 QDir dir( locateLocal("data", "kopiemail" ) );
237 237
238 QStringList imap = dir.entryList( "pop3-*" ); 238 QStringList imap = dir.entryList( "pop3-*" );
239 do { 239 do {
240 unique.setNum( num++ ); 240 unique.setNum( num++ );
241 } while ( imap.contains( "pop3-" + unique ) > 0 ); 241 } while ( imap.contains( "pop3-" + unique ) > 0 );
242 242
243 return unique; 243 return unique;
244} 244}
245 245
246void POP3account::read() 246void POP3account::read()
247{ 247{
248 Config *conf = new Config( getFileName(), Config::File ); 248 Config *conf = new Config( getFileName(), Config::File );
249 conf->setGroup( "POP3 Account" ); 249 conf->setGroup( "POP3 Account" );
250 accountName = conf->readEntry( "Account" ); 250 accountName = conf->readEntry( "Account" );
251 server = conf->readEntry( "Server" ); 251 server = conf->readEntry( "Server" );
252 port = conf->readEntry( "Port" ); 252 port = conf->readEntry( "Port" );
253 ssl = conf->readBoolEntry( "SSL" ); 253 ssl = conf->readBoolEntry( "SSL" );
254 connectionType = conf->readNumEntry( "ConnectionType" ); 254 connectionType = conf->readNumEntry( "ConnectionType" );
255 user = conf->readEntry( "User" ); 255 user = conf->readEntry( "User" );
256 password = conf->readEntryCrypt( "Password" ); 256 password = conf->readEntryCrypt( "Password" );
257 offline = conf->readBoolEntry("Offline",false); 257 offline = conf->readBoolEntry("Offline",false);
258 localFolder = conf->readEntry( "LocalFolder" );
259 maxMailSize = conf->readNumEntry( "MaxSize",0 );
260 int lf = conf->readNumEntry( "LastFetch",0 );
261 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
262 lastFetch = dt.addSecs( lf );
258 delete conf; 263 delete conf;
259} 264}
260 265
261void POP3account::save() 266void POP3account::save()
262{ 267{
263 Settings::checkDirectory(); 268 Settings::checkDirectory();
264 269
265 Config *conf = new Config( getFileName(), Config::File ); 270 Config *conf = new Config( getFileName(), Config::File );
266 conf->setGroup( "POP3 Account" ); 271 conf->setGroup( "POP3 Account" );
267 conf->writeEntry( "Account", accountName ); 272 conf->writeEntry( "Account", accountName );
268 conf->writeEntry( "Server", server ); 273 conf->writeEntry( "Server", server );
269 conf->writeEntry( "Port", port ); 274 conf->writeEntry( "Port", port );
270 conf->writeEntry( "SSL", ssl ); 275 conf->writeEntry( "SSL", ssl );
271 conf->writeEntry( "ConnectionType", connectionType ); 276 conf->writeEntry( "ConnectionType", connectionType );
272 conf->writeEntry( "User", user ); 277 conf->writeEntry( "User", user );
273 conf->writeEntryCrypt( "Password", password ); 278 conf->writeEntryCrypt( "Password", password );
274 conf->writeEntry( "Offline",offline); 279 conf->writeEntry( "Offline",offline);
280 conf->writeEntry( "LocalFolder", localFolder );
281 conf->writeEntry( "MaxSize", maxMailSize );
282 QDateTime dt ( QDate ( 2004, 1, 1 ), QTime( 0,0,0) );
283 int lf = dt.secsTo ( lastFetch );
284 conf->writeEntry( "LastFetch", lf );
275 conf->write(); 285 conf->write();
276 delete conf; 286 delete conf;
277} 287}
278 288
279 289
280QString POP3account::getFileName() 290QString POP3account::getFileName()
281{ 291{
282 return locateLocal("data", "kopiemail" ) +"/pop3-" + file; 292 return locateLocal("data", "kopiemail" ) +"/pop3-" + file;
283} 293}
284 294
285SMTPaccount::SMTPaccount() 295SMTPaccount::SMTPaccount()
286 : Account() 296 : Account()
287{ 297{
288 file = SMTPaccount::getUniqueFileName(); 298 file = SMTPaccount::getUniqueFileName();
289 accountName = "New SMTP Account"; 299 accountName = "New SMTP Account";
290 ssl = false; 300 ssl = false;
291 connectionType = 1; 301 connectionType = 1;
292 login = false; 302 login = false;
293 useCC = false; 303 useCC = false;
294 useBCC = false; 304 useBCC = false;
295 useReply = false; 305 useReply = false;
296 type = MAILLIB::A_SMTP; 306 type = MAILLIB::A_SMTP;
297 port = SMTP_PORT; 307 port = SMTP_PORT;
298} 308}
299 309
300SMTPaccount::SMTPaccount( QString filename ) 310SMTPaccount::SMTPaccount( QString filename )
301 : Account() 311 : Account()
302{ 312{
303 file = filename; 313 file = filename;
304 accountName = "New SMTP Account"; 314 accountName = "New SMTP Account";
305 ssl = false; 315 ssl = false;
306 connectionType = 1; 316 connectionType = 1;
307 login = false; 317 login = false;
308 type = MAILLIB::A_SMTP; 318 type = MAILLIB::A_SMTP;
309 port = SMTP_PORT; 319 port = SMTP_PORT;
310} 320}
311 321
312QString SMTPaccount::getUniqueFileName() 322QString SMTPaccount::getUniqueFileName()
313{ 323{
314 int num = 0; 324 int num = 0;
315 QString unique; 325 QString unique;
316 326
317 QDir dir( locateLocal("data", "kopiemail" ) ); 327 QDir dir( locateLocal("data", "kopiemail" ) );
318 328
319 QStringList imap = dir.entryList( "smtp-*" ); 329 QStringList imap = dir.entryList( "smtp-*" );
320 do { 330 do {
321 unique.setNum( num++ ); 331 unique.setNum( num++ );
322 } while ( imap.contains( "smtp-" + unique ) > 0 ); 332 } while ( imap.contains( "smtp-" + unique ) > 0 );
323 333
324 return unique; 334 return unique;
325} 335}
326 336
327void SMTPaccount::read() 337void SMTPaccount::read()
328{ 338{
329 Config *conf = new Config( getFileName(), Config::File ); 339 Config *conf = new Config( getFileName(), Config::File );
330 conf->setGroup( "SMTP Account" ); 340 conf->setGroup( "SMTP Account" );
331 accountName = conf->readEntry( "Account" ); 341 accountName = conf->readEntry( "Account" );
332 server = conf->readEntry( "Server" ); 342 server = conf->readEntry( "Server" );
333 port = conf->readEntry( "Port" ); 343 port = conf->readEntry( "Port" );
334 ssl = conf->readBoolEntry( "SSL" ); 344 ssl = conf->readBoolEntry( "SSL" );
335 connectionType = conf->readNumEntry( "ConnectionType" ); 345 connectionType = conf->readNumEntry( "ConnectionType" );
336 login = conf->readBoolEntry( "Login" ); 346 login = conf->readBoolEntry( "Login" );
337 user = conf->readEntry( "User" ); 347 user = conf->readEntry( "User" );
338 password = conf->readEntryCrypt( "Password" ); 348 password = conf->readEntryCrypt( "Password" );
339 delete conf; 349 delete conf;
340} 350}
341 351
342void SMTPaccount::save() 352void SMTPaccount::save()
343{ 353{
344 Settings::checkDirectory(); 354 Settings::checkDirectory();
345 355
346 Config *conf = new Config( getFileName(), Config::File ); 356 Config *conf = new Config( getFileName(), Config::File );
347 conf->setGroup( "SMTP Account" ); 357 conf->setGroup( "SMTP Account" );
348 conf->writeEntry( "Account", accountName ); 358 conf->writeEntry( "Account", accountName );
349 conf->writeEntry( "Server", server ); 359 conf->writeEntry( "Server", server );
350 conf->writeEntry( "Port", port ); 360 conf->writeEntry( "Port", port );
351 conf->writeEntry( "SSL", ssl ); 361 conf->writeEntry( "SSL", ssl );
352 conf->writeEntry( "ConnectionType", connectionType ); 362 conf->writeEntry( "ConnectionType", connectionType );
353 conf->writeEntry( "Login", login ); 363 conf->writeEntry( "Login", login );
354 conf->writeEntry( "User", user ); 364 conf->writeEntry( "User", user );
355 conf->writeEntryCrypt( "Password", password ); 365 conf->writeEntryCrypt( "Password", password );
356 conf->write(); 366 conf->write();
357 delete conf; 367 delete conf;
358} 368}
359 369
360 370
361QString SMTPaccount::getFileName() 371QString SMTPaccount::getFileName()
362{ 372{
363 return locateLocal("data", "kopiemail" ) +"/smtp-" + file; 373 return locateLocal("data", "kopiemail" ) +"/smtp-" + file;
364} 374}
365 375
366NNTPaccount::NNTPaccount() 376NNTPaccount::NNTPaccount()
367 : Account() 377 : Account()
368{ 378{
369 file = NNTPaccount::getUniqueFileName(); 379 file = NNTPaccount::getUniqueFileName();
370 accountName = "New NNTP Account"; 380 accountName = "New NNTP Account";
diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h
index ba3ec89..c33c403 100644
--- a/kmicromail/libmailwrapper/settings.h
+++ b/kmicromail/libmailwrapper/settings.h
@@ -1,151 +1,160 @@
1#ifndef SETTINGS_H 1#ifndef SETTINGS_H
2#define SETTINGS_H 2#define SETTINGS_H
3 3
4#include "maildefines.h" 4#include "maildefines.h"
5 5
6/* OPIE */ 6/* OPIE */
7 7
8/* QT */ 8/* QT */
9#include <qobject.h> 9#include <qobject.h>
10#include <qlist.h> 10#include <qlist.h>
11#include <qdatetime.h>
11 12
12class Account 13class Account
13{ 14{
14 15
15public: 16public:
16 Account(); 17 Account();
17 virtual ~Account() {} 18 virtual ~Account() {}
18 19
19 void remove(); 20 void remove();
20 void setAccountName( QString name ) { accountName = name; } 21 void setAccountName( QString name ) { accountName = name; }
21 const QString&getAccountName()const{ return accountName; } 22 const QString&getAccountName()const{ return accountName; }
22 MAILLIB::ATYPE getType()const{ return type; } 23 MAILLIB::ATYPE getType()const{ return type; }
23 24
24 void setServer(const QString&str){ server = str; } 25 void setServer(const QString&str){ server = str; }
25 const QString&getServer()const{ return server; } 26 const QString&getServer()const{ return server; }
26 27
28 void setLocalFolder( QString name ) { localFolder = name; }
29 const QString& getLocalFolder()const{ return localFolder; }
30
27 void setPort(const QString&str) { port = str; } 31 void setPort(const QString&str) { port = str; }
28 const QString&getPort()const{ return port; } 32 const QString&getPort()const{ return port; }
29 33
30 void setUser(const QString&str){ user = str; } 34 void setUser(const QString&str){ user = str; }
31 const QString&getUser()const{ return user; } 35 const QString&getUser()const{ return user; }
32 36
33 void setPassword(const QString&str) { password = str; } 37 void setPassword(const QString&str) { password = str; }
34 const QString&getPassword()const { return password; } 38 const QString&getPassword()const { return password; }
35 39
36 void setSSL( bool b ) { ssl = b; } 40 void setSSL( bool b ) { ssl = b; }
37 bool getSSL() { return ssl; } 41 bool getSSL() { return ssl; }
38 42
39 void setConnectionType( int x ) { connectionType = x; } 43 void setConnectionType( int x ) { connectionType = x; }
40 int ConnectionType() { return connectionType; } 44 int ConnectionType() { return connectionType; }
41 45
46 void setMaxMailSize( int x ) { maxMailSize = x; }
47 int getMaxMailSize() { return maxMailSize; }
42 48
43 void setOffline(bool b) {offline = b;} 49 void setOffline(bool b) {offline = b;}
44 bool getOffline()const{return offline;} 50 bool getOffline()const{return offline;}
45 51
46 virtual QString getFileName() { return accountName; } 52 virtual QString getFileName() { return accountName; }
47 virtual void read() { ; } 53 virtual void read() { ; }
48 virtual void save() { ; } 54 virtual void save() { ; }
49 55
50protected: 56protected:
51 QString accountName, server, port, user, password; 57 QString accountName, server, port, user, password;
52 bool ssl; 58 bool ssl;
53 int connectionType; 59 int connectionType;
54 bool offline; 60 bool offline;
55 MAILLIB::ATYPE type; 61 MAILLIB::ATYPE type;
62 QString localFolder;
63 int maxMailSize;
64 QDateTime lastFetch;
56}; 65};
57 66
58class IMAPaccount : public Account 67class IMAPaccount : public Account
59{ 68{
60 69
61public: 70public:
62 IMAPaccount(); 71 IMAPaccount();
63 IMAPaccount( QString filename ); 72 IMAPaccount( QString filename );
64 73
65 static QString getUniqueFileName(); 74 static QString getUniqueFileName();
66 75
67 virtual void read(); 76 virtual void read();
68 virtual void save(); 77 virtual void save();
69 virtual QString getFileName(); 78 virtual QString getFileName();
70 79
71 void setPrefix(const QString&str) {prefix=str;} 80 void setPrefix(const QString&str) {prefix=str;}
72 const QString&getPrefix()const{return prefix;} 81 const QString&getPrefix()const{return prefix;}
73 82
74private: 83private:
75 QString file,prefix; 84 QString file,prefix;
76 85
77}; 86};
78 87
79class POP3account : public Account 88class POP3account : public Account
80{ 89{
81 90
82public: 91public:
83 POP3account(); 92 POP3account();
84 POP3account( QString filename ); 93 POP3account( QString filename );
85 94
86 static QString getUniqueFileName(); 95 static QString getUniqueFileName();
87 96
88 virtual void read(); 97 virtual void read();
89 virtual void save(); 98 virtual void save();
90 virtual QString getFileName(); 99 virtual QString getFileName();
91 100
92private: 101private:
93 QString file; 102 QString file;
94 103
95}; 104};
96 105
97class SMTPaccount : public Account 106class SMTPaccount : public Account
98{ 107{
99 108
100public: 109public:
101 SMTPaccount(); 110 SMTPaccount();
102 SMTPaccount( QString filename ); 111 SMTPaccount( QString filename );
103 112
104 static QString getUniqueFileName(); 113 static QString getUniqueFileName();
105 114
106 virtual void read(); 115 virtual void read();
107 virtual void save(); 116 virtual void save();
108 virtual QString getFileName(); 117 virtual QString getFileName();
109 118
110 void setLogin( bool b ) { login = b; } 119 void setLogin( bool b ) { login = b; }
111 bool getLogin() { return login; } 120 bool getLogin() { return login; }
112 121
113private: 122private:
114 QString file, name, mail, org, cc, bcc, reply, signature; 123 QString file, name, mail, org, cc, bcc, reply, signature;
115 bool useCC, useBCC, useReply, login; 124 bool useCC, useBCC, useReply, login;
116 125
117}; 126};
118 127
119class NNTPaccount : public Account 128class NNTPaccount : public Account
120{ 129{
121 130
122public: 131public:
123 NNTPaccount(); 132 NNTPaccount();
124 NNTPaccount( QString filename ); 133 NNTPaccount( QString filename );
125 134
126 static QString getUniqueFileName(); 135 static QString getUniqueFileName();
127 136
128 virtual void read(); 137 virtual void read();
129 virtual void save(); 138 virtual void save();
130 virtual QString getFileName(); 139 virtual QString getFileName();
131 140
132 void setLogin( bool b ) { login = b; } 141 void setLogin( bool b ) { login = b; }
133 bool getLogin() { return login; } 142 bool getLogin() { return login; }
134 143
135 void setGroups( QStringList list ) { subscribedGroups = list; } 144 void setGroups( QStringList list ) { subscribedGroups = list; }
136 QStringList getGroups() { return subscribedGroups; } 145 QStringList getGroups() { return subscribedGroups; }
137 146
138private: 147private:
139 QString file; 148 QString file;
140 bool login; 149 bool login;
141 QStringList subscribedGroups; 150 QStringList subscribedGroups;
142 151
143}; 152};
144 153
145class Settings : public QObject 154class Settings : public QObject
146{ 155{
147 Q_OBJECT 156 Q_OBJECT
148 157
149public: 158public:
150 Settings(); 159 Settings();
151 QList<Account> getAccounts(); 160 QList<Account> getAccounts();
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui
index 1014ef4..a2d43bd 100644
--- a/kmicromail/pop3configui.ui
+++ b/kmicromail/pop3configui.ui
@@ -1,131 +1,131 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
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>322</width>
15 <height>410</height> 15 <height>404</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>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>spacing</name> 49 <name>spacing</name>
50 <number>6</number> 50 <number>6</number>
51 </property> 51 </property>
52 <widget> 52 <widget>
53 <class>QLabel</class> 53 <class>QLabel</class>
54 <property stdset="1"> 54 <property stdset="1">
55 <name>name</name> 55 <name>name</name>
56 <cstring>accountLabel</cstring> 56 <cstring>accountLabel</cstring>
57 </property> 57 </property>
58 <property stdset="1"> 58 <property stdset="1">
59 <name>text</name> 59 <name>text</name>
60 <string>Account</string> 60 <string>Account</string>
61 </property> 61 </property>
62 </widget> 62 </widget>
63 <widget> 63 <widget>
64 <class>QLineEdit</class> 64 <class>QLineEdit</class>
65 <property stdset="1"> 65 <property stdset="1">
66 <name>name</name> 66 <name>name</name>
67 <cstring>accountLine</cstring> 67 <cstring>accountLine</cstring>
68 </property> 68 </property>
69 <property> 69 <property>
70 <name>toolTip</name> 70 <name>toolTip</name>
71 <string>Name of the Account</string> 71 <string>Name of the Account</string>
72 </property> 72 </property>
73 </widget> 73 </widget>
74 </hbox> 74 </hbox>
75 </widget> 75 </widget>
76 <widget> 76 <widget>
77 <class>Line</class> 77 <class>Line</class>
78 <property stdset="1"> 78 <property stdset="1">
79 <name>name</name> 79 <name>name</name>
80 <cstring>line1</cstring> 80 <cstring>line1</cstring>
81 </property> 81 </property>
82 <property stdset="1"> 82 <property stdset="1">
83 <name>orientation</name> 83 <name>orientation</name>
84 <enum>Horizontal</enum> 84 <enum>Horizontal</enum>
85 </property> 85 </property>
86 </widget> 86 </widget>
87 <widget> 87 <widget>
88 <class>QLayoutWidget</class> 88 <class>QLayoutWidget</class>
89 <property stdset="1"> 89 <property stdset="1">
90 <name>name</name> 90 <name>name</name>
91 <cstring>Layout11</cstring> 91 <cstring>Layout11</cstring>
92 </property> 92 </property>
93 <hbox> 93 <hbox>
94 <property stdset="1"> 94 <property stdset="1">
95 <name>margin</name> 95 <name>margin</name>
96 <number>0</number> 96 <number>0</number>
97 </property> 97 </property>
98 <property stdset="1"> 98 <property stdset="1">
99 <name>spacing</name> 99 <name>spacing</name>
100 <number>6</number> 100 <number>6</number>
101 </property> 101 </property>
102 <widget> 102 <widget>
103 <class>QLayoutWidget</class> 103 <class>QLayoutWidget</class>
104 <property stdset="1"> 104 <property stdset="1">
105 <name>name</name> 105 <name>name</name>
106 <cstring>Layout9</cstring> 106 <cstring>Layout9</cstring>
107 </property> 107 </property>
108 <vbox> 108 <vbox>
109 <property stdset="1"> 109 <property stdset="1">
110 <name>margin</name> 110 <name>margin</name>
111 <number>0</number> 111 <number>0</number>
112 </property> 112 </property>
113 <property stdset="1"> 113 <property stdset="1">
114 <name>spacing</name> 114 <name>spacing</name>
115 <number>6</number> 115 <number>6</number>
116 </property> 116 </property>
117 <widget> 117 <widget>
118 <class>QLabel</class> 118 <class>QLabel</class>
119 <property stdset="1"> 119 <property stdset="1">
120 <name>name</name> 120 <name>name</name>
121 <cstring>serverLabel</cstring> 121 <cstring>serverLabel</cstring>
122 </property> 122 </property>
123 <property stdset="1"> 123 <property stdset="1">
124 <name>text</name> 124 <name>text</name>
125 <string>Server</string> 125 <string>Server</string>
126 </property> 126 </property>
127 </widget> 127 </widget>
128 <widget> 128 <widget>
129 <class>QLabel</class> 129 <class>QLabel</class>
130 <property stdset="1"> 130 <property stdset="1">
131 <name>name</name> 131 <name>name</name>
@@ -226,127 +226,213 @@
226 <property stdset="1"> 226 <property stdset="1">
227 <name>orientation</name> 227 <name>orientation</name>
228 <enum>Horizontal</enum> 228 <enum>Horizontal</enum>
229 </property> 229 </property>
230 </widget> 230 </widget>
231 <widget> 231 <widget>
232 <class>QLayoutWidget</class> 232 <class>QLayoutWidget</class>
233 <property stdset="1"> 233 <property stdset="1">
234 <name>name</name> 234 <name>name</name>
235 <cstring>Layout6</cstring> 235 <cstring>Layout6</cstring>
236 </property> 236 </property>
237 <hbox> 237 <hbox>
238 <property stdset="1"> 238 <property stdset="1">
239 <name>margin</name> 239 <name>margin</name>
240 <number>0</number> 240 <number>0</number>
241 </property> 241 </property>
242 <property stdset="1"> 242 <property stdset="1">
243 <name>spacing</name> 243 <name>spacing</name>
244 <number>6</number> 244 <number>6</number>
245 </property> 245 </property>
246 <widget> 246 <widget>
247 <class>QLayoutWidget</class> 247 <class>QLayoutWidget</class>
248 <property stdset="1"> 248 <property stdset="1">
249 <name>name</name> 249 <name>name</name>
250 <cstring>Layout4</cstring> 250 <cstring>Layout4</cstring>
251 </property> 251 </property>
252 <vbox> 252 <vbox>
253 <property stdset="1"> 253 <property stdset="1">
254 <name>margin</name> 254 <name>margin</name>
255 <number>0</number> 255 <number>0</number>
256 </property> 256 </property>
257 <property stdset="1"> 257 <property stdset="1">
258 <name>spacing</name> 258 <name>spacing</name>
259 <number>6</number> 259 <number>6</number>
260 </property> 260 </property>
261 <widget> 261 <widget>
262 <class>QLabel</class> 262 <class>QLabel</class>
263 <property stdset="1"> 263 <property stdset="1">
264 <name>name</name> 264 <name>name</name>
265 <cstring>userLabel</cstring> 265 <cstring>userLabel</cstring>
266 </property> 266 </property>
267 <property stdset="1"> 267 <property stdset="1">
268 <name>text</name> 268 <name>text</name>
269 <string>User</string> 269 <string>User</string>
270 </property> 270 </property>
271 </widget> 271 </widget>
272 <widget> 272 <widget>
273 <class>QLabel</class> 273 <class>QLabel</class>
274 <property stdset="1"> 274 <property stdset="1">
275 <name>name</name> 275 <name>name</name>
276 <cstring>passLabel</cstring> 276 <cstring>passLabel</cstring>
277 </property> 277 </property>
278 <property stdset="1"> 278 <property stdset="1">
279 <name>text</name> 279 <name>text</name>
280 <string>Password</string> 280 <string>Password</string>
281 </property> 281 </property>
282 </widget> 282 </widget>
283 </vbox> 283 </vbox>
284 </widget> 284 </widget>
285 <widget> 285 <widget>
286 <class>QLayoutWidget</class> 286 <class>QLayoutWidget</class>
287 <property stdset="1"> 287 <property stdset="1">
288 <name>name</name> 288 <name>name</name>
289 <cstring>Layout5</cstring> 289 <cstring>Layout5</cstring>
290 </property> 290 </property>
291 <vbox> 291 <vbox>
292 <property stdset="1"> 292 <property stdset="1">
293 <name>margin</name> 293 <name>margin</name>
294 <number>0</number> 294 <number>0</number>
295 </property> 295 </property>
296 <property stdset="1"> 296 <property stdset="1">
297 <name>spacing</name> 297 <name>spacing</name>
298 <number>6</number> 298 <number>6</number>
299 </property> 299 </property>
300 <widget> 300 <widget>
301 <class>QLineEdit</class> 301 <class>QLineEdit</class>
302 <property stdset="1"> 302 <property stdset="1">
303 <name>name</name> 303 <name>name</name>
304 <cstring>userLine</cstring> 304 <cstring>userLine</cstring>
305 </property> 305 </property>
306 </widget> 306 </widget>
307 <widget> 307 <widget>
308 <class>QLineEdit</class> 308 <class>QLineEdit</class>
309 <property stdset="1"> 309 <property stdset="1">
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>QLayoutWidget</class>
324 <property stdset="1">
325 <name>name</name>
326 <cstring>Layout9</cstring>
327 </property>
328 <hbox>
329 <property stdset="1">
330 <name>margin</name>
331 <number>0</number>
332 </property>
333 <property stdset="1">
334 <name>spacing</name>
335 <number>6</number>
336 </property>
337 <widget>
338 <class>QLabel</class>
339 <property stdset="1">
340 <name>name</name>
341 <cstring>TextLabel1_2</cstring>
342 </property>
343 <property stdset="1">
344 <name>text</name>
345 <string>Local storage folder:</string>
346 </property>
347 </widget>
348 <widget>
349 <class>QLineEdit</class>
350 <property stdset="1">
351 <name>name</name>
352 <cstring>localFolder</cstring>
353 </property>
354 <property stdset="1">
355 <name>text</name>
356 <string></string>
357 </property>
358 </widget>
359 </hbox>
360 </widget>
361 <widget>
362 <class>QLayoutWidget</class>
363 <property stdset="1">
364 <name>name</name>
365 <cstring>Layout10</cstring>
366 </property>
367 <hbox>
368 <property stdset="1">
369 <name>margin</name>
370 <number>0</number>
371 </property>
372 <property stdset="1">
373 <name>spacing</name>
374 <number>6</number>
375 </property>
376 <widget>
377 <class>QCheckBox</class>
378 <property stdset="1">
379 <name>name</name>
380 <cstring>CheckBoxDown</cstring>
381 </property>
382 <property stdset="1">
383 <name>text</name>
384 <string>Download only messages smaller</string>
385 </property>
386 </widget>
387 <widget>
388 <class>QSpinBox</class>
389 <property stdset="1">
390 <name>name</name>
391 <cstring>SpinBoxDown</cstring>
392 </property>
393 <property stdset="1">
394 <name>suffix</name>
395 <string>kB</string>
396 </property>
397 <property stdset="1">
398 <name>maxValue</name>
399 <number>99999</number>
400 </property>
401 <property stdset="1">
402 <name>minValue</name>
403 <number>1</number>
404 </property>
405 </widget>
406 </hbox>
407 </widget>
322 <spacer> 408 <spacer>
323 <property> 409 <property>
324 <name>name</name> 410 <name>name</name>
325 <cstring>spacer</cstring> 411 <cstring>spacer</cstring>
326 </property> 412 </property>
327 <property stdset="1"> 413 <property stdset="1">
328 <name>orientation</name> 414 <name>orientation</name>
329 <enum>Vertical</enum> 415 <enum>Vertical</enum>
330 </property> 416 </property>
331 <property stdset="1"> 417 <property stdset="1">
332 <name>sizeType</name> 418 <name>sizeType</name>
333 <enum>Expanding</enum> 419 <enum>Expanding</enum>
334 </property> 420 </property>
335 <property> 421 <property>
336 <name>sizeHint</name> 422 <name>sizeHint</name>
337 <size> 423 <size>
338 <width>20</width> 424 <width>20</width>
339 <height>20</height> 425 <height>20</height>
340 </size> 426 </size>
341 </property> 427 </property>
342 </spacer> 428 </spacer>
343 </vbox> 429 </vbox>
344</widget> 430</widget>
345<tabstops> 431<tabstops>
346 <tabstop>accountLine</tabstop> 432 <tabstop>accountLine</tabstop>
347 <tabstop>serverLine</tabstop> 433 <tabstop>serverLine</tabstop>
348 <tabstop>portLine</tabstop> 434 <tabstop>portLine</tabstop>
349 <tabstop>userLine</tabstop> 435 <tabstop>userLine</tabstop>
350 <tabstop>passLine</tabstop> 436 <tabstop>passLine</tabstop>
351</tabstops> 437</tabstops>
352</UI> 438</UI>