Commit 717e7616 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

more qt6 fixes

parent 94275a57
Pipeline #153623 passed with stage
in 3 minutes and 19 seconds
......@@ -41,6 +41,7 @@
#include <QJsonArray>
#include <QJsonDocument>
#include <QLoggingCategory>
#include <QRegularExpression>
#include <QTextCodec>
#include <QUrlQuery>
......@@ -233,20 +234,12 @@ bool KateApp::startupKate()
// handle stdin input
if (m_args.isSet(QStringLiteral("stdin"))) {
QTextStream input(stdin, QIODevice::ReadOnly);
QFile input;
input.open(stdin, QIODevice::ReadOnly);
QString text = codec ? codec->toUnicode(input.readAll()) : QString::fromLocal8Bit(input.readAll());
// set chosen codec
if (codec) {
input.setCodec(codec);
}
QString line;
QString text;
do {
line = input.readLine();
text.append(line + QLatin1Char('\n'));
} while (!line.isNull());
// normalize line endings, to e.g. catch issues with \r\n on Windows
text.replace(QRegularExpression(QStringLiteral("\r\n?")), QStringLiteral("\n"));
openInput(text, codec_name);
} else if (doc) {
......
......@@ -27,6 +27,7 @@
#include <QDBusReply>
#include <QDir>
#include <QJsonDocument>
#include <QRegularExpression>
#include <QSessionManager>
#include <QTextCodec>
#include <QUrl>
......@@ -503,22 +504,15 @@ int main(int argc, char **argv)
}
if (parser.isSet(readStdInOption)) {
QTextStream input(stdin, QIODevice::ReadOnly);
// set chosen codec
QTextCodec *codec = parser.isSet(useEncodingOption) ? QTextCodec::codecForName(parser.value(useEncodingOption).toUtf8()) : nullptr;
if (codec) {
input.setCodec(codec);
}
QString line;
QString text;
QFile input;
input.open(stdin, QIODevice::ReadOnly);
QString text = codec ? codec->toUnicode(input.readAll()) : QString::fromLocal8Bit(input.readAll());
do {
line = input.readLine();
text.append(line + QLatin1Char('\n'));
} while (!line.isNull());
// normalize line endings, to e.g. catch issues with \r\n on Windows
text.replace(QRegularExpression(QStringLiteral("\r\n?")), QStringLiteral("\n"));
QDBusMessage m = QDBusMessage::createMethodCall(serviceName,
QStringLiteral("/MainApplication"),
......
Supports Markdown
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