diff options
| author | 2023-10-04 11:25:05 +0200 | |
|---|---|---|
| committer | 2023-10-18 10:26:35 +0200 | |
| commit | 29e92a939647612842b2f583ce0a43dd572b1345 (patch) | |
| tree | be091f42ad1c2ff70d670bd8bba597b9bbf8aae1 /src/modules/help/HelpIndex.cpp | |
| parent | Qt6 is stricter when casting numericals and chars. Add an explicit cast/conve... (diff) | |
| download | KVIrc-29e92a939647612842b2f583ce0a43dd572b1345.tar.gz KVIrc-29e92a939647612842b2f583ce0a43dd572b1345.tar.bz2 KVIrc-29e92a939647612842b2f583ce0a43dd572b1345.zip | |
Port from QRegExp (unavailable on qt6) to KviRegExp, based on QRegularExpression
Method str_kvs_fnc_split() had to be replaced with the original version, since the newer one relied on Qt5's QStringRef
Diffstat (limited to 'src/modules/help/HelpIndex.cpp')
| -rw-r--r-- | src/modules/help/HelpIndex.cpp | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/src/modules/help/HelpIndex.cpp b/src/modules/help/HelpIndex.cpp index 102b666e8..4ce07616f 100644 --- a/src/modules/help/HelpIndex.cpp +++ b/src/modules/help/HelpIndex.cpp @@ -190,29 +190,6 @@ void HelpIndex::insertInDict(const QString & str, int docNum) } } -QString HelpIndex::getCharsetForDocument(QFile * file) -{ - QTextStream s(file); - QString contents = s.readAll(); - - QString encoding; - int start = contents.indexOf(QLatin1String("<meta"), 0, Qt::CaseInsensitive); - if(start > 0) - { - int end = contents.indexOf(QLatin1String(">"), start); - QString meta = contents.mid(start + 5, end - start); - meta = meta.toLower(); - QRegExp r(QLatin1String("charset=([^\"\\s]+)")); - if(r.indexIn(meta) != -1) - encoding = r.cap(1); - } - - file->seek(0); - if(encoding.isEmpty()) - return QLatin1String("utf-8"); - return encoding; -} - void HelpIndex::parseDocument(const QString & filename, int docNum) { QFile file(filename); @@ -223,9 +200,7 @@ void HelpIndex::parseDocument(const QString & filename, int docNum) } QTextStream s(&file); - QString en = getCharsetForDocument(&file); - s.setCodec(QTextCodec::codecForName(en.toLatin1().constData())); - + s.setCodec(QTextCodec::codecForMib(106)); QString text = s.readAll(); if(text.isNull()) return; |
