Verified Commit bc8d35ba authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

dict: don't early return when no definition is found

We don't want to abort loading when one dict returns no definition.

CCBUG: 453878
parent 04773128
......@@ -23,7 +23,6 @@ DictEngine::DictEngine(QObject *parent)
, m_serverName(QStringLiteral("dict.org")) // Default, good dictionary
, m_definitionResponses{
QByteArrayLiteral("250"), /**< ok (optional timing information here) */
QByteArrayLiteral("552"), /**< No match */
QByteArrayLiteral("550"), /**< Invalid database */
QByteArrayLiteral("501"), /**< Syntax error, illegal parameters */
QByteArrayLiteral("503"), /**< Command parameter not implemented */
......@@ -72,8 +71,10 @@ static QString wnToHtml(const QString &word, QByteArray &text)
continue;
}
// Don't early return if there are multiple dicts
if (currentLine.startsWith("552") || currentLine.startsWith("501")) {
return i18n("No match found for %1", word);
def += QStringLiteral("<dt><b>%1</b></dt>\n<dd>%2</dd>").arg(word, i18n("No match found for %1", word));
continue;
}
if (!(currentLine.startsWith(QLatin1String("150")) || currentLine.startsWith(QLatin1String("151")) || currentLine.startsWith(QLatin1String("250")))) {
......
......@@ -91,5 +91,5 @@ private:
QTimer m_definitionTimer;
// https://datatracker.ietf.org/doc/html/rfc2229
const std::array<QByteArray, 5> m_definitionResponses;
const std::array<QByteArray, 4> m_definitionResponses;
};
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