2 * Copyright (C) Jacek Konieczny <jajcus@zeus.posl.gliwice.pl>
4 * Copyright (C) David Faure <faure@kde.org>
10 #include "khttpoptdlg.h"
13 #include <QtGui/QLayout> //CT
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);
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()));
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()));
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()
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());
70 void KHTTPOptions::defaults()
72 le_languages
->setText( KGlobal::locale()->languageList().join(",") );
73 le_charsets
->setText( defaultCharsets
);
77 void KHTTPOptions::slotChanged()
83 #include "khttpoptdlg.moc"