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 );
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_FILTER |
61 KLDAP::LdapConfigWidget::W_SECBOX |
62 KLDAP::LdapConfigWidget::W_AUTHBOX,
66 mCfg->setHost( mServer->host() );
67 mCfg->setPort( mServer->port() );
68 mCfg->setDn( mServer->baseDn() );
69 mCfg->setUser( mServer->user() );
70 mCfg->setBindDn( mServer->bindDn() );
71 mCfg->setPassword( mServer->password() );
72 mCfg->setTimeLimit( mServer->timeLimit() );
73 mCfg->setSizeLimit( mServer->sizeLimit() );
74 mCfg->setPageSize( mServer->pageSize() );
75 mCfg->setVersion( mServer->version() );
76 mCfg->setFilter( mServer->filter() );
78 switch ( mServer->security() ) {
79 case KLDAP::LdapServer::TLS:
80 mCfg->setSecurity( KLDAP::LdapConfigWidget::TLS );
82 case KLDAP::LdapServer::SSL:
83 mCfg->setSecurity( KLDAP::LdapConfigWidget::SSL );
86 mCfg->setSecurity( KLDAP::LdapConfigWidget::None );
89 switch ( mServer->auth() ) {
90 case KLDAP::LdapServer::Simple:
91 mCfg->setAuth( KLDAP::LdapConfigWidget::Simple );
93 case KLDAP::LdapServer::SASL:
94 mCfg->setAuth( KLDAP::LdapConfigWidget::SASL );
97 mCfg->setAuth( KLDAP::LdapConfigWidget::Anonymous );
99 mCfg->setMech( mServer->mech() );
101 KAcceleratorManager::manage(
this );
102 connect(mCfg, SIGNAL(hostNameChanged(
QString)),
this, SLOT(slotHostEditChanged(
QString)));
103 connect(
this, SIGNAL(okClicked()), SLOT(slotOk()) );
104 enableButtonOk(!mServer->host().isEmpty());
113 void AddHostDialog::slotHostEditChanged(
const QString &text )
115 enableButtonOk( !text.
isEmpty() );
118 void AddHostDialog::readConfig()
120 KConfigGroup group( KGlobal::config(),
"AddHostDialog" );
121 const QSize size = group.readEntry(
"Size",
QSize(600, 400) );
127 void AddHostDialog::writeConfig()
129 KConfigGroup group( KGlobal::config(),
"AddHostDialog" );
130 group.writeEntry(
"Size", size() );
135 void AddHostDialog::slotOk()
137 mServer->setHost( mCfg->host() );
138 mServer->setPort( mCfg->port() );
139 mServer->setBaseDn( mCfg->dn() );
140 mServer->setUser( mCfg->user() );
141 mServer->setBindDn( mCfg->bindDn() );
142 mServer->setPassword( mCfg->password() );
143 mServer->setTimeLimit( mCfg->timeLimit() );
144 mServer->setSizeLimit( mCfg->sizeLimit() );
145 mServer->setPageSize( mCfg->pageSize() );
146 mServer->setVersion( mCfg->version() );
147 mServer->setFilter( mCfg->filter() );
148 switch ( mCfg->security() ) {
149 case KLDAP::LdapConfigWidget::TLS:
150 mServer->setSecurity( KLDAP::LdapServer::TLS );
152 case KLDAP::LdapConfigWidget::SSL:
153 mServer->setSecurity( KLDAP::LdapServer::SSL );
156 mServer->setSecurity( KLDAP::LdapServer::None );
158 switch ( mCfg->auth() ) {
159 case KLDAP::LdapConfigWidget::Simple:
160 mServer->setAuth( KLDAP::LdapServer::Simple );
162 case KLDAP::LdapConfigWidget::SASL:
163 mServer->setAuth( KLDAP::LdapServer::SASL );
166 mServer->setAuth( KLDAP::LdapServer::Anonymous );
168 mServer->setMech( mCfg->mech() );
172 #include "moc_addhostdialog_p.cpp"
void setMargin(int margin)
AddHostDialog(KLDAP::LdapServer *server, QWidget *parent=0)
void setSpacing(int spacing)