23 #include <tqspinbox.h>
26 #include <klineedit.h>
30 #include "resourcesqlconfig.h"
34 ResourceSqlConfig::ResourceSqlConfig( TQWidget* parent,
const char* name )
35 : ResourceConfigWidget( parent,
name )
39 TQGridLayout *mainLayout =
new TQGridLayout(
this, 4, 2 );
41 TQLabel *
label =
new TQLabel( i18n(
"Username:" ),
this );
44 mainLayout->addWidget( label, 0, 0 );
45 mainLayout->addWidget( mUser, 0, 1 );
47 label =
new TQLabel( i18n(
"Password:" ),
this );
49 mPassword->setEchoMode( KLineEdit::Password );
51 mainLayout->addWidget( label, 1, 0 );
52 mainLayout->addWidget( mPassword, 1, 1 );
54 label =
new TQLabel( i18n(
"Host:" ),
this );
57 mainLayout->addWidget( label, 2, 0 );
58 mainLayout->addWidget( mHost, 2, 1 );
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));
65 new TQWidget(box,
"dummy");
67 mainLayout->addWidget( label, 3, 0 );
68 mainLayout->addWidget( box, 3, 1 );
70 label =
new TQLabel( i18n(
"Database:" ),
this );
73 mainLayout->addWidget( label, 4, 0 );
74 mainLayout->addWidget( mDbName, 4, 1 );
77 void ResourceSqlConfig::loadSettings(
TDEConfig *config )
79 mUser->setText( config->
readEntry(
"SqlUser" ) );
80 mPassword->setText( TDEABC::Resource::cryptStr( config->
readEntry(
"SqlPassword" ) ) );
81 mDbName->setText( config->
readEntry(
"SqlName" ) );
82 mHost->setText( config->
readEntry(
"SqlHost" ) );
86 void ResourceSqlConfig::saveSettings(
TDEConfig *config )
88 config->
writeEntry(
"SqlUser", mUser->text() );
89 config->
writeEntry(
"SqlPassword", TDEABC::Resource::cryptStr( mPassword->text() ) );
90 config->
writeEntry(
"SqlName", mDbName->text() );
91 config->
writeEntry(
"SqlHost", mHost->text() );
92 config->
writeEntry(
"SqlPort", mPort->value() );
95 #include "resourcesqlconfig.moc"
TQString readEntry(const TQString &pKey, const TQString &aDefault=TQString::null) const
int readNumEntry(const TQString &pKey, int nDefault=0) const
void writeEntry(const TQString &pKey, const TQString &pValue, bool bPersistent=true, bool bGlobal=false, bool bNLS=false)
static data, shared by ALL addressee objects
TQString name(StdAccel id)
TQString label(StdAccel id)