• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kabc
 

kabc

  • kabc
  • plugins
  • sql
resourcesqlconfig.cpp
1 /*
2  This file is part of libkabc.
3  Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library 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 GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include <tqlabel.h>
22 #include <tqlayout.h>
23 #include <tqspinbox.h>
24 #include <tqvbox.h>
25 
26 #include <klineedit.h>
27 #include <klocale.h>
28 
29 #include "resource.h"
30 #include "resourcesqlconfig.h"
31 
32 using namespace KABC;
33 
34 ResourceSqlConfig::ResourceSqlConfig( TQWidget* parent, const char* name )
35  : ResourceConfigWidget( parent, name )
36 {
37  resize( 290, 170 );
38 
39  TQGridLayout *mainLayout = new TQGridLayout( this, 4, 2 );
40 
41  TQLabel *label = new TQLabel( i18n( "Username:" ), this );
42  mUser = new KLineEdit( this );
43 
44  mainLayout->addWidget( label, 0, 0 );
45  mainLayout->addWidget( mUser, 0, 1 );
46 
47  label = new TQLabel( i18n( "Password:" ), this );
48  mPassword = new KLineEdit( this );
49  mPassword->setEchoMode( KLineEdit::Password );
50 
51  mainLayout->addWidget( label, 1, 0 );
52  mainLayout->addWidget( mPassword, 1, 1 );
53 
54  label = new TQLabel( i18n( "Host:" ), this );
55  mHost = new KLineEdit( this );
56 
57  mainLayout->addWidget( label, 2, 0 );
58  mainLayout->addWidget( mHost, 2, 1 );
59 
60  label = new TQLabel( i18n( "Port:" ), this );
61  TQVBox *box = new TQVBox(this);
62  mPort = new TQSpinBox(0, 65535, 1, box );
63  mPort->setSizePolicy(TQSizePolicy(TQSizePolicy::Maximum, TQSizePolicy::Preferred));
64  mPort->setValue(389);
65  new TQWidget(box, "dummy");
66 
67  mainLayout->addWidget( label, 3, 0 );
68  mainLayout->addWidget( box, 3, 1 );
69 
70  label = new TQLabel( i18n( "Database:" ), this );
71  mDbName = new KLineEdit( this );
72 
73  mainLayout->addWidget( label, 4, 0 );
74  mainLayout->addWidget( mDbName, 4, 1 );
75 }
76 
77 void ResourceSqlConfig::loadSettings( KConfig *config )
78 {
79  mUser->setText( config->readEntry( "SqlUser" ) );
80  mPassword->setText( KABC::Resource::cryptStr( config->readEntry( "SqlPassword" ) ) );
81  mDbName->setText( config->readEntry( "SqlName" ) );
82  mHost->setText( config->readEntry( "SqlHost" ) );
83  mPort->setValue( config->readNumEntry( "SqlPort" ) );
84 }
85 
86 void ResourceSqlConfig::saveSettings( KConfig *config )
87 {
88  config->writeEntry( "SqlUser", mUser->text() );
89  config->writeEntry( "SqlPassword", KABC::Resource::cryptStr( mPassword->text() ) );
90  config->writeEntry( "SqlName", mDbName->text() );
91  config->writeEntry( "SqlHost", mHost->text() );
92  config->writeEntry( "SqlPort", mPort->value() );
93 }
94 
95 #include "resourcesqlconfig.moc"
KStdAccel::label
TQString label(StdAccel id)
KConfig::writeEntry
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
klocale.h
KConfig::readEntry
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
KConfig
KLineEdit
KConfig::readNumEntry
int readNumEntry(const TQString &pKey, int nDefault=0) const

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kabc

Skip menu "kabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kabc by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |