~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

« back to all changes in this revision

Viewing changes to kcontactmanager/xxport/ldap/addhostdialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi, Alessandro Ghersi, Harald Sitter
  • Date: 2009-06-27 04:40:05 UTC
  • mfrom: (1.1.39 upstream)
  • Revision ID: james.westby@ubuntu.com-20090627044005-4y2vm9xz7rvmzi4p
Tags: 4:4.2.95svn20090701-0ubuntu1
[ Alessandro Ghersi ]
* New upstream release
  - Bump build-deps
* Remove akonadi-kde and libmaildir4 packages
  - remove akonadi-kde.install and libmaildir4.install
  - remove libmaildir4 from debian/rules
  - remove akonadi-kde and libmaildir4 from depends
  - remove akonadi-kde and libmaildir4 from installgen
* Update kdepim-dev.install
* Update kpilot.install
* Add akonadi-kde and libmaildir4 transitional packages

[ Harald Sitter ]
* KAddressbook replaces Kontact << 4.2.85 (LP: #378373)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    This file is part of KAddressBook.
3
 
    Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4
 
 
5
 
    This program is free software; you can redistribute it and/or modify
6
 
    it under the terms of the GNU General Public License as published by
7
 
    the Free Software Foundation; either version 2 of the License, or
8
 
    (at your option) any later version.
9
 
 
10
 
    This program is distributed in the hope that it will be useful,
11
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
 
    GNU General Public License for more details.
14
 
 
15
 
    You should have received a copy of the GNU General Public License
16
 
    along with this program; if not, write to the Free Software
17
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
 
 
19
 
    As a special exception, permission is given to link this program
20
 
    with any edition of Qt, and distribute the resulting executable,
21
 
    without including the source code for Qt in the source distribution.
22
 
*/
23
 
 
24
 
#include "addhostdialog.h"
25
 
 
26
 
#include <QtGui/QHBoxLayout>
27
 
#include <QtGui/QPushButton>
28
 
 
29
 
#include <kacceleratormanager.h>
30
 
#include <kldap/ldapserver.h>
31
 
#include <kldap/ldapconfigwidget.h>
32
 
#include <klineedit.h>
33
 
#include <klocale.h>
34
 
 
35
 
AddHostDialog::AddHostDialog( KLDAP::LdapServer *server, QWidget* parent )
36
 
  : KDialog( parent )
37
 
{
38
 
  setCaption( i18n( "Add Host" ) );
39
 
  setButtons( Ok | Cancel );
40
 
  setDefaultButton( Ok );
41
 
  setModal( true );
42
 
  showButtonSeparator( true );
43
 
 
44
 
  mServer = server;
45
 
 
46
 
  QWidget *page = new QWidget( this );
47
 
  setMainWidget( page );
48
 
  QHBoxLayout *layout = new QHBoxLayout( page );
49
 
  layout->setSpacing( spacingHint() );
50
 
  layout->setMargin( 0 );
51
 
 
52
 
  mCfg = new KLDAP::LdapConfigWidget(
53
 
       KLDAP::LdapConfigWidget::W_USER |
54
 
       KLDAP::LdapConfigWidget::W_PASS |
55
 
       KLDAP::LdapConfigWidget::W_BINDDN |
56
 
       KLDAP::LdapConfigWidget::W_REALM |
57
 
       KLDAP::LdapConfigWidget::W_HOST |
58
 
       KLDAP::LdapConfigWidget::W_PORT |
59
 
       KLDAP::LdapConfigWidget::W_VER |
60
 
       KLDAP::LdapConfigWidget::W_TIMELIMIT |
61
 
       KLDAP::LdapConfigWidget::W_SIZELIMIT |
62
 
       KLDAP::LdapConfigWidget::W_PAGESIZE |
63
 
       KLDAP::LdapConfigWidget::W_DN |
64
 
       KLDAP::LdapConfigWidget::W_SECBOX |
65
 
       KLDAP::LdapConfigWidget::W_AUTHBOX,
66
 
        page );
67
 
 
68
 
  layout->addWidget( mCfg );
69
 
  mCfg->setHost( mServer->host() );
70
 
  mCfg->setPort( mServer->port() );
71
 
  mCfg->setDn( mServer->baseDn() );
72
 
  mCfg->setUser( mServer->user() );
73
 
  mCfg->setBindDn( mServer->bindDn() );
74
 
  mCfg->setPassword( mServer->password() );
75
 
  mCfg->setTimeLimit( mServer->timeLimit() );
76
 
  mCfg->setSizeLimit( mServer->sizeLimit() );
77
 
  mCfg->setPageSize( mServer->pageSize() );
78
 
  mCfg->setVersion( mServer->version() );
79
 
 
80
 
  switch ( mServer->security() ) {
81
 
    case KLDAP::LdapServer::TLS:
82
 
      mCfg->setSecurity( KLDAP::LdapConfigWidget::TLS );
83
 
      break;
84
 
    case KLDAP::LdapServer::SSL:
85
 
      mCfg->setSecurity( KLDAP::LdapConfigWidget::SSL );
86
 
      break;
87
 
    default:
88
 
      mCfg->setSecurity( KLDAP::LdapConfigWidget::None );
89
 
  }
90
 
 
91
 
  switch ( mServer->auth() ) {
92
 
    case KLDAP::LdapServer::Simple:
93
 
      mCfg->setAuth( KLDAP::LdapConfigWidget::Simple );
94
 
      break;
95
 
    case KLDAP::LdapServer::SASL:
96
 
      mCfg->setAuth( KLDAP::LdapConfigWidget::SASL );
97
 
      break;
98
 
    default:
99
 
      mCfg->setAuth( KLDAP::LdapConfigWidget::Anonymous );
100
 
  }
101
 
  mCfg->setMech( mServer->mech() );
102
 
 
103
 
  KAcceleratorManager::manage( this );
104
 
  connect(this,SIGNAL(okClicked()),SLOT(slotOk()));
105
 
}
106
 
 
107
 
AddHostDialog::~AddHostDialog()
108
 
{
109
 
}
110
 
 
111
 
void AddHostDialog::slotHostEditChanged( const QString &text )
112
 
{
113
 
  enableButtonOk( !text.isEmpty() );
114
 
}
115
 
 
116
 
void AddHostDialog::slotOk()
117
 
{
118
 
  mServer->setHost( mCfg->host() );
119
 
  mServer->setPort( mCfg->port() );
120
 
  mServer->setBaseDn( mCfg->dn() );
121
 
  mServer->setUser( mCfg->user() );
122
 
  mServer->setBindDn( mCfg->bindDn() );
123
 
  mServer->setPassword( mCfg->password() );
124
 
  mServer->setTimeLimit( mCfg->timeLimit() );
125
 
  mServer->setSizeLimit( mCfg->sizeLimit() );
126
 
  mServer->setPageSize( mCfg->pageSize() );
127
 
  mServer->setVersion( mCfg->version() );
128
 
  switch ( mCfg->security() ) {
129
 
    case KLDAP::LdapConfigWidget::TLS:
130
 
      mServer->setSecurity( KLDAP::LdapServer::TLS );
131
 
      break;
132
 
    case KLDAP::LdapConfigWidget::SSL:
133
 
      mServer->setSecurity( KLDAP::LdapServer::SSL );
134
 
      break;
135
 
    default:
136
 
      mServer->setSecurity( KLDAP::LdapServer::None );
137
 
  }
138
 
  switch ( mCfg->auth() ) {
139
 
    case KLDAP::LdapConfigWidget::Simple:
140
 
      mServer->setAuth( KLDAP::LdapServer::Simple );
141
 
      break;
142
 
    case KLDAP::LdapConfigWidget::SASL:
143
 
      mServer->setAuth( KLDAP::LdapServer::SASL );
144
 
      break;
145
 
    default:
146
 
      mServer->setAuth( KLDAP::LdapServer::Anonymous );
147
 
  }
148
 
  mServer->setMech( mCfg->mech() );
149
 
  KDialog::accept();
150
 
}
151
 
 
152
 
#include "addhostdialog.moc"