20 #include "kmproxywidget.h"
22 #include <tqlineedit.h>
24 #include <tqcheckbox.h>
26 #include <tqvalidator.h>
27 #include <tdelocale.h>
28 #include <tdeconfig.h>
31 KMProxyWidget::KMProxyWidget(TQWidget *parent,
const char *name)
32 : TQGroupBox(0, TQt::Vertical, i18n(
"Proxy Settings"), parent, name)
34 TQLabel *m_hostlabel =
new TQLabel(i18n(
"&Host:"),
this);
35 TQLabel *m_portlabel =
new TQLabel(i18n(
"&Port:"),
this);
36 m_useproxy =
new TQCheckBox(i18n(
"&Use proxy server"),
this);
37 m_useproxy->setCursor(KCursor::handCursor());
38 m_proxyhost =
new TQLineEdit(
this);
39 m_proxyport =
new TQLineEdit(
this);
40 m_proxyport->setValidator(
new TQIntValidator(m_proxyport));
41 m_hostlabel->setBuddy(m_proxyhost);
42 m_portlabel->setBuddy(m_proxyport);
44 connect(m_useproxy,TQ_SIGNAL(toggled(
bool)),m_proxyhost,TQ_SLOT(setEnabled(
bool)));
45 connect(m_useproxy,TQ_SIGNAL(toggled(
bool)),m_proxyport,TQ_SLOT(setEnabled(
bool)));
46 m_proxyhost->setEnabled(
false);
47 m_proxyport->setEnabled(
false);
49 TQGridLayout *lay0 =
new TQGridLayout(layout(), 3, 2, 10);
50 lay0->setColStretch(1,1);
51 lay0->addMultiCellWidget(m_useproxy,0,0,0,1);
52 lay0->addWidget(m_hostlabel,1,0);
53 lay0->addWidget(m_portlabel,2,0);
54 lay0->addWidget(m_proxyhost,1,1);
55 lay0->addWidget(m_proxyport,2,1);
58 void KMProxyWidget::loadConfig(TDEConfig *conf)
60 conf->setGroup(
"RLPR");
61 m_proxyhost->setText(conf->readEntry(
"ProxyHost",TQString::null));
62 m_proxyport->setText(conf->readEntry(
"ProxyPort",TQString::null));
63 m_useproxy->setChecked(!m_proxyhost->text().isEmpty());
66 void KMProxyWidget::saveConfig(TDEConfig *conf)
68 conf->setGroup(
"RLPR");
69 conf->writeEntry(
"ProxyHost",(m_useproxy->isChecked() ? m_proxyhost->text() : TQString::null));
70 conf->writeEntry(
"ProxyPort",(m_useproxy->isChecked() ? m_proxyport->text() : TQString::null));