1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Encoding: Make character encoding menu working again

This commit is contained in:
David Rosca 2015-02-08 11:42:01 +01:00
parent 8c068b1f87
commit f366dbd11f

View File

@ -83,6 +83,7 @@
#include <QPrintPreviewDialog> #include <QPrintPreviewDialog>
#include <QPrinter> #include <QPrinter>
#include <QWebEngineHistory> #include <QWebEngineHistory>
#include <QWebEngineSettings>
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QToolTip> #include <QToolTip>
@ -436,11 +437,7 @@ void BrowserWindow::createEncodingSubMenu(const QString &name, QStringList &code
std::sort(codecNames.begin(), codecNames.end()); std::sort(codecNames.begin(), codecNames.end());
QMenu* subMenu = new QMenu(name, menu); QMenu* subMenu = new QMenu(name, menu);
#if QTWEBENGINE_DISABLED const QString activeCodecName = QWebEngineSettings::globalSettings()->defaultTextEncoding();
const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding();
#else
const QString activeCodecName = QL1S("UTF-8");
#endif
foreach (const QString &codecName, codecNames) { foreach (const QString &codecName, codecNames) {
subMenu->addAction(createEncodingAction(codecName, activeCodecName, subMenu)); subMenu->addAction(createEncodingAction(codecName, activeCodecName, subMenu));
@ -681,9 +678,7 @@ void BrowserWindow::changeEncoding()
{ {
if (QAction* action = qobject_cast<QAction*>(sender())) { if (QAction* action = qobject_cast<QAction*>(sender())) {
const QString encoding = action->data().toString(); const QString encoding = action->data().toString();
#if QTWEBENGINE_DISABLED
QWebEngineSettings::globalSettings()->setDefaultTextEncoding(encoding); QWebEngineSettings::globalSettings()->setDefaultTextEncoding(encoding);
#endif
Settings settings; Settings settings;
settings.setValue("Web-Browser-Settings/DefaultEncoding", encoding); settings.setValue("Web-Browser-Settings/DefaultEncoding", encoding);
@ -1019,11 +1014,7 @@ void BrowserWindow::createSidebarsMenu(QMenu* menu)
void BrowserWindow::createEncodingMenu(QMenu* menu) void BrowserWindow::createEncodingMenu(QMenu* menu)
{ {
#if QTWEBENGINE_DISABLED const QString activeCodecName = QWebEngineSettings::globalSettings()->defaultTextEncoding();
const QString activeCodecName = QWebSettings::globalSettings()->defaultTextEncoding();
#else
const QString activeCodecName = QL1S("UTF-8");
#endif
QStringList isoCodecs, utfCodecs, windowsCodecs, isciiCodecs, otherCodecs; QStringList isoCodecs, utfCodecs, windowsCodecs, isciiCodecs, otherCodecs;