summaryrefslogtreecommitdiffabout
path: root/kmicromail/editaccounts.cpp
authorzautrix <zautrix>2005-02-03 10:48:05 (UTC)
committer zautrix <zautrix>2005-02-03 10:48:05 (UTC)
commitfb6753570dc90e936b4e89092554ab012e946a56 (patch) (unidiff)
tree6d3ae5c866f0bbb99f0b6bc8194d04d2c7681ff9 /kmicromail/editaccounts.cpp
parente0fce8c0f108e054cb6e4e4767affd04b398da45 (diff)
downloadkdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.zip
kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.tar.gz
kdepimpi-fb6753570dc90e936b4e89092554ab012e946a56.tar.bz2
mail fixes
Diffstat (limited to 'kmicromail/editaccounts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/editaccounts.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index 48c3963..8253c91 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,69 +1,70 @@
1 1
2#include <qdialog.h> 2#include <qdialog.h>
3#include "kapplication.h" 3#include "kapplication.h"
4#include "defines.h" 4#include "defines.h"
5#include "editaccounts.h" 5#include "editaccounts.h"
6/* OPIE */ 6/* OPIE */
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 <qlistview.h>
20#include <qspinbox.h> 20#include <qspinbox.h>
21#include <klocale.h> 21#include <klocale.h>
22#include <kfiledialog.h>
22 23
23#include <libmailwrapper/nntpwrapper.h> 24#include <libmailwrapper/nntpwrapper.h>
24 25
25using namespace Opie::Core; 26using namespace Opie::Core;
26 27
27AccountListItem::AccountListItem( QListView *parent, Account *a) 28AccountListItem::AccountListItem( QListView *parent, Account *a)
28 : QListViewItem( parent ) 29 : QListViewItem( parent )
29{ 30{
30 account = a; 31 account = a;
31 setText( 0, account->getAccountName() ); 32 setText( 0, account->getAccountName() );
32 QString ttext = ""; 33 QString ttext = "";
33 switch (account->getType()) { 34 switch (account->getType()) {
34 case MAILLIB::A_NNTP: 35 case MAILLIB::A_NNTP:
35 ttext="NNTP"; 36 ttext="NNTP";
36 break; 37 break;
37 case MAILLIB::A_POP3: 38 case MAILLIB::A_POP3:
38 ttext = "POP3"; 39 ttext = "POP3";
39 break; 40 break;
40 case MAILLIB::A_IMAP: 41 case MAILLIB::A_IMAP:
41 ttext = "IMAP"; 42 ttext = "IMAP";
42 break; 43 break;
43 case MAILLIB::A_SMTP: 44 case MAILLIB::A_SMTP:
44 ttext = "SMTP"; 45 ttext = "SMTP";
45 break; 46 break;
46 default: 47 default:
47 ttext = "UNKNOWN"; 48 ttext = "UNKNOWN";
48 break; 49 break;
49 } 50 }
50 setText( 1, ttext); 51 setText( 1, ttext);
51} 52}
52 53
53EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 54EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
54 : EditAccountsUI( parent, name, modal, flags ) 55 : EditAccountsUI( parent, name, modal, flags )
55{ 56{
56 settings = s; 57 settings = s;
57 58
58 mailList->addColumn( i18n( "Account" ) ); 59 mailList->addColumn( i18n( "Account" ) );
59 mailList->addColumn( i18n( "Type" ) ); 60 mailList->addColumn( i18n( "Type" ) );
60 61
61 newsList->addColumn( i18n( "Account" ) ); 62 newsList->addColumn( i18n( "Account" ) );
62 63
63 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 64 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
64 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 65 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
65 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 66 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
66 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 67 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
67 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 68 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
68 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 69 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
69 70
@@ -434,144 +435,158 @@ void POP3config::slotConnectionToggle( int index )
434void POP3config::fillValues() 435void POP3config::fillValues()
435{ 436{
436 accountLine->setText( data->getAccountName() ); 437 accountLine->setText( data->getAccountName() );
437 serverLine->setText( data->getServer() ); 438 serverLine->setText( data->getServer() );
438 portLine->setText( data->getPort() ); 439 portLine->setText( data->getPort() );
439 ComboBox1->setCurrentItem( data->ConnectionType() ); 440 ComboBox1->setCurrentItem( data->ConnectionType() );
440 userLine->setText( data->getUser() ); 441 userLine->setText( data->getUser() );
441 passLine->setText( data->getPassword() ); 442 passLine->setText( data->getPassword() );
442 localFolder->setText( data->getLocalFolder() ); 443 localFolder->setText( data->getLocalFolder() );
443 int max = data->getMaxMailSize() ; 444 int max = data->getMaxMailSize() ;
444 if ( max ) { 445 if ( max ) {
445 CheckBoxDown->setChecked( true ); 446 CheckBoxDown->setChecked( true );
446 SpinBoxDown->setValue ( max ); 447 SpinBoxDown->setValue ( max );
447 } else { 448 } else {
448 CheckBoxDown->setChecked( false ); 449 CheckBoxDown->setChecked( false );
449 SpinBoxDown->setValue ( 5 ); 450 SpinBoxDown->setValue ( 5 );
450 } 451 }
451 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 452 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
452} 453}
453 454
454void POP3config::accept() 455void POP3config::accept()
455{ 456{
456 data->setAccountName( accountLine->text() ); 457 data->setAccountName( accountLine->text() );
457 data->setServer( serverLine->text() ); 458 data->setServer( serverLine->text() );
458 data->setPort( portLine->text() ); 459 data->setPort( portLine->text() );
459 data->setConnectionType( ComboBox1->currentItem() ); 460 data->setConnectionType( ComboBox1->currentItem() );
460 data->setUser( userLine->text() ); 461 data->setUser( userLine->text() );
461 data->setPassword( passLine->text() ); 462 data->setPassword( passLine->text() );
462 data->setLocalFolder( localFolder->text() ); 463 data->setLocalFolder( localFolder->text() );
463 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 464 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
464 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 465 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
465 466
466 QDialog::accept(); 467 QDialog::accept();
467} 468}
468 469
469/** 470/**
470 * SMTPconfig 471 * SMTPconfig
471 */ 472 */
472 473
473SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 474SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
474 : SMTPconfigUI( parent, name, modal, flags ) 475 : SMTPconfigUI( parent, name, modal, flags )
475{ 476{
476 data = account; 477 data = account;
477 478
478 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 479 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
479 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 480 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
480 481
481 fillValues(); 482 fillValues();
482 483 QIconSet icon;
484 //icon = SmallIcon("fileexport");
485 icon = SmallIcon("fileopen");
486 SignaturButton->setText("");
487 SignaturButton->setIconSet (icon ) ;
488 SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ;
489 connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) );
483 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 490 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
484 ComboBox1->insertItem( "Only if available", 0 ); 491 ComboBox1->insertItem( "Only if available", 0 );
485 ComboBox1->insertItem( "Always, Negotiated", 1 ); 492 ComboBox1->insertItem( "Always, Negotiated", 1 );
486 ComboBox1->insertItem( "Connect on secure port", 2 ); 493 ComboBox1->insertItem( "Connect on secure port", 2 );
487 ComboBox1->insertItem( "Run command instead", 3 ); 494 ComboBox1->insertItem( "Run command instead", 3 );
488 CommandEdit->hide(); 495 CommandEdit->hide();
489 ComboBox1->setCurrentItem( data->ConnectionType() ); 496 ComboBox1->setCurrentItem( data->ConnectionType() );
490} 497}
491 498void SMTPconfig::chooseSig()
499{
500 QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this );
501 if ( !lnk.isEmpty() ) {
502 SignaturEdit->setText( lnk );
503 }
504}
492void SMTPconfig::slotConnectionToggle( int index ) 505void SMTPconfig::slotConnectionToggle( int index )
493{ 506{
494 // 2 is ssl connection 507 // 2 is ssl connection
495 if ( index == 2 ) 508 if ( index == 2 )
496 { 509 {
497 portLine->setText( SMTP_SSL_PORT ); 510 portLine->setText( SMTP_SSL_PORT );
498 } 511 }
499 else if ( index == 3 ) 512 else if ( index == 3 )
500 { 513 {
501 portLine->setText( SMTP_PORT ); 514 portLine->setText( SMTP_PORT );
502 CommandEdit->show(); 515 CommandEdit->show();
503 } 516 }
504 else 517 else
505 { 518 {
506 portLine->setText( SMTP_PORT ); 519 portLine->setText( SMTP_PORT );
507 } 520 }
508} 521}
509 522
510void SMTPconfig::fillValues() 523void SMTPconfig::fillValues()
511{ 524{
512 accountLine->setText( data->getAccountName() ); 525 accountLine->setText( data->getAccountName() );
513 serverLine->setText( data->getServer() ); 526 serverLine->setText( data->getServer() );
514 portLine->setText( data->getPort() ); 527 portLine->setText( data->getPort() );
515 ComboBox1->setCurrentItem( data->ConnectionType() ); 528 ComboBox1->setCurrentItem( data->ConnectionType() );
516 loginBox->setChecked( data->getLogin() ); 529 loginBox->setChecked( data->getLogin() );
517 userLine->setText( data->getUser() ); 530 userLine->setText( data->getUser() );
518 passLine->setText( data->getPassword() ); 531 passLine->setText( data->getPassword() );
532 SignaturEdit->setText( data->getSigFile() );
519} 533}
520 534
521void SMTPconfig::accept() 535void SMTPconfig::accept()
522{ 536{
523 data->setAccountName( accountLine->text() ); 537 data->setAccountName( accountLine->text() );
524 data->setServer( serverLine->text() ); 538 data->setServer( serverLine->text() );
525 data->setPort( portLine->text() ); 539 data->setPort( portLine->text() );
526 data->setConnectionType( ComboBox1->currentItem() ); 540 data->setConnectionType( ComboBox1->currentItem() );
527 data->setLogin( loginBox->isChecked() ); 541 data->setLogin( loginBox->isChecked() );
528 data->setUser( userLine->text() ); 542 data->setUser( userLine->text() );
529 data->setPassword( passLine->text() ); 543 data->setPassword( passLine->text() );
544 data->setSigFile( SignaturEdit->text() );
530 545
531 QDialog::accept(); 546 QDialog::accept();
532} 547}
533 548
534/** 549/**
535 * NNTPconfig 550 * NNTPconfig
536 */ 551 */
537 552
538NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 553NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
539 : NNTPconfigUI( parent, name, modal, flags ) 554 : NNTPconfigUI( parent, name, modal, flags )
540{ 555{
541 data = account; 556 data = account;
542 557
543 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 558 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
544 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 559 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
545 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 560 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
546 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 561 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
547 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 562 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
548 fillValues(); 563 fillValues();
549 564
550 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 565 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
551} 566}
552 567
553void NNTPconfig::slotShowSub() 568void NNTPconfig::slotShowSub()
554{ 569{
555 save(); 570 save();
556 data->save(); 571 data->save();
557 ListViewGroups->clear(); 572 ListViewGroups->clear();
558 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 573 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
559 QCheckListItem *item; 574 QCheckListItem *item;
560 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 575 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
561 item->setOn( true ); 576 item->setOn( true );
562 } 577 }
563 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); 578 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
564} 579}
565void NNTPconfig::slotShowFilter() 580void NNTPconfig::slotShowFilter()
566{ 581{
567 save(); 582 save();
568 data->save(); 583 data->save();
569 ListViewGroups->clear(); 584 ListViewGroups->clear();
570 int count = 0; 585 int count = 0;
571 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 586 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
572 QCheckListItem *item; 587 QCheckListItem *item;
573 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 588 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
574 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 589 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
575 ++count; 590 ++count;
576 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 591 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
577 item->setOn( true ); 592 item->setOn( true );