Commit 23a928d9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port QTextCodec

parent b317fa5b
Pipeline #49373 failed with stage
in 8 minutes and 45 seconds
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
#include <QFile> #include <QFile>
#include <QRegularExpression> #include <QRegularExpression>
#include <QStandardPaths> #include <QStandardPaths>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QTextCodec>
#endif
RenameCategory KDebugSettingsUtil::parseRenameCategory(QString line, const QString &filename) RenameCategory KDebugSettingsUtil::parseRenameCategory(QString line, const QString &filename)
{ {
...@@ -51,7 +54,11 @@ RenameCategory::List KDebugSettingsUtil::readRenameCategories(const QString &fil ...@@ -51,7 +54,11 @@ RenameCategory::List KDebugSettingsUtil::readRenameCategories(const QString &fil
} else { } else {
QString data; QString data;
QTextStream ts(&file); QTextStream ts(&file);
ts.setCodec("ISO-8859-1"); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec(QTextCodec::codecForName("ISO-8859-1"));
#else
ts.setEncoding(QStringConverter::Encoding::Latin1);
#endif
while (!ts.atEnd()) { while (!ts.atEnd()) {
data = ts.readLine().simplified(); data = ts.readLine().simplified();
const RenameCategory category = parseRenameCategory(data, filename); const RenameCategory category = parseRenameCategory(data, filename);
...@@ -189,7 +196,11 @@ KdeLoggingCategory::List KDebugSettingsUtil::readLoggingCategoriesForInserting(c ...@@ -189,7 +196,11 @@ KdeLoggingCategory::List KDebugSettingsUtil::readLoggingCategoriesForInserting(c
} else { } else {
QString data; QString data;
QTextStream ts(&file); QTextStream ts(&file);
ts.setCodec("ISO-8859-1"); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec(QTextCodec::codecForName("ISO-8859-1"));
#else
ts.setEncoding(QStringConverter::Encoding::Latin1);
#endif
while (!ts.atEnd()) { while (!ts.atEnd()) {
data = ts.readLine().simplified(); data = ts.readLine().simplified();
const KdeLoggingCategory category = parseLineKdeLoggingCategory(data, filename); const KdeLoggingCategory category = parseLineKdeLoggingCategory(data, filename);
...@@ -223,7 +234,11 @@ void KDebugSettingsUtil::readLoggingCategories(const QString &filename, KdeLoggi ...@@ -223,7 +234,11 @@ void KDebugSettingsUtil::readLoggingCategories(const QString &filename, KdeLoggi
} else { } else {
QString data; QString data;
QTextStream ts(&file); QTextStream ts(&file);
ts.setCodec("ISO-8859-1"); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec(QTextCodec::codecForName("ISO-8859-1"));
#else
ts.setEncoding(QStringConverter::Encoding::Latin1);
#endif
while (!ts.atEnd()) { while (!ts.atEnd()) {
data = ts.readLine().simplified(); data = ts.readLine().simplified();
const KdeLoggingCategory category = parseLineKdeLoggingCategory(data, filename); const KdeLoggingCategory category = parseLineKdeLoggingCategory(data, filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment