26 #include <tqpushbutton.h>
27 #include <tqspinbox.h>
28 #include <tqtooltip.h>
30 #include <tdeaccelmanager.h>
31 #include <kbuttonbox.h>
32 #include <klineedit.h>
33 #include <tdelocale.h>
34 #include "addhostdialog.h"
36 AddHostDialog::AddHostDialog( KPIM::LdapServer *server, TQWidget* parent,
const char* name )
37 : KDialogBase( Plain, i18n(
"Add Host" ), Ok | Cancel, Ok, parent, name, true, true )
41 TQWidget *page = plainPage();
42 TQHBoxLayout *layout =
new TQHBoxLayout( page, marginHint(), spacingHint() );
44 mCfg =
new TDEABC::LdapConfigWidget(
45 TDEABC::LdapConfigWidget::W_USER |
46 TDEABC::LdapConfigWidget::W_PASS |
47 TDEABC::LdapConfigWidget::W_BINDDN |
48 TDEABC::LdapConfigWidget::W_REALM |
49 TDEABC::LdapConfigWidget::W_HOST |
50 TDEABC::LdapConfigWidget::W_PORT |
51 TDEABC::LdapConfigWidget::W_VER |
52 TDEABC::LdapConfigWidget::W_TIMELIMIT |
53 TDEABC::LdapConfigWidget::W_SIZELIMIT |
54 TDEABC::LdapConfigWidget::W_DN |
55 TDEABC::LdapConfigWidget::W_SECBOX |
56 TDEABC::LdapConfigWidget::W_AUTHBOX,
59 layout->addWidget( mCfg );
60 mCfg->setHost( mServer->host() );
61 mCfg->setPort( mServer->port() );
62 mCfg->setDn( mServer->baseDN() );
63 mCfg->setUser( mServer->user() );
64 mCfg->setBindDN( mServer->bindDN() );
65 mCfg->setPassword( mServer->pwdBindDN() );
66 mCfg->setTimeLimit( mServer->timeLimit() );
67 mCfg->setSizeLimit( mServer->sizeLimit() );
68 mCfg->setVer( mServer->version() );
70 switch ( mServer->security() ) {
71 case KPIM::LdapServer::TLS:
74 case KPIM::LdapServer::SSL:
81 switch ( mServer->auth() ) {
82 case KPIM::LdapServer::Simple:
83 mCfg->setAuthSimple();
85 case KPIM::LdapServer::SASL:
91 mCfg->setMech( mServer->mech() );
93 TDEAcceleratorManager::manage(
this );
97 AddHostDialog::~AddHostDialog()
101 void AddHostDialog::slotHostEditChanged(
const TQString &text )
103 enableButtonOK( !text.isEmpty() );
106 void AddHostDialog::slotOk()
108 mServer->setHost( mCfg->host() );
109 mServer->setPort( mCfg->port() );
110 mServer->setBaseDN( mCfg->dn().stripWhiteSpace() );
111 mServer->setUser( mCfg->user() );
112 mServer->setBindDN( mCfg->bindDN() );
113 mServer->setPwdBindDN( mCfg->password() );
114 mServer->setTimeLimit( mCfg->timeLimit() );
115 mServer->setSizeLimit( mCfg->sizeLimit() );
116 mServer->setVersion( mCfg->ver() );
117 mServer->setSecurity( KPIM::LdapServer::Sec_None );
118 if ( mCfg->isSecTLS() ) mServer->setSecurity( KPIM::LdapServer::TLS );
119 if ( mCfg->isSecSSL() ) mServer->setSecurity( KPIM::LdapServer::SSL );
120 mServer->setAuth( KPIM::LdapServer::Anonymous );
121 if ( mCfg->isAuthSimple() ) mServer->setAuth( KPIM::LdapServer::Simple );
122 if ( mCfg->isAuthSASL() ) mServer->setAuth( KPIM::LdapServer::SASL );
123 mServer->setMech( mCfg->mech() );
127 #include "addhostdialog.moc"