| # kabc Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# resourceldapconfig.cpp

    00001 /*
    00002     This file is part of libkabc.
    00003     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #include <qcheckbox.h>
    00022 #include <qlabel.h>
    00023 #include <qlayout.h>
    00024 #include <qspinbox.h>
    00025 #include <qvbox.h>
    00026
    00027 #include <klocale.h>
    00028 #include <klineedit.h>
    00029
    00030 #include "resource.h"
    00031 #include "resourceldapconfig.h"
    00032
    00033 using namespace KABC;
    00034
    00035 ResourceLDAPConfig::ResourceLDAPConfig( QWidget* parent,  const char* name )
    00036     : ResourceConfigWidget( parent, name )
    00037 {
    00038   resize( 250, 120 );
    00039   QGridLayout *mainLayout = new QGridLayout( this, 6, 2 );
    00040
    00041   QLabel *label = new QLabel( i18n( "User:" ), this );
    00042   mUser = new KLineEdit( this );
    00043
    00044   mainLayout->addWidget( label, 0, 0 );
    00045   mainLayout->addWidget( mUser, 0, 1 );
    00046
    00047   label = new QLabel( i18n( "Password:" ), this );
    00048   mPassword = new KLineEdit( this );
    00049   mPassword->setEchoMode( KLineEdit::Password );
    00050
    00051   mainLayout->addWidget( label, 1, 0 );
    00052   mainLayout->addWidget( mPassword, 1, 1 );
    00053
    00054   label = new QLabel( i18n( "Host:" ), this );
    00055   mHost = new KLineEdit( this );
    00056
    00057   mainLayout->addWidget( label, 2, 0 );
    00058   mainLayout->addWidget( mHost, 2, 1 );
    00059
    00060   label = new QLabel( i18n( "Port:" ), this );
    00061   QVBox *box = new QVBox(this);
    00062   mPort = new QSpinBox(0, 65535, 1, box );
    00063   mPort->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred));
    00064   mPort->setValue(389);
    00065   new QWidget(box, "dummy");
    00066
    00067   mainLayout->addWidget( label, 3, 0 );
    00068   mainLayout->addWidget( box, 3, 1 );
    00069
    00070   label = new QLabel( i18n( "Dn:" ), this );
    00071   mDn = new KLineEdit( this );
    00072
    00073   mainLayout->addWidget( label, 4, 0 );
    00074   mainLayout->addWidget( mDn, 4, 1 );
    00075
    00076   label = new QLabel( i18n( "Filter:" ), this );
    00077   mFilter = new KLineEdit( this );
    00078
    00079   mainLayout->addWidget( label, 5, 0 );
    00080   mainLayout->addWidget( mFilter, 5, 1 );
    00081
    00082   mAnonymous = new QCheckBox( i18n( "Anonymous Login" ), this );
    00083   mainLayout->addMultiCellWidget( mAnonymous, 6, 6, 0, 1 );
    00084
    00085   connect( mAnonymous, SIGNAL( toggled(bool) ), mUser, SLOT( setDisabled(bool) ) );
    00086   connect( mAnonymous, SIGNAL( toggled(bool) ), mPassword, SLOT( setDisabled(bool) ) );
    00087 }
    00088
    00089 void ResourceLDAPConfig::loadSettings( KConfig *config )
    00090 {
    00091   mUser->setText( config->readEntry( "LdapUser" ) );
    00092   mPassword->setText( KABC::Resource::cryptStr( config->readEntry( "LdapPassword" ) ) );
    00093   mHost->setText( config->readEntry( "LdapHost" ) );
    00094   mPort->setValue(  config->readNumEntry( "LdapPort", 389 ) );
    00095   mDn->setText( config->readEntry( "LdapDn" ) );
    00096   mFilter->setText( config->readEntry( "LdapFilter" ) );
    00097   mAnonymous->setChecked( config->readBoolEntry( "LdapAnonymous" ) );
    00098 }
    00099
    00100 void ResourceLDAPConfig::saveSettings( KConfig *config )
    00101 {
    00102   config->writeEntry( "LdapUser", mUser->text() );
    00103   config->writeEntry( "LdapPassword", KABC::Resource::cryptStr( mPassword->text() ) );
    00104   config->writeEntry( "LdapHost", mHost->text() );
    00105   config->writeEntry( "LdapPort", mPort->value() );
    00106   config->writeEntry( "LdapDn", mDn->text() );
    00107   config->writeEntry( "LdapFilter", mFilter->text() );
    00108   config->writeEntry( "LdapAnonymous", mAnonymous->isChecked() );
    00109 }
    00110
    00111 #include "resourceldapconfig.moc"

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:29:21 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001