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

libkdepim

  • sources
  • kde-4.12
  • kdepim
  • libkdepim
  • ldap
addhostdialog.cpp
Go to the documentation of this file.
1 /*
2  This file is part of libkldap.
3 
4  Copyright (c) 2002-2010 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include "addhostdialog_p.h"
23 
24 #include <QHBoxLayout>
25 
26 #include <kacceleratormanager.h>
27 #include <kldap/ldapserver.h>
28 #include <kldap/ldapconfigwidget.h>
29 #include <klocale.h>
30 
31 AddHostDialog::AddHostDialog( KLDAP::LdapServer *server, QWidget *parent )
32  : KDialog( parent )
33 {
34  setCaption( i18n( "Add Host" ) );
35  setButtons( Ok | Cancel );
36  setDefaultButton( Ok );
37  setModal( true );
38  showButtonSeparator( true );
39 
40  mServer = server;
41 
42  QWidget *page = new QWidget( this );
43  setMainWidget( page );
44  QHBoxLayout *layout = new QHBoxLayout( page );
45  layout->setSpacing( spacingHint() );
46  layout->setMargin( 0 );
47 
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,
62  page );
63 
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() );
75 
76  switch ( mServer->security() ) {
77  case KLDAP::LdapServer::TLS:
78  mCfg->setSecurity( KLDAP::LdapConfigWidget::TLS );
79  break;
80  case KLDAP::LdapServer::SSL:
81  mCfg->setSecurity( KLDAP::LdapConfigWidget::SSL );
82  break;
83  default:
84  mCfg->setSecurity( KLDAP::LdapConfigWidget::None );
85  }
86 
87  switch ( mServer->auth() ) {
88  case KLDAP::LdapServer::Simple:
89  mCfg->setAuth( KLDAP::LdapConfigWidget::Simple );
90  break;
91  case KLDAP::LdapServer::SASL:
92  mCfg->setAuth( KLDAP::LdapConfigWidget::SASL );
93  break;
94  default:
95  mCfg->setAuth( KLDAP::LdapConfigWidget::Anonymous );
96  }
97  mCfg->setMech( mServer->mech() );
98 
99  KAcceleratorManager::manage( this );
100  connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );
101 }
102 
103 AddHostDialog::~AddHostDialog()
104 {
105 }
106 
107 void AddHostDialog::slotHostEditChanged( const QString &text )
108 {
109  enableButtonOk( !text.isEmpty() );
110 }
111 
112 void AddHostDialog::slotOk()
113 {
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 );
127  break;
128  case KLDAP::LdapConfigWidget::SSL:
129  mServer->setSecurity( KLDAP::LdapServer::SSL );
130  break;
131  default:
132  mServer->setSecurity( KLDAP::LdapServer::None );
133  }
134  switch ( mCfg->auth() ) {
135  case KLDAP::LdapConfigWidget::Simple:
136  mServer->setAuth( KLDAP::LdapServer::Simple );
137  break;
138  case KLDAP::LdapConfigWidget::SASL:
139  mServer->setAuth( KLDAP::LdapServer::SASL );
140  break;
141  default:
142  mServer->setAuth( KLDAP::LdapServer::Anonymous );
143  }
144  mServer->setMech( mCfg->mech() );
145  KDialog::accept();
146 }
147 
148 #include "addhostdialog_p.moc"
AddHostDialog::~AddHostDialog
~AddHostDialog()
Definition: addhostdialog.cpp:103
QWidget
KDialog
addhostdialog_p.h
AddHostDialog::AddHostDialog
AddHostDialog(KLDAP::LdapServer *server, QWidget *parent=0)
Definition: addhostdialog.cpp:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdepim

Skip menu "libkdepim"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal