summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
Unidiff
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 2c0f2d8..f274dc3 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -7,60 +7,60 @@
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9/* QT */ 9/* QT */
10#include <qstringlist.h> 10#include <qstringlist.h>
11 11
12#include <qcombobox.h> 12#include <qcombobox.h>
13#include <qcheckbox.h> 13#include <qcheckbox.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15#include <qpushbutton.h> 15#include <qpushbutton.h>
16#include <qlineedit.h> 16#include <qlineedit.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qtabwidget.h> 18#include <qtabwidget.h>
19#include <qlistview.h> 19#include <q3listview.h>
20#include <qspinbox.h> 20#include <qspinbox.h>
21#include <klocale.h> 21#include <klocale.h>
22#include <kfiledialog.h> 22#include <kfiledialog.h>
23 23
24#include <libmailwrapper/nntpwrapper.h> 24#include <libmailwrapper/nntpwrapper.h>
25 25
26using namespace Opie::Core; 26using namespace Opie::Core;
27 27
28AccountListItem::AccountListItem( QListView *parent, Account *a) 28AccountListItem::AccountListItem( Q3ListView *parent, Account *a)
29 : QListViewItem( parent ) 29 : Q3ListViewItem( parent )
30{ 30{
31 account = a; 31 account = a;
32 setText( 0, account->getAccountName() ); 32 setText( 0, account->getAccountName() );
33 QString ttext = ""; 33 QString ttext = "";
34 switch (account->getType()) { 34 switch (account->getType()) {
35 case MAILLIB::A_NNTP: 35 case MAILLIB::A_NNTP:
36 ttext="NNTP"; 36 ttext="NNTP";
37 break; 37 break;
38 case MAILLIB::A_POP3: 38 case MAILLIB::A_POP3:
39 ttext = "POP3"; 39 ttext = "POP3";
40 break; 40 break;
41 case MAILLIB::A_IMAP: 41 case MAILLIB::A_IMAP:
42 ttext = "IMAP"; 42 ttext = "IMAP";
43 break; 43 break;
44 case MAILLIB::A_SMTP: 44 case MAILLIB::A_SMTP:
45 ttext = "SMTP"; 45 ttext = "SMTP";
46 break; 46 break;
47 default: 47 default:
48 ttext = "UNKNOWN"; 48 ttext = "UNKNOWN";
49 break; 49 break;
50 } 50 }
51 setText( 1, ttext); 51 setText( 1, ttext);
52} 52}
53 53
54EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 54EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
55 : EditAccountsUI( parent, name, modal, flags ) 55 : EditAccountsUI( parent, name, modal, flags )
56{ 56{
57 settings = s; 57 settings = s;
58 58
59 mailList->addColumn( i18n( "Account" ) ); 59 mailList->addColumn( i18n( "Account" ) );
60 mailList->addColumn( i18n( "Type" ) ); 60 mailList->addColumn( i18n( "Type" ) );
61 61
62 newsList->addColumn( i18n( "Account" ) ); 62 newsList->addColumn( i18n( "Account" ) );
63 63
64 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 64 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
65 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 65 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
66 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 66 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
@@ -299,42 +299,42 @@ void EditAccounts::slotAdjustColumns()
299 299
300void EditAccounts::accept() 300void EditAccounts::accept()
301{ 301{
302 settings->saveAccounts(); 302 settings->saveAccounts();
303 303
304 QDialog::accept(); 304 QDialog::accept();
305} 305}
306 306
307/** 307/**
308 * SelectMailType 308 * SelectMailType
309 */ 309 */
310 310
311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 311SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
312 : SelectMailTypeUI( parent, name, modal, flags ) 312 : SelectMailTypeUI( parent, name, modal, flags )
313{ 313{
314 selected = selection; 314 selected = selection;
315 selected->replace( 0, selected->length(), typeBox->currentText() ); 315 selected->replace( 0, selected->length(), typeBox->currentText() );
316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 316 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
317} 317}
318 318
319void SelectMailType::slotSelection( const QString &sel ) 319void SelectMailType::slotSelection( const QString &sel )
320{ 320{
321 selected->replace( 0, selected->length(), sel ); 321 selected->replace( 0, selected->length(), sel );
322} 322}
323 323
324/** 324/**
325 * IMAPconfig 325 * IMAPconfig
326 */ 326 */
327 327
328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 328IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
329 : IMAPconfigUI( parent, name, modal, flags ) 329 : IMAPconfigUI( parent, name, modal, flags )
330{ 330{
331 data = account; 331 data = account;
332 332
333 //fillValues(); 333 //fillValues();
334 334
335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 335 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
336 ComboBox1->insertItem( "Only if available", 0 ); 336 ComboBox1->insertItem( "Only if available", 0 );
337 ComboBox1->insertItem( "Always, Negotiated", 1 ); 337 ComboBox1->insertItem( "Always, Negotiated", 1 );
338 ComboBox1->insertItem( "Connect on secure port", 2 ); 338 ComboBox1->insertItem( "Connect on secure port", 2 );
339 ComboBox1->insertItem( "Run command instead", 3 ); 339 ComboBox1->insertItem( "Run command instead", 3 );
340 CommandEdit->hide(); 340 CommandEdit->hide();
@@ -399,25 +399,25 @@ void IMAPconfig::accept()
399 data->setPrefix(prefixLine->text()); 399 data->setPrefix(prefixLine->text());
400 data->setLocalFolder( localFolder->text() ); 400 data->setLocalFolder( localFolder->text() );
401 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 401 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
402 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 402 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
403 403
404 QDialog::accept(); 404 QDialog::accept();
405} 405}
406 406
407/** 407/**
408 * POP3config 408 * POP3config
409 */ 409 */
410 410
411POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 411POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
412 : POP3configUI( parent, name, modal, flags ) 412 : POP3configUI( parent, name, modal, flags )
413{ 413{
414 data = account; 414 data = account;
415 //fillValues(); 415 //fillValues();
416 416
417 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 417 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
418 ComboBox1->insertItem( "Only if available", 0 ); 418 ComboBox1->insertItem( "Only if available", 0 );
419 ComboBox1->insertItem( "Always, Negotiated", 1 ); 419 ComboBox1->insertItem( "Always, Negotiated", 1 );
420 ComboBox1->insertItem( "Connect on secure port", 2 ); 420 ComboBox1->insertItem( "Connect on secure port", 2 );
421 ComboBox1->insertItem( "Run command instead", 3 ); 421 ComboBox1->insertItem( "Run command instead", 3 );
422 CommandEdit->hide(); 422 CommandEdit->hide();
423 fillValues(); 423 fillValues();
@@ -480,34 +480,34 @@ void POP3config::accept()
480 data->setPassword( passLine->text() ); 480 data->setPassword( passLine->text() );
481 data->setLocalFolder( localFolder->text() ); 481 data->setLocalFolder( localFolder->text() );
482 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 482 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
483 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 483 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
484 484
485 QDialog::accept(); 485 QDialog::accept();
486} 486}
487 487
488/** 488/**
489 * SMTPconfig 489 * SMTPconfig
490 */ 490 */
491 491
492SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 492SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
493 : SMTPconfigUI( parent, name, modal, flags ) 493 : SMTPconfigUI( parent, name, modal, flags )
494{ 494{
495 data = account; 495 data = account;
496 496
497 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 497 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
498 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 498 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
499 499
500 // fillValues(); 500 // fillValues();
501 QIconSet icon; 501 QIcon icon;
502 //icon = SmallIcon("fileexport"); 502 //icon = SmallIcon("fileexport");
503 icon = SmallIcon("fileopen"); 503 icon = SmallIcon("fileopen");
504 SignaturButton->setText(""); 504 SignaturButton->setText("");
505 SignaturButton->setIconSet (icon ) ; 505 SignaturButton->setIconSet (icon ) ;
506 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; 506 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
507 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); 507 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
508 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 508 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
509 ComboBox1->insertItem( "No secure connection, no TLS", 0 ); 509 ComboBox1->insertItem( "No secure connection, no TLS", 0 );
510 ComboBox1->insertItem( "Only if available, try TLS", 1 ); 510 ComboBox1->insertItem( "Only if available, try TLS", 1 );
511 ComboBox1->insertItem( "Always, use TLS", 2 ); 511 ComboBox1->insertItem( "Always, use TLS", 2 );
512 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 ); 512 ComboBox1->insertItem( "Connect on secure port (SSL)", 3 );
513 ComboBox1->insertItem( "Run command instead", 4 ); 513 ComboBox1->insertItem( "Run command instead", 4 );
@@ -563,83 +563,83 @@ void SMTPconfig::accept()
563 data->setLogin( loginBox->isChecked() ); 563 data->setLogin( loginBox->isChecked() );
564 data->setUser( userLine->text() ); 564 data->setUser( userLine->text() );
565 data->setPassword( passLine->text() ); 565 data->setPassword( passLine->text() );
566 data->setSigFile( SignaturEdit->text() ); 566 data->setSigFile( SignaturEdit->text() );
567 567
568 QDialog::accept(); 568 QDialog::accept();
569} 569}
570 570
571/** 571/**
572 * NNTPconfig 572 * NNTPconfig
573 */ 573 */
574 574
575NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 575NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, Qt::WFlags flags )
576 : NNTPconfigUI( parent, name, modal, flags ) 576 : NNTPconfigUI( parent, name, modal, flags )
577{ 577{
578 data = account; 578 data = account;
579 579
580 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 580 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
581 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 581 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
582 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 582 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
583 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 583 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
584 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 584 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
585 fillValues(); 585 fillValues();
586 586
587 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 587 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
588} 588}
589 589
590void NNTPconfig::slotShowSub() 590void NNTPconfig::slotShowSub()
591{ 591{
592 save(); 592 save();
593 data->save(); 593 data->save();
594 ListViewGroups->clear(); 594 ListViewGroups->clear();
595 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 595 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
596 QCheckListItem *item; 596 Q3CheckListItem *item;
597 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 597 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
598 item->setOn( true ); 598 item->setOn( true );
599 } 599 }
600 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); 600 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
601} 601}
602void NNTPconfig::slotShowFilter() 602void NNTPconfig::slotShowFilter()
603{ 603{
604 save(); 604 save();
605 data->save(); 605 data->save();
606 ListViewGroups->clear(); 606 ListViewGroups->clear();
607 int count = 0; 607 int count = 0;
608 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 608 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
609 QCheckListItem *item; 609 Q3CheckListItem *item;
610 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 610 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
611 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 611 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
612 ++count; 612 ++count;
613 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 613 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
614 item->setOn( true ); 614 item->setOn( true );
615 } 615 }
616 } 616 }
617 } 617 }
618 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); 618 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
619} 619}
620void NNTPconfig::slotGetNG() { 620void NNTPconfig::slotGetNG() {
621 save(); 621 save();
622 data->save(); 622 data->save();
623 topLevelWidget()->setCaption( i18n("Fetching group list...")); 623 topLevelWidget()->setCaption( i18n("Fetching group list..."));
624 qApp->processEvents(); 624 qApp->processEvents();
625 NNTPwrapper* tmp = new NNTPwrapper( data ); 625 NNTPwrapper* tmp = new NNTPwrapper( data );
626 allGroups = tmp->listAllNewsgroups(); 626 allGroups = tmp->listAllNewsgroups();
627 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); 627 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
628 628
629 ListViewGroups->clear(); 629 ListViewGroups->clear();
630 630
631 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 631 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
632 QCheckListItem *item; 632 Q3CheckListItem *item;
633 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 633 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
634 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 634 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
635 item->setOn( true ); 635 item->setOn( true );
636 636
637 } 637 }
638 } 638 }
639 delete tmp; 639 delete tmp;
640} 640}
641 641
642void NNTPconfig::slotSSL( bool enabled ) 642void NNTPconfig::slotSSL( bool enabled )
643{ 643{
644 if ( enabled ) 644 if ( enabled )
645 { 645 {
@@ -654,45 +654,45 @@ void NNTPconfig::slotSSL( bool enabled )
654void NNTPconfig::fillValues() 654void NNTPconfig::fillValues()
655{ 655{
656 accountLine->setText( data->getAccountName() ); 656 accountLine->setText( data->getAccountName() );
657 serverLine->setText( data->getServer() ); 657 serverLine->setText( data->getServer() );
658 portLine->setText( data->getPort() ); 658 portLine->setText( data->getPort() );
659 sslBox->setChecked( data->getSSL() ); 659 sslBox->setChecked( data->getSSL() );
660 loginBox->setChecked( data->getLogin() ); 660 loginBox->setChecked( data->getLogin() );
661 userLine->setText( data->getUser() ); 661 userLine->setText( data->getUser() );
662 passLine->setText( data->getPassword() ); 662 passLine->setText( data->getPassword() );
663 subscribedGroups = data->getGroups(); 663 subscribedGroups = data->getGroups();
664 /* don't forget that - you will overwrite values if user clicks cancel! */ 664 /* don't forget that - you will overwrite values if user clicks cancel! */
665 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 665 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
666 QCheckListItem *item; 666 Q3CheckListItem *item;
667 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 667 item = new Q3CheckListItem( ListViewGroups, (*it), Q3CheckListItem::CheckBox );
668 item->setOn( true ); 668 item->setOn( true );
669 } 669 }
670} 670}
671 671
672void NNTPconfig::save() 672void NNTPconfig::save()
673{ 673{
674 data->setAccountName( accountLine->text() ); 674 data->setAccountName( accountLine->text() );
675 data->setServer( serverLine->text() ); 675 data->setServer( serverLine->text() );
676 data->setPort( portLine->text() ); 676 data->setPort( portLine->text() );
677 data->setSSL( sslBox->isChecked() ); 677 data->setSSL( sslBox->isChecked() );
678 data->setLogin( loginBox->isChecked() ); 678 data->setLogin( loginBox->isChecked() );
679 data->setUser( userLine->text() ); 679 data->setUser( userLine->text() );
680 data->setPassword( passLine->text() ); 680 data->setPassword( passLine->text() );
681 681
682 QListViewItemIterator list_it( ListViewGroups ); 682 Q3ListViewItemIterator list_it( ListViewGroups );
683 683
684 for ( ; list_it.current(); ++list_it ) { 684 for ( ; list_it.current(); ++list_it ) {
685 685
686 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 686 if ( ( (Q3CheckListItem*)list_it.current() )->isOn() ) {
687 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) 687 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
688 subscribedGroups.append( list_it.current()->text(0) ); 688 subscribedGroups.append( list_it.current()->text(0) );
689 } else { 689 } else {
690 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) 690 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
691 subscribedGroups.remove( list_it.current()->text(0) ); 691 subscribedGroups.remove( list_it.current()->text(0) );
692 } 692 }
693 693
694 } 694 }
695 data->setGroups( subscribedGroups ); 695 data->setGroups( subscribedGroups );
696} 696}
697 697
698void NNTPconfig::accept() 698void NNTPconfig::accept()