• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kaddressbook

addhostdialog.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #include <QtGui/QHBoxLayout>
00025 #include <QtGui/QPushButton>
00026 
00027 #include <kacceleratormanager.h>
00028 #include <klineedit.h>
00029 #include <klocale.h>
00030 
00031 #include "addhostdialog.h"
00032 
00033 AddHostDialog::AddHostDialog( KLDAP::LdapServer *server, QWidget* parent )
00034   : KDialog( parent )
00035 {
00036   setCaption( i18n( "Add Host" ) );
00037   setButtons( Ok | Cancel );
00038   setDefaultButton( Ok );
00039   setModal( true );
00040   showButtonSeparator( true );
00041 
00042   mServer = server;
00043 
00044   QWidget *page = new QWidget( this );
00045   setMainWidget( page );
00046   QHBoxLayout *layout = new QHBoxLayout( page );
00047   layout->setSpacing( spacingHint() );
00048   layout->setMargin( 0 );
00049 
00050   mCfg = new KLDAP::LdapConfigWidget(
00051        KLDAP::LdapConfigWidget::W_USER |
00052        KLDAP::LdapConfigWidget::W_PASS |
00053        KLDAP::LdapConfigWidget::W_BINDDN |
00054        KLDAP::LdapConfigWidget::W_REALM |
00055        KLDAP::LdapConfigWidget::W_HOST |
00056        KLDAP::LdapConfigWidget::W_PORT |
00057        KLDAP::LdapConfigWidget::W_VER |
00058        KLDAP::LdapConfigWidget::W_TIMELIMIT |
00059        KLDAP::LdapConfigWidget::W_SIZELIMIT |
00060        KLDAP::LdapConfigWidget::W_PAGESIZE |
00061        KLDAP::LdapConfigWidget::W_DN |
00062        KLDAP::LdapConfigWidget::W_SECBOX |
00063        KLDAP::LdapConfigWidget::W_AUTHBOX,
00064         page );
00065 
00066   layout->addWidget( mCfg );
00067   mCfg->setHost( mServer->host() );
00068   mCfg->setPort( mServer->port() );
00069   mCfg->setDn( mServer->baseDn() );
00070   mCfg->setUser( mServer->user() );
00071   mCfg->setBindDn( mServer->bindDn() );
00072   mCfg->setPassword( mServer->password() );
00073   mCfg->setTimeLimit( mServer->timeLimit() );
00074   mCfg->setSizeLimit( mServer->sizeLimit() );
00075   mCfg->setPageSize( mServer->pageSize() );
00076   mCfg->setVersion( mServer->version() );
00077 
00078   switch ( mServer->security() ) {
00079     case KLDAP::LdapServer::TLS:
00080       mCfg->setSecurity( KLDAP::LdapConfigWidget::TLS );
00081       break;
00082     case KLDAP::LdapServer::SSL:
00083       mCfg->setSecurity( KLDAP::LdapConfigWidget::SSL );
00084       break;
00085     default:
00086       mCfg->setSecurity( KLDAP::LdapConfigWidget::None );
00087   }
00088 
00089   switch ( mServer->auth() ) {
00090     case KLDAP::LdapServer::Simple:
00091       mCfg->setAuth( KLDAP::LdapConfigWidget::Simple );
00092       break;
00093     case KLDAP::LdapServer::SASL:
00094       mCfg->setAuth( KLDAP::LdapConfigWidget::SASL );
00095       break;
00096     default:
00097       mCfg->setAuth( KLDAP::LdapConfigWidget::Anonymous );
00098   }
00099   mCfg->setMech( mServer->mech() );
00100 
00101   KAcceleratorManager::manage( this );
00102   connect(this,SIGNAL(okClicked()),SLOT(slotOk()));
00103 }
00104 
00105 AddHostDialog::~AddHostDialog()
00106 {
00107 }
00108 
00109 void AddHostDialog::slotHostEditChanged( const QString &text )
00110 {
00111   enableButtonOk( !text.isEmpty() );
00112 }
00113 
00114 void AddHostDialog::slotOk()
00115 {
00116   mServer->setHost( mCfg->host() );
00117   mServer->setPort( mCfg->port() );
00118   mServer->setBaseDn( mCfg->dn() );
00119   mServer->setUser( mCfg->user() );
00120   mServer->setBindDn( mCfg->bindDn() );
00121   mServer->setPassword( mCfg->password() );
00122   mServer->setTimeLimit( mCfg->timeLimit() );
00123   mServer->setSizeLimit( mCfg->sizeLimit() );
00124   mServer->setPageSize( mCfg->pageSize() );
00125   mServer->setVersion( mCfg->version() );
00126   switch ( mCfg->security() ) {
00127     case KLDAP::LdapConfigWidget::TLS:
00128       mServer->setSecurity( KLDAP::LdapServer::TLS );
00129       break;
00130     case KLDAP::LdapConfigWidget::SSL:
00131       mServer->setSecurity( KLDAP::LdapServer::SSL );
00132       break;
00133     default:
00134       mServer->setSecurity( KLDAP::LdapServer::None );
00135   }
00136   switch ( mCfg->auth() ) {
00137     case KLDAP::LdapConfigWidget::Simple:
00138       mServer->setAuth( KLDAP::LdapServer::Simple );
00139       break;
00140     case KLDAP::LdapConfigWidget::SASL:
00141       mServer->setAuth( KLDAP::LdapServer::SASL );
00142       break;
00143     default:
00144       mServer->setAuth( KLDAP::LdapServer::Anonymous );
00145   }
00146   mServer->setMech( mCfg->mech() );
00147   KDialog::accept();
00148 }
00149 
00150 #include "addhostdialog.moc"

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal