24 #include <QHBoxLayout>
26 #include <kacceleratormanager.h>
27 #include <kldap/ldapserver.h>
28 #include <kldap/ldapconfigwidget.h>
34 setCaption( i18n(
"Add Host" ) );
35 setButtons( Ok | Cancel );
36 setDefaultButton( Ok );
38 showButtonSeparator(
true );
43 setMainWidget( page );
44 QHBoxLayout *layout =
new QHBoxLayout( page );
45 layout->setSpacing( spacingHint() );
46 layout->setMargin( 0 );
48 mCfg =
new KLDAP::LdapConfigWidget(
49 KLDAP::LdapConfigWidget::W_USER |
50 KLDAP::LdapConfigWidget::W_PASS |
51 KLDAP::LdapConfigWidget::W_BINDDN |
52 KLDAP::LdapConfigWidget::W_REALM |
53 KLDAP::LdapConfigWidget::W_HOST |
54 KLDAP::LdapConfigWidget::W_PORT |
55 KLDAP::LdapConfigWidget::W_VER |
56 KLDAP::LdapConfigWidget::W_TIMELIMIT |
57 KLDAP::LdapConfigWidget::W_SIZELIMIT |
58 KLDAP::LdapConfigWidget::W_PAGESIZE |
59 KLDAP::LdapConfigWidget::W_DN |
60 KLDAP::LdapConfigWidget::W_SECBOX |
61 KLDAP::LdapConfigWidget::W_AUTHBOX,
64 layout->addWidget( mCfg );
65 mCfg->setHost( mServer->host() );
66 mCfg->setPort( mServer->port() );
67 mCfg->setDn( mServer->baseDn() );
68 mCfg->setUser( mServer->user() );
69 mCfg->setBindDn( mServer->bindDn() );
70 mCfg->setPassword( mServer->password() );
71 mCfg->setTimeLimit( mServer->timeLimit() );
72 mCfg->setSizeLimit( mServer->sizeLimit() );
73 mCfg->setPageSize( mServer->pageSize() );
74 mCfg->setVersion( mServer->version() );
76 switch ( mServer->security() ) {
77 case KLDAP::LdapServer::TLS:
78 mCfg->setSecurity( KLDAP::LdapConfigWidget::TLS );
80 case KLDAP::LdapServer::SSL:
81 mCfg->setSecurity( KLDAP::LdapConfigWidget::SSL );
84 mCfg->setSecurity( KLDAP::LdapConfigWidget::None );
87 switch ( mServer->auth() ) {
88 case KLDAP::LdapServer::Simple:
89 mCfg->setAuth( KLDAP::LdapConfigWidget::Simple );
91 case KLDAP::LdapServer::SASL:
92 mCfg->setAuth( KLDAP::LdapConfigWidget::SASL );
95 mCfg->setAuth( KLDAP::LdapConfigWidget::Anonymous );
97 mCfg->setMech( mServer->mech() );
99 KAcceleratorManager::manage(
this );
100 connect(
this, SIGNAL(okClicked()), SLOT(slotOk()) );
107 void AddHostDialog::slotHostEditChanged(
const QString &text )
109 enableButtonOk( !text.isEmpty() );
112 void AddHostDialog::slotOk()
114 mServer->setHost( mCfg->host() );
115 mServer->setPort( mCfg->port() );
116 mServer->setBaseDn( mCfg->dn() );
117 mServer->setUser( mCfg->user() );
118 mServer->setBindDn( mCfg->bindDn() );
119 mServer->setPassword( mCfg->password() );
120 mServer->setTimeLimit( mCfg->timeLimit() );
121 mServer->setSizeLimit( mCfg->sizeLimit() );
122 mServer->setPageSize( mCfg->pageSize() );
123 mServer->setVersion( mCfg->version() );
124 switch ( mCfg->security() ) {
125 case KLDAP::LdapConfigWidget::TLS:
126 mServer->setSecurity( KLDAP::LdapServer::TLS );
128 case KLDAP::LdapConfigWidget::SSL:
129 mServer->setSecurity( KLDAP::LdapServer::SSL );
132 mServer->setSecurity( KLDAP::LdapServer::None );
134 switch ( mCfg->auth() ) {
135 case KLDAP::LdapConfigWidget::Simple:
136 mServer->setAuth( KLDAP::LdapServer::Simple );
138 case KLDAP::LdapConfigWidget::SASL:
139 mServer->setAuth( KLDAP::LdapServer::SASL );
142 mServer->setAuth( KLDAP::LdapServer::Anonymous );
144 mServer->setMech( mCfg->mech() );
148 #include "addhostdialog_p.moc"
AddHostDialog(KLDAP::LdapServer *server, QWidget *parent=0)