30#include <tdefiledialog.h> 
   32#include <tdelistbox.h> 
   35#include <tqcheckbox.h> 
   40#include <tqpushbutton.h> 
   43#include "kmacctlocal.h" 
   45#include "popaccount.h" 
   46#include "kmacctimap.h" 
   47#include "kmacctcachedimap.h" 
   48#include "kmacctmaildir.h" 
   49#include "accountmanager.h" 
   52#include "globalsettings.h" 
   53#include "kmservertest.h" 
   54#include "kmtransport.h" 
   55#include "libkpimidentities/identity.h" 
   56#include "libkpimidentities/identitymanager.h" 
   59#include "accountwizard.h" 
   79class AccountTypeBox : 
public TDEListBox
 
   82    enum Type { Local, POP3, IMAP, dIMAP, Maildir };
 
   84    AccountTypeBox( TQWidget *parent )
 
   85      : TDEListBox( parent, 
"AccountTypeBox" )
 
   87      mTypeList << i18n( 
"Local mailbox" );
 
   88      mTypeList << i18n( 
"POP3" );
 
   89      mTypeList << i18n( 
"IMAP" );
 
   90      mTypeList << i18n( 
"Disconnected IMAP" );
 
   91      mTypeList << i18n( 
"Maildir mailbox" );
 
   93      insertStringList( mTypeList );
 
   96    void setType( Type type )
 
   98      setCurrentItem( (
int)type );
 
  103      return (Type)currentItem();
 
  107    TQStringList mTypeList;
 
  110AccountWizard::AccountWizard( 
KMKernel *kernel, TQWidget *parent )
 
  111  : KWizard( parent, 
"KWizard" ), mKernel( kernel ),
 
  112    mAccount( 0 ), mTransportInfo( 0 ), mServerTest( 0 )
 
  115  setupAccountTypePage();
 
  116  setupAccountInformationPage();
 
  117  setupLoginInformationPage();
 
  118  setupServerInformationPage();
 
  121void AccountWizard::start( 
KMKernel *kernel, TQWidget *parent )
 
  123  TDEConfigGroup wizardConfig( KMKernel::config(), 
"AccountWizard" );
 
  125  if ( wizardConfig.readBoolEntry( 
"ShowOnStartup", 
true ) ) {
 
  126    AccountWizard wizard( kernel, parent );
 
  127    int result = wizard.exec();
 
  128    if ( result == TQDialog::Accepted ) {
 
  129      wizardConfig.writeEntry( 
"ShowOnStartup", 
false );
 
  130      kernel->slotConfigChanged();
 
  135void AccountWizard::showPage( TQWidget *page )
 
  137  if ( page == mWelcomePage ) {
 
  139  } 
else if ( page == mAccountTypePage ) {
 
  140    if ( mTypeBox->currentItem() == -1 )
 
  141      mTypeBox->setType( AccountTypeBox::POP3 );
 
  142  } 
else if ( page == mAccountInformationPage ) {
 
  143    if ( mRealName->text().isEmpty() && mEMailAddress->text().isEmpty() &&
 
  144         mOrganization->text().isEmpty() ) {
 
  145      KPIM::IdentityManager *manager = mKernel->identityManager();
 
  146      const KPIM::Identity &identity = manager->defaultIdentity();
 
  148      mRealName->setText( identity.fullName() );
 
  149      mEMailAddress->setText( identity.primaryEmailAddress() );
 
  150      mOrganization->setText( identity.organization() );
 
  152  } 
else if ( page == mLoginInformationPage ) {
 
  153    if ( mLoginName->text().isEmpty() ) {
 
  155      TQString email = mEMailAddress->text();
 
  156      int pos = email.find( 
'@' );
 
  158        mLoginName->setText( email.left( pos ) );
 
  162  } 
else if ( page == mServerInformationPage ) {
 
  163    if ( mTypeBox->type() == AccountTypeBox::Local ||
 
  164         mTypeBox->type() == AccountTypeBox::Maildir ) {
 
  165      mIncomingServerWdg->hide();
 
  166      mIncomingLocationWdg->show();
 
  167      mIncomingLabel->setText( i18n( 
"Location:" ) );
 
  169      if ( mTypeBox->type() == AccountTypeBox::Local )
 
  170        mIncomingLocation->setText( TQDir::homeDirPath() + 
"/inbox" );
 
  172        mIncomingLocation->setText( TQDir::homeDirPath() + 
"/Mail/" );
 
  174      mIncomingLocationWdg->hide();
 
  175      mIncomingServerWdg->show();
 
  176      mIncomingLabel->setText( i18n( 
"Incoming server:" ) );
 
  179    setFinishEnabled( mServerInformationPage, 
true );
 
  182  TQWizard::showPage( page );
 
  185void AccountWizard::setupWelcomePage()
 
  187  mWelcomePage = 
new TQVBox( 
this );
 
  188  ((TQVBox*)mWelcomePage)->setSpacing( KDialog::spacingHint() );
 
  190  TQLabel *label = 
new TQLabel( i18n( 
"Welcome to KMail" ), mWelcomePage );
 
  191  TQFont font = label->font();
 
  192  font.setBold( 
true );
 
  193  label->setFont( font );
 
  195  new TQLabel( i18n( 
"<qt>It seems you have started KMail for the first time. " 
  196                    "You can use this wizard to setup your mail accounts. Just " 
  197                    "enter the connection data that you received from your email provider " 
  198                    "into the following pages.</qt>" ), mWelcomePage );
 
  200  addPage( mWelcomePage, i18n( 
"Welcome" ) );
 
  203void AccountWizard::setupAccountTypePage()
 
  205  mAccountTypePage = 
new TQVBox( 
this );
 
  206  ((TQVBox*)mAccountTypePage)->setSpacing( KDialog::spacingHint() );
 
  208  new TQLabel( i18n( 
"Select what kind of account you would like to create" ), mAccountTypePage );
 
  210  mTypeBox = 
new AccountTypeBox( mAccountTypePage );
 
  212  addPage( mAccountTypePage, i18n( 
"Account Type" ) );
 
  215void AccountWizard::setupAccountInformationPage()
 
  217  mAccountInformationPage = 
new TQWidget( 
this );
 
  218  TQGridLayout *layout = 
new TQGridLayout( mAccountInformationPage, 3, 2,
 
  219                                         KDialog::marginHint(), KDialog::spacingHint() );
 
  221  TQLabel *label = 
new TQLabel( i18n( 
"Real name:" ), mAccountInformationPage );
 
  222  mRealName = 
new KLineEdit( mAccountInformationPage );
 
  223  label->setBuddy( mRealName );
 
  225  layout->addWidget( label, 0, 0 );
 
  226  layout->addWidget( mRealName, 0, 1 );
 
  228  label = 
new TQLabel( i18n( 
"E-mail address:" ), mAccountInformationPage );
 
  229  mEMailAddress = 
new KLineEdit( mAccountInformationPage );
 
  230  label->setBuddy( mEMailAddress );
 
  232  layout->addWidget( label, 1, 0 );
 
  233  layout->addWidget( mEMailAddress, 1, 1 );
 
  235  label = 
new TQLabel( i18n( 
"Organization:" ), mAccountInformationPage );
 
  236  mOrganization = 
new KLineEdit( mAccountInformationPage );
 
  237  label->setBuddy( mOrganization );
 
  239  layout->addWidget( label, 2, 0 );
 
  240  layout->addWidget( mOrganization, 2, 1 );
 
  242  addPage( mAccountInformationPage, i18n( 
"Account Information" ) );
 
  245void AccountWizard::setupLoginInformationPage()
 
  247  mLoginInformationPage = 
new TQWidget( 
this );
 
  248  TQGridLayout *layout = 
new TQGridLayout( mLoginInformationPage, 2, 2,
 
  249                                         KDialog::marginHint(), KDialog::spacingHint() );
 
  251  TQLabel *label = 
new TQLabel( i18n( 
"Login name:" ), mLoginInformationPage );
 
  252  mLoginName = 
new KLineEdit( mLoginInformationPage );
 
  253  label->setBuddy( mLoginName );
 
  255  layout->addWidget( label, 0, 0 );
 
  256  layout->addWidget( mLoginName, 0, 1 );
 
  258  label = 
new TQLabel( i18n( 
"Password:" ), mLoginInformationPage );
 
  259  mPassword = 
new KLineEdit( mLoginInformationPage );
 
  260  mPassword->setEchoMode( TQLineEdit::Password );
 
  261  label->setBuddy( mPassword );
 
  263  layout->addWidget( label, 1, 0 );
 
  264  layout->addWidget( mPassword, 1, 1 );
 
  266  addPage( mLoginInformationPage, i18n( 
"Login Information" ) );
 
  269void AccountWizard::setupServerInformationPage()
 
  271  mServerInformationPage = 
new TQWidget( 
this );
 
  272  TQGridLayout *layout = 
new TQGridLayout( mServerInformationPage, 3, 2,
 
  273                                         KDialog::marginHint(), KDialog::spacingHint() );
 
  275  mIncomingLabel = 
new TQLabel( mServerInformationPage );
 
  277  mIncomingServerWdg = 
new TQVBox( mServerInformationPage );
 
  278  mIncomingServer = 
new KLineEdit( mIncomingServerWdg );
 
  279  mIncomingUseSSL = 
new TQCheckBox( i18n( 
"Use secure connection (SSL/TLS)" ), mIncomingServerWdg );
 
  281  mIncomingLocationWdg = 
new TQHBox( mServerInformationPage );
 
  282  mIncomingLocation = 
new KLineEdit( mIncomingLocationWdg );
 
  283  mChooseLocation = 
new TQPushButton( i18n( 
"Choose..." ), mIncomingLocationWdg );
 
  285  connect( mChooseLocation, TQ_SIGNAL( clicked() ),
 
  286           this, TQ_SLOT( chooseLocation() ) );
 
  288  layout->addWidget( mIncomingLabel, 0, 0, AlignTop );
 
  289  layout->addWidget( mIncomingLocationWdg, 0, 1 );
 
  290  layout->addWidget( mIncomingServerWdg, 0, 1 );
 
  292  TQLabel *label = 
new TQLabel( i18n( 
"Outgoing server:" ), mServerInformationPage );
 
  293  mOutgoingServer = 
new KLineEdit( mServerInformationPage );
 
  294  label->setBuddy( mOutgoingServer );
 
  296  layout->addWidget( label, 1, 0 );
 
  297  layout->addWidget( mOutgoingServer, 1, 1 );
 
  299  mOutgoingUseSSL = 
new TQCheckBox( i18n( 
"Use secure connection (SSL/TLS)" ), mServerInformationPage );
 
  300  layout->addWidget( mOutgoingUseSSL, 2, 1 );
 
  302  mLocalDelivery = 
new TQCheckBox( i18n( 
"Use local delivery" ),
 
  303                                  mServerInformationPage );
 
  304  layout->addWidget( mLocalDelivery, 3, 0 );
 
  306  connect( mLocalDelivery, TQ_SIGNAL( toggled( 
bool ) ),
 
  307           mOutgoingServer, TQ_SLOT( setDisabled( 
bool ) ) );
 
  309  addPage( mServerInformationPage, i18n( 
"Server Information" ) );
 
  312void AccountWizard::chooseLocation()
 
  316  if ( mTypeBox->type() == AccountTypeBox::Local ) {
 
  317    location = KFileDialog::getSaveFileName( TQString(), TQString(), 
this );
 
  318  } 
else if ( mTypeBox->type() == AccountTypeBox::Maildir ) {
 
  319    location = KFileDialog::getExistingDirectory( TQString(), 
this );
 
  322  if ( !location.isEmpty() )
 
  323    mIncomingLocation->setText( location );
 
  326TQString AccountWizard::accountName()
 const 
  329  TQString name( i18n( 
"None" ) );
 
  331  TQString email = mEMailAddress->text();
 
  332  int pos = email.find( 
'@' );
 
  334    name = email.mid( pos + 1 );
 
  335    name[ 0 ] = name[ 0 ].upper();
 
  341TQLabel *AccountWizard::createInfoLabel( 
const TQString &msg )
 
  343  TQLabel *label = 
new TQLabel( msg, 
this );
 
  344  label->setFrameStyle( TQFrame::Panel | TQFrame::Raised );
 
  345  label->resize( fontMetrics().width( msg ) + 20, label->height() * 2 );
 
  346  label->move( width() / 2 - label->width() / 2, height() / 2 - label->height() / 2 );
 
  352void AccountWizard::accept()
 
  355  KPIM::IdentityManager *manager = mKernel->identityManager();
 
  356  KPIM::Identity &identity = manager->modifyIdentityForUoid( manager->defaultIdentity().uoid() );
 
  358  identity.setFullName( mRealName->text() );
 
  359  identity.setPrimaryEmailAddress( mEMailAddress->text() );
 
  360  identity.setOrganization( mOrganization->text() );
 
  364  TQTimer::singleShot( 0, 
this, TQ_SLOT( createTransport() ) );
 
  367void AccountWizard::createTransport()
 
  370  TDEConfigGroup general( KMKernel::config(), 
"General" );
 
  372  uint numTransports = general.readNumEntry( 
"transports", 0 );
 
  374  for ( uint i = 1 ; i <= numTransports ; i++ ) {
 
  375    KMTransportInfo *info = 
new KMTransportInfo();
 
  376    info->readConfig( i );
 
  377    mTransportInfoList.append( info );
 
  380  mTransportInfo = 
new KMTransportInfo();
 
  382  if ( mLocalDelivery->isChecked() ) { 
 
  383    mTransportInfo->type = 
"sendmail";
 
  384    mTransportInfo->name = i18n( 
"Sendmail" );
 
  385    mTransportInfo->host = 
"/usr/sbin/sendmail"; 
 
  386    mTransportInfo->auth = 
false;
 
  387    mTransportInfo->setStorePasswd( 
false );
 
  389    TQTimer::singleShot( 0, 
this, TQ_SLOT( transportCreated() ) );
 
  391    mTransportInfo->type = 
"smtp";
 
  392    mTransportInfo->name = accountName();
 
  393    mTransportInfo->host = mOutgoingServer->text();
 
  394    mTransportInfo->user = mLoginName->text();
 
  395    mTransportInfo->setPasswd( mPassword->text() );
 
  397    int port = (mOutgoingUseSSL->isChecked() ? 465 : 25);
 
  398    checkSmtpCapabilities( mTransportInfo->host, port );
 
  402void AccountWizard::transportCreated()
 
  404  mTransportInfoList.append( mTransportInfo );
 
  406  TDEConfigGroup general( KMKernel::config(), 
"General" );
 
  407  general.writeEntry( 
"transports", mTransportInfoList.count() );
 
  409  for ( uint i = 0 ; i < mTransportInfoList.count() ; i++ )
 
  410    mTransportInfo->writeConfig( i + 1 );
 
  413  if ( GlobalSettings::self()->defaultTransport().isEmpty() ) {
 
  414    TDEConfigGroup general( KMKernel::config(), 
"General" );
 
  416    if ( mTransportInfoList.count() > 0 ) {
 
  417      KMTransportInfo info;
 
  418      info.readConfig( 1 );
 
  419      TDEConfigGroup composer( KMKernel::config(), 
"Composer" );
 
  420      GlobalSettings::self()->setDefaultTransport( info.name );
 
  421      GlobalSettings::self()->setCurrentTransport( info.name );
 
  425  mTransportInfoList.setAutoDelete( 
true );
 
  426  mTransportInfoList.clear();
 
  428  TQTimer::singleShot( 0, 
this, TQ_SLOT( createAccount() ) );
 
  431void AccountWizard::createAccount()
 
  438  switch ( mTypeBox->type() ) {
 
  439    case AccountTypeBox::Local:
 
  441      mAccount = acctManager->
create( 
"local", i18n( 
"Local Account" ) );
 
  442      static_cast<KMAcctLocal*
>( mAccount )->setLocation( mIncomingLocation->text() );
 
  445    case AccountTypeBox::POP3:
 
  447      mAccount = acctManager->
create( 
"pop", accountName() );
 
  449      acct->setLogin( mLoginName->text() );
 
  450      acct->setPasswd( mPassword->text() );
 
  451      acct->setHost( mIncomingServer->text() );
 
  452      port = mIncomingUseSSL->isChecked() ? 995 : 110;
 
  455    case AccountTypeBox::IMAP:
 
  457      mAccount = acctManager->
create( 
"imap", accountName() );
 
  458      KMAcctImap *acct = 
static_cast<KMAcctImap*
>( mAccount );
 
  459      acct->setLogin( mLoginName->text() );
 
  460      acct->setPasswd( mPassword->text() );
 
  461      acct->setHost( mIncomingServer->text() );
 
  462      port = mIncomingUseSSL->isChecked() ? 993 : 143;
 
  465    case AccountTypeBox::dIMAP:
 
  467      mAccount = acctManager->
create( 
"cachedimap", accountName() );
 
  468      KMAcctCachedImap *acct = 
static_cast<KMAcctCachedImap*
>( mAccount );
 
  469      acct->setLogin( mLoginName->text() );
 
  470      acct->setPasswd( mPassword->text() );
 
  471      acct->setHost( mIncomingServer->text() );
 
  472      port = mIncomingUseSSL->isChecked() ? 993 : 143;
 
  475    case AccountTypeBox::Maildir:
 
  477      mAccount = acctManager->
create( 
"maildir", i18n( 
"Local Account" ) );
 
  478      static_cast<KMAcctMaildir*
>( mAccount )->setLocation( mIncomingLocation->text() );
 
  483  if ( mTypeBox->type() == AccountTypeBox::POP3 )
 
  484    checkPopCapabilities( mIncomingServer->text(), port );
 
  485  else if ( mTypeBox->type() == AccountTypeBox::IMAP || mTypeBox->type() == AccountTypeBox::dIMAP )
 
  486    checkImapCapabilities( mIncomingServer->text(), port );
 
  488    TQTimer::singleShot( 0, 
this, TQ_SLOT( accountCreated() ) );
 
  491void AccountWizard::accountCreated()
 
  495    mKernel->acctMgr()->add( mAccount );
 
  496    mKernel->cleanupImapFolders();
 
  502void AccountWizard::finished()
 
  504  GlobalSettings::self()->writeConfig();
 
  511void AccountWizard::checkPopCapabilities( 
const TQString &server, 
int port )
 
  514  mServerTest = 
new KMServerTest( POP_PROTOCOL, server, port );
 
  516  connect( mServerTest, TQ_SIGNAL( capabilities( 
const TQStringList&, 
const TQStringList& ) ),
 
  517           this, TQ_SLOT( popCapabilities( 
const TQStringList&, 
const TQStringList& ) ) );
 
  519  mAuthInfoLabel = createInfoLabel( i18n( 
"Checking for supported security capabilities of %1..." ).arg( server ) );
 
  522void AccountWizard::checkImapCapabilities( 
const TQString &server, 
int port )
 
  525  mServerTest = 
new KMServerTest( IMAP_PROTOCOL, server, port );
 
  527  connect( mServerTest, TQ_SIGNAL( capabilities( 
const TQStringList&, 
const TQStringList& ) ),
 
  528           this, TQ_SLOT( imapCapabilities( 
const TQStringList&, 
const TQStringList& ) ) );
 
  530  mAuthInfoLabel = createInfoLabel( i18n( 
"Checking for supported security capabilities of %1..." ).arg( server ) );
 
  533void AccountWizard::checkSmtpCapabilities( 
const TQString &server, 
int port )
 
  536  mServerTest = 
new KMServerTest( SMTP_PROTOCOL, server, port );
 
  538  connect( mServerTest, TQ_SIGNAL( capabilities( 
const TQStringList&, 
const TQStringList&,
 
  539                                              const TQString&, 
const TQString&, 
const TQString& ) ),
 
  540           this, TQ_SLOT( smtpCapabilities( 
const TQStringList&, 
const TQStringList&,
 
  541                                         const TQString&, 
const TQString&, 
const TQString& ) ) );
 
  543  mAuthInfoLabel = createInfoLabel( i18n( 
"Checking for supported security capabilities of %1..." ).arg( server ) );
 
  546void AccountWizard::popCapabilities( 
const TQStringList &capaNormalList,
 
  547                                     const TQStringList &capaSSLList )
 
  549  uint capaNormal = popCapabilitiesFromStringList( capaNormalList );
 
  552  if ( capaNormal & STLS )
 
  553    capaTLS = capaNormal;
 
  555  uint capaSSL = popCapabilitiesFromStringList( capaSSLList );
 
  557  KMail::NetworkAccount *account = 
static_cast<KMail::NetworkAccount*
>( mAccount );
 
  559  bool useSSL = !capaSSLList.isEmpty();
 
  560  bool useTLS = capaTLS != 0;
 
  562  account->setUseSSL( useSSL );
 
  563  account->setUseTLS( useTLS );
 
  565  uint capa = (useSSL ? capaSSL : (useTLS ? capaTLS : capaNormal));
 
  568    account->setAuth( 
"PLAIN" );
 
  569  else if ( capa & Login )
 
  570    account->setAuth( 
"LOGIN" );
 
  571  else if ( capa & CRAM_MD5 )
 
  572    account->setAuth( 
"CRAM-MD5" );
 
  573  else if ( capa & Digest_MD5 )
 
  574    account->setAuth( 
"DIGEST-MD5" );
 
  575  else if ( capa & NTLM )
 
  576    account->setAuth( 
"NTLM" );
 
  577  else if ( capa & GSSAPI )
 
  578    account->setAuth( 
"GSSAPI" );
 
  579  else if ( capa & APOP )
 
  580    account->setAuth( 
"APOP" );
 
  582    account->setAuth( 
"USER" );
 
  584  account->setPort( useSSL ? 995 : 110 );
 
  586  mServerTest->deleteLater();
 
  589  delete mAuthInfoLabel;
 
  596void AccountWizard::imapCapabilities( 
const TQStringList &capaNormalList,
 
  597                                      const TQStringList &capaSSLList )
 
  599  uint capaNormal = imapCapabilitiesFromStringList( capaNormalList );
 
  601  if ( capaNormal & STARTTLS )
 
  602    capaTLS = capaNormal;
 
  604  uint capaSSL = imapCapabilitiesFromStringList( capaSSLList );
 
  606  KMail::NetworkAccount *account = 
static_cast<KMail::NetworkAccount*
>( mAccount );
 
  608  bool useSSL = !capaSSLList.isEmpty();
 
  609  bool useTLS = (capaTLS != 0);
 
  611  account->setUseSSL( useSSL );
 
  612  account->setUseTLS( useTLS );
 
  614  uint capa = (useSSL ? capaSSL : (useTLS ? capaTLS : capaNormal));
 
  616  if ( capa & CRAM_MD5 )
 
  617    account->setAuth( 
"CRAM-MD5" );
 
  618  else if ( capa & Digest_MD5 )
 
  619    account->setAuth( 
"DIGEST-MD5" );
 
  620  else if ( capa & NTLM )
 
  621    account->setAuth( 
"NTLM" );
 
  622  else if ( capa & GSSAPI )
 
  623    account->setAuth( 
"GSSAPI" );
 
  624  else if ( capa & Anonymous )
 
  625    account->setAuth( 
"ANONYMOUS" );
 
  626  else if ( capa & Login )
 
  627    account->setAuth( 
"LOGIN" );
 
  628  else if ( capa & Plain )
 
  629    account->setAuth( 
"PLAIN" );
 
  631    account->setAuth( 
"*" );
 
  633  account->setPort( useSSL ? 993 : 143 );
 
  635  mServerTest->deleteLater();
 
  638  delete mAuthInfoLabel;
 
  644void AccountWizard::smtpCapabilities( 
const TQStringList &capaNormal,
 
  645                                      const TQStringList &capaSSL,
 
  646                                      const TQString &authNone,
 
  647                                      const TQString &authSSL,
 
  648                                      const TQString &authTLS )
 
  650  uint authBitsNone, authBitsSSL, authBitsTLS;
 
  652  if ( authNone.isEmpty() && authSSL.isEmpty() && authTLS.isEmpty() ) {
 
  654    authBitsNone = authMethodsFromStringList( capaNormal );
 
  655    if ( capaNormal.findIndex( 
"STARTTLS" ) != -1 )
 
  656      authBitsTLS = authBitsNone;
 
  659    authBitsSSL = authMethodsFromStringList( capaSSL );
 
  661    authBitsNone = authMethodsFromString( authNone );
 
  662    authBitsSSL = authMethodsFromString( authSSL );
 
  663    authBitsTLS = authMethodsFromString( authTLS );
 
  667  if ( capaNormal.findIndex( 
"STARTTLS" ) != -1 ) {
 
  668    mTransportInfo->encryption = 
"TLS";
 
  669    authBits = authBitsTLS;
 
  670  } 
else if ( !capaSSL.isEmpty() ) {
 
  671    mTransportInfo->encryption = 
"SSL";
 
  672    authBits = authBitsSSL;
 
  674    mTransportInfo->encryption = 
"NONE";
 
  675    authBits = authBitsNone;
 
  678  if ( authBits & Login )
 
  679    mTransportInfo->authType = 
"LOGIN";
 
  680  else if ( authBits & CRAM_MD5 )
 
  681    mTransportInfo->authType = 
"CRAM-MD5";
 
  682  else if ( authBits & Digest_MD5 )
 
  683    mTransportInfo->authType = 
"DIGEST-MD5";
 
  684  else if ( authBits & NTLM )
 
  685    mTransportInfo->authType = 
"NTLM";
 
  686  else if ( authBits & GSSAPI )
 
  687    mTransportInfo->authType = 
"GSSAPI";
 
  689    mTransportInfo->authType = 
"PLAIN";
 
  691  mTransportInfo->port = ( !capaSSL.isEmpty() ? 
"465" : 
"25" );
 
  693  mServerTest->deleteLater();
 
  696  delete mAuthInfoLabel;
 
  702uint AccountWizard::popCapabilitiesFromStringList( 
const TQStringList & l )
 
  704  unsigned int capa = 0;
 
  706  for ( TQStringList::const_iterator it = l.begin() ; it != l.end() ; ++it ) {
 
  707    TQString cur = (*it).upper();
 
  708    if ( cur == 
"PLAIN" )
 
  710    else if ( cur == 
"LOGIN" )
 
  712    else if ( cur == 
"CRAM-MD5" )
 
  714    else if ( cur == 
"DIGEST-MD5" )
 
  716    else if ( cur == 
"NTLM" )
 
  718    else if ( cur == 
"GSSAPI" )
 
  720    else if ( cur == 
"APOP" )
 
  722    else if ( cur == 
"STLS" )
 
  729uint AccountWizard::imapCapabilitiesFromStringList( 
const TQStringList & l )
 
  731  unsigned int capa = 0;
 
  733  for ( TQStringList::const_iterator it = l.begin() ; it != l.end() ; ++it ) {
 
  734    TQString cur = (*it).upper();
 
  735    if ( cur == 
"AUTH=PLAIN" )
 
  737    else if ( cur == 
"AUTH=LOGIN" )
 
  739    else if ( cur == 
"AUTH=CRAM-MD5" )
 
  741    else if ( cur == 
"AUTH=DIGEST-MD5" )
 
  743    else if ( cur == 
"AUTH=NTLM" )
 
  745    else if ( cur == 
"AUTH=GSSAPI" )
 
  747    else if ( cur == 
"AUTH=ANONYMOUS" )
 
  749    else if ( cur == 
"STARTTLS" )
 
  756uint AccountWizard::authMethodsFromString( 
const TQString & s )
 
  758  unsigned int result = 0;
 
  760  TQStringList sl = TQStringList::split( 
'\n', s.upper() );
 
  761  for ( TQStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it )
 
  762    if (  *it == 
"SASL/LOGIN" )
 
  764    else if ( *it == 
"SASL/PLAIN" )
 
  766    else if ( *it == 
"SASL/CRAM-MD5" )
 
  768    else if ( *it == 
"SASL/DIGEST-MD5" )
 
  769      result |= Digest_MD5;
 
  770    else if ( *it == 
"SASL/NTLM" )
 
  772    else if ( *it == 
"SASL/GSSAPI" )
 
  778uint AccountWizard::authMethodsFromStringList( 
const TQStringList & sl )
 
  780  unsigned int result = 0;
 
  782  for ( TQStringList::const_iterator it = sl.begin() ; it != sl.end() ; ++it )
 
  783    if ( *it == 
"LOGIN" )
 
  785    else if ( *it == 
"PLAIN" )
 
  787    else if ( *it == 
"CRAM-MD5" )
 
  789    else if ( *it == 
"DIGEST-MD5" )
 
  790      result |= Digest_MD5;
 
  791    else if ( *it == 
"NTLM" )
 
  793    else if ( *it == 
"GSSAPI" )
 
  799#include "accountwizard.moc" 
Central point of coordination in KMail.
 
The account manager is responsible for creating accounts of various types via the factory method crea...
 
KMAccount * create(const TQString &type, const TQString &name=TQString(), uint id=0)
Create a new account of given type with given name.
 
KMail account for pop mail account.