Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konqueror / settings / konqhtml / khttpoptdlg.cpp
blob5c404a51233898e8e28e6679c5505df7ef59d4f4
1 /*
2 * Copyright (C) Jacek Konieczny <jajcus@zeus.posl.gliwice.pl>
3 *
4 * Copyright (C) David Faure <faure@kde.org>
5 * Port to KControl
6 *
7 */
9 // Own
10 #include "khttpoptdlg.h"
12 // Qt
13 #include <QtGui/QLayout> //CT
15 // KDE
16 #include <klocale.h>
17 #include <kglobal.h>
18 #include <kconfiggroup.h>
21 KHTTPOptions::KHTTPOptions(KSharedConfig::Ptr config, const QString &group, const KComponentData &componentData, QWidget *parent)
22 : KCModule( componentData, parent ), m_pConfig(config), m_groupname(group)
24 QVBoxLayout *lay = new QVBoxLayout(this);
25 lay->setMargin(10);
26 lay->setSpacing(5);
28 lay->addWidget( new QLabel(i18n("Accept languages:"), this) );
30 le_languages = new QLineEdit(this);
31 lay->addWidget( le_languages );
32 connect(le_languages, SIGNAL(textChanged(const QString&)),
33 this, SLOT(slotChanged()));
35 lay->addSpacing(10);
36 lay->addWidget( new QLabel(i18n("Accept character sets:"), this) );
38 le_charsets = new QLineEdit(this);
39 lay->addWidget( le_charsets );
40 connect(le_charsets, SIGNAL(textChanged(const QString&)),
41 this, SLOT(slotChanged()));
43 lay->addStretch(10);
45 // defaultCharsets = QString("utf-8 ")+klocale->charset()+" iso-8859-1";
46 defaultCharsets = QString("utf-8 ")+" iso-8859-1"; // TODO
47 // if lang=ru or uk then +cp1251+koi8u - these are most used encodings (though locale may/should be utf8) --nick shaforostoff
52 void KHTTPOptions::load()
54 QString tmp;
55 KConfigGroup cg(m_pConfig, "Browser Settings/HTTP");
56 tmp = cg.readEntry( "AcceptLanguages",KGlobal::locale()->languageList().join(","));
57 le_languages->setText( tmp );
58 tmp = cg.readEntry( "AcceptCharsets",defaultCharsets);
59 le_charsets->setText( tmp );
62 void KHTTPOptions::save()
64 KConfigGroup cg(m_pConfig, "Browser Settings/HTTP");
65 cg.writeEntry( "AcceptLanguages", le_languages->text());
66 cg.writeEntry( "AcceptCharsets", le_charsets->text());
67 cg.sync();
70 void KHTTPOptions::defaults()
72 le_languages->setText( KGlobal::locale()->languageList().join(",") );
73 le_charsets->setText( defaultCharsets );
77 void KHTTPOptions::slotChanged()
79 emit changed(true);
83 #include "khttpoptdlg.moc"