From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdeprint/rlpr/kmproxywidget.cpp | 71 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 kdeprint/rlpr/kmproxywidget.cpp (limited to 'kdeprint/rlpr/kmproxywidget.cpp') diff --git a/kdeprint/rlpr/kmproxywidget.cpp b/kdeprint/rlpr/kmproxywidget.cpp new file mode 100644 index 000000000..5e4256ecf --- /dev/null +++ b/kdeprint/rlpr/kmproxywidget.cpp @@ -0,0 +1,71 @@ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001 Michael Goffioul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + **/ + +#include "kmproxywidget.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +KMProxyWidget::KMProxyWidget(QWidget *parent, const char *name) +: QGroupBox(0, Qt::Vertical, i18n("Proxy Settings"), parent, name) +{ + QLabel *m_hostlabel = new QLabel(i18n("&Host:"), this); + QLabel *m_portlabel = new QLabel(i18n("&Port:"), this); + m_useproxy = new QCheckBox(i18n("&Use proxy server"), this); + m_useproxy->setCursor(KCursor::handCursor()); + m_proxyhost = new QLineEdit(this); + m_proxyport = new QLineEdit(this); + m_proxyport->setValidator(new QIntValidator(m_proxyport)); + m_hostlabel->setBuddy(m_proxyhost); + m_portlabel->setBuddy(m_proxyport); + + connect(m_useproxy,SIGNAL(toggled(bool)),m_proxyhost,SLOT(setEnabled(bool))); + connect(m_useproxy,SIGNAL(toggled(bool)),m_proxyport,SLOT(setEnabled(bool))); + m_proxyhost->setEnabled(false); + m_proxyport->setEnabled(false); + + QGridLayout *lay0 = new QGridLayout(layout(), 3, 2, 10); + lay0->setColStretch(1,1); + lay0->addMultiCellWidget(m_useproxy,0,0,0,1); + lay0->addWidget(m_hostlabel,1,0); + lay0->addWidget(m_portlabel,2,0); + lay0->addWidget(m_proxyhost,1,1); + lay0->addWidget(m_proxyport,2,1); +} + +void KMProxyWidget::loadConfig(KConfig *conf) +{ + conf->setGroup("RLPR"); + m_proxyhost->setText(conf->readEntry("ProxyHost",QString::null)); + m_proxyport->setText(conf->readEntry("ProxyPort",QString::null)); + m_useproxy->setChecked(!m_proxyhost->text().isEmpty()); +} + +void KMProxyWidget::saveConfig(KConfig *conf) +{ + conf->setGroup("RLPR"); + conf->writeEntry("ProxyHost",(m_useproxy->isChecked() ? m_proxyhost->text() : QString::null)); + conf->writeEntry("ProxyPort",(m_useproxy->isChecked() ? m_proxyport->text() : QString::null)); +} -- cgit v1.2.3