kabc Library: resourcesqlconfig.cpp Source File (kabc Library)

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

# resourcesqlconfig.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 <qlabel.h>
    00022 #include <qlayout.h>
    00023 #include <qspinbox.h>
    00024 #include <qvbox.h>
    00025
    00026 #include <klineedit.h>
    00027 #include <klocale.h>
    00028
    00029 #include "resource.h"
    00030 #include "resourcesqlconfig.h"
    00031
    00032 using namespace KABC;
    00033
    00034 ResourceSqlConfig::ResourceSqlConfig( QWidget* parent,  const char* name )
    00035     : ResourceConfigWidget( parent, name )
    00036 {
    00037   resize( 290, 170 );
    00038
    00039   QGridLayout *mainLayout = new QGridLayout( this, 4, 2 );
    00040
    00041   QLabel *label = new QLabel( i18n( "Username:" ), 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( "Database:" ), this );
    00071   mDbName = new KLineEdit( this );
    00072
    00073   mainLayout->addWidget( label, 4, 0 );
    00074   mainLayout->addWidget( mDbName, 4, 1 );
    00075 }
    00076
    00077 void ResourceSqlConfig::loadSettings( KConfig *config )
    00078 {
    00079   mUser->setText( config->readEntry( "SqlUser" ) );
    00080   mPassword->setText( KABC::Resource::cryptStr( config->readEntry( "SqlPassword" ) ) );
    00081   mDbName->setText( config->readEntry( "SqlName" ) );
    00082   mHost->setText( config->readEntry( "SqlHost" ) );
    00083   mPort->setValue( config->readNumEntry( "SqlPort" ) );
    00084 }
    00085
    00086 void ResourceSqlConfig::saveSettings( KConfig *config )
    00087 {
    00088   config->writeEntry( "SqlUser", mUser->text() );
    00089   config->writeEntry( "SqlPassword", KABC::Resource::cryptStr( mPassword->text() ) );
    00090   config->writeEntry( "SqlName", mDbName->text() );
    00091   config->writeEntry( "SqlHost", mHost->text() );
    00092   config->writeEntry( "SqlPort", mPort->value() );
    00093 }
    00094
    00095 #include "resourcesqlconfig.moc"

This file is part of the documentation for kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:31 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003