From 4aed2c8219774f5d797760606b8489a92ddc5163 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/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/konqhtml/khttpoptdlg.cpp | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 kcontrol/konqhtml/khttpoptdlg.cpp (limited to 'kcontrol/konqhtml/khttpoptdlg.cpp') diff --git a/kcontrol/konqhtml/khttpoptdlg.cpp b/kcontrol/konqhtml/khttpoptdlg.cpp new file mode 100644 index 000000000..e6c9a95ba --- /dev/null +++ b/kcontrol/konqhtml/khttpoptdlg.cpp @@ -0,0 +1,81 @@ +// File khttpoptdlg.cpp by Jacek Konieczny +// Port to KControl by David Faure + +#include //CT + +#include +#include +#include "khttpoptdlg.h" + + +KHTTPOptions::KHTTPOptions(KConfig *config, QString group, QWidget *parent, const char *name) + : KCModule( parent, name ), m_pConfig(config), m_groupname(group) +{ + QVBoxLayout *lay = new QVBoxLayout(this, 10, 5); + + lay->addWidget( new QLabel(i18n("Accept languages:"), this) ); + + le_languages = new QLineEdit(this); + lay->addWidget( le_languages ); + connect(le_languages, SIGNAL(textChanged(const QString&)), + this, SLOT(slotChanged())); + + lay->addSpacing(10); + lay->addWidget( new QLabel(i18n("Accept character sets:"), this) ); + + le_charsets = new QLineEdit(this); + lay->addWidget( le_charsets ); + connect(le_charsets, SIGNAL(textChanged(const QString&)), + this, SLOT(slotChanged())); + + lay->addStretch(10); + + // defaultCharsets = QString("utf-8 ")+klocale->charset()+" iso-8859-1"; + defaultCharsets = QString("utf-8 ")+" iso-8859-1"; // TODO + + // finaly read the options + load(); +} + +void KHTTPOptions::load() +{ + load( false ); +} + +void KHTTPOptions::load( bool useDefaults ) +{ + QString tmp; + + m_pConfig->setReadDefaults( useDefaults ); + + m_pConfig->setGroup( "Browser Settings/HTTP" ); + tmp = m_pConfig->readEntry( "AcceptLanguages",KGlobal::locale()->languageList().join(",")); + le_languages->setText( tmp ); + tmp = m_pConfig->readEntry( "AcceptCharsets",defaultCharsets); + le_charsets->setText( tmp ); + + emit changed( useDefaults ); + +} + +void KHTTPOptions::save() +{ + m_pConfig->setGroup( "Browser Settings/HTTP" ); + m_pConfig->writeEntry( "AcceptLanguages", le_languages->text()); + m_pConfig->writeEntry( "AcceptCharsets", le_charsets->text()); + m_pConfig->sync(); +} + +void KHTTPOptions::defaults() +{ + load( true ); +} + + +void KHTTPOptions::slotChanged() +{ + emit changed(true); +} + + +#include "khttpoptdlg.moc" -- cgit v1.2.1