diff --git a/src/base/search/searchpluginmanager.cpp b/src/base/search/searchpluginmanager.cpp index c5df002a7..c72aa46df 100644 --- a/src/base/search/searchpluginmanager.cpp +++ b/src/base/search/searchpluginmanager.cpp @@ -47,6 +47,7 @@ #include "base/net/downloadmanager.h" #include "base/preferences.h" #include "base/profile.h" +#include "base/utils/bytearray.h" #include "base/utils/foreignapps.h" #include "base/utils/fs.h" #include "base/utils/misc.h" @@ -495,25 +496,24 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info) { QHash updateInfo; int numCorrectData = 0; - QList lines = info.split('\n'); - foreach (QByteArray line, lines) { + + const QList lines = Utils::ByteArray::splitToViews(info, "\n", QString::SkipEmptyParts); + for (QByteArray line : lines) { line = line.trimmed(); if (line.isEmpty()) continue; if (line.startsWith('#')) continue; - QList list = line.split(' '); + const QList list = Utils::ByteArray::splitToViews(line, ":", QString::SkipEmptyParts); if (list.size() != 2) continue; - QString pluginName = QString(list.first()); - if (!pluginName.endsWith(':')) continue; + const QString pluginName = list.first().trimmed(); + const PluginVersion version = PluginVersion::tryParse(list.last().trimmed(), {}); - pluginName.chop(1); // remove trailing ':' - PluginVersion version = PluginVersion::tryParse(list.last(), {}); - if (version == PluginVersion()) continue; + if (!version.isValid()) continue; ++numCorrectData; if (isUpdateNeeded(pluginName, version)) { - LogMsg(tr("Plugin %1 is outdated").arg(pluginName), Log::INFO); + LogMsg(tr("Plugin \"%1\" is outdated, updating to version %2").arg(pluginName, version), Log::INFO); updateInfo[pluginName] = version; } }