From 9731934d1c45b7e6f27b58b9083b23ecbc084288 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 14 Feb 2011 23:33:39 +0100 Subject: This patch cleans up encoding management, moving code to its real position: The appearance settings widget. In fact our code is actually changing "default" text encoding, not the page one "on the fly" --- src/settings/appearancewidget.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/settings/appearancewidget.cpp') diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp index c444f724..f07f7b8b 100644 --- a/src/settings/appearancewidget.cpp +++ b/src/settings/appearancewidget.cpp @@ -31,6 +31,9 @@ // Auto Includes #include "rekonq.h" +// KDE Includes +#include +#include AppearanceWidget::AppearanceWidget(QWidget *parent) : QWidget(parent) @@ -53,6 +56,8 @@ AppearanceWidget::AppearanceWidget(QWidget *parent) connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() )); connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() )); connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT( hasChanged() )); + + populateEncodingMenu(); } @@ -83,8 +88,32 @@ void AppearanceWidget::hasChanged() bool AppearanceWidget::isDefault() { bool def = true; - + // TODO: implement me!! - + return def; } + + +void AppearanceWidget::populateEncodingMenu() +{ + encodingCombo->setEditable(false); + QStringList encodings = KGlobal::charsets()->availableEncodingNames(); + encodingCombo->addItems(encodings); + + encodingCombo->setWhatsThis( i18n( "Select the default encoding to be used; normally, you will be fine with 'Use language encoding' " + "and should not have to change this.") ); + + connect(encodingCombo, SIGNAL(activated(const QString &)), this, SLOT(setEncoding(const QString &))); + connect(encodingCombo, SIGNAL(activated(const QString &)), this, SLOT(hasChanged())); + + QString enc = ReKonfig::defaultEncoding(); + int indexOfEnc = encodings.indexOf(enc); + encodingCombo->setCurrentIndex(indexOfEnc); +} + + +void AppearanceWidget::setEncoding(const QString &enc) +{ + ReKonfig::setDefaultEncoding(enc); +} -- cgit v1.2.1