Simplify findSvgFilePath, define result value on definition

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-05-09 14:37:15 +08:00
parent c42cb28741
commit 1284749d70
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -23,15 +23,16 @@
#include <QSvgRenderer>
namespace {
QString findSvgFilePath(const QString &fileName, const QStringList &possibleColors)
{
QString result;
result = QString{OCC::Theme::themePrefix} + fileName;
auto result = QString{OCC::Theme::themePrefix + fileName};
if (QFile::exists(result)) {
return result;
} else {
for (const auto &color : possibleColors) {
result = QString{OCC::Theme::themePrefix} + color + QStringLiteral("/") + fileName;
result = QString{OCC::Theme::themePrefix + color + QStringLiteral("/") + fileName};
if (QFile::exists(result)) {
return result;
@ -42,6 +43,7 @@ QString findSvgFilePath(const QString &fileName, const QStringList &possibleColo
return result;
}
}
namespace OCC {