summaryrefslogtreecommitdiff
path: root/src/settings/appearancewidget.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-02-14 23:33:39 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-02-14 23:33:39 +0100
commit9731934d1c45b7e6f27b58b9083b23ecbc084288 (patch)
tree20ee22f4b68b75ac54bac2afd09edc038019bf45 /src/settings/appearancewidget.cpp
parentAdded credit for Johannes Troscher (diff)
downloadrekonq-9731934d1c45b7e6f27b58b9083b23ecbc084288.tar.xz
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"
Diffstat (limited to 'src/settings/appearancewidget.cpp')
-rw-r--r--src/settings/appearancewidget.cpp33
1 files changed, 31 insertions, 2 deletions
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 <KGlobal>
+#include <KCharsets>
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);
+}