Commit 8fbf1586 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

Fix building with Qt6 QTextStrem

parent 72f4163f
......@@ -514,7 +514,11 @@ void KFindTreeView::saveResults()
i18n("Unable to save results."));
} else {
QTextStream stream(&file);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
stream.setEncoding(QStringConverter::System);
#else
stream.setCodec(QTextCodec::codecForLocale());
#endif
const QList<KFindItem> itemList = m_model->getItemList();
if (dialog.selectedMimeTypeFilter() == QLatin1String("text/html")) {
......
......@@ -412,7 +412,12 @@ void KQuery::processQuery(const KFileItem &file)
xmlTags.setPattern(QStringLiteral("<.*>"));
xmlTags.setMinimal(true);
stream = new QTextStream(zippedXmlFileContent, QIODevice::ReadOnly);
// QTextStream default encoding is UTF-8 in Qt6
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream->setCodec("UTF-8");
#endif
isZippedOfficeDocument = true;
} else {
qCWarning(KFING_LOG) << "Cannot open supposed ZIP file " << file.url();
......@@ -441,7 +446,11 @@ void KQuery::processQuery(const KFileItem &file)
qf.setFileName(filename);
qf.open(QIODevice::ReadOnly);
stream = new QTextStream(&qf);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
stream->setEncoding(QStringConverter::System);
#else
stream->setCodec(QTextCodec::codecForLocale());
#endif
}
while (!stream->atEnd())
......
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