summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-06-18 10:57:40 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-06-18 10:57:40 +0200
commit4ff25e9e071625c8cae97a4d52f39716caa24a79 (patch)
tree55141915b171de8e1ecb67b86ebc46709ccdcba8 /src/mainwindow.cpp
parentFix Network Analyzer Panel switch.. (diff)
downloadrekonq-4ff25e9e071625c8cae97a4d52f39716caa24a79.tar.xz
Adding a "default" encoding option..
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2d0ed7dd..2aa67868 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1292,6 +1292,14 @@ void MainWindow::setEncoding(QAction *qa)
QString currentCodec = qa->text().toLatin1();
currentCodec = currentCodec.remove('&');
kDebug() << "Setting codec: " << currentCodec;
+ if(currentCodec == QL1S("Default") )
+ {
+ kDebug() << "QWebSettings::globalSettings()->defaultTextEncoding() = " << QWebSettings::globalSettings()->defaultTextEncoding();
+ currentTab()->view()->settings()->setDefaultTextEncoding( QWebSettings::globalSettings()->defaultTextEncoding() );
+ currentTab()->view()->reload();
+ return;
+ }
+
currentTab()->view()->settings()->setDefaultTextEncoding(currentCodec);
currentTab()->view()->reload();
}
@@ -1318,6 +1326,8 @@ void MainWindow::populateEncodingMenu()
KMenu *otherMenu = new KMenu( QL1S("Other"), m_encodingMenu);
QAction *a;
+ bool isDefaultCodecUsed = true;
+
Q_FOREACH(const QString &codec, codecs)
{
@@ -1334,8 +1344,17 @@ void MainWindow::populateEncodingMenu()
a->setCheckable(true);
if (currentCodec == codec)
+ {
a->setChecked(true);
+ isDefaultCodecUsed = false;
+ }
}
+
+ a = new QAction( QL1S("Default"), this);
+ a->setCheckable(true);
+ a->setChecked(isDefaultCodecUsed);
+
+ m_encodingMenu->addAction( a );
m_encodingMenu->addMenu( isoMenu );
m_encodingMenu->addMenu( winMenu );
m_encodingMenu->addMenu( isciiMenu );