diff --git a/wallpapers/image/backgroundlistmodel.h b/wallpapers/image/backgroundlistmodel.h --- a/wallpapers/image/backgroundlistmodel.h +++ b/wallpapers/image/backgroundlistmodel.h @@ -131,6 +131,7 @@ QString token() const; static const QStringList &suffixes(); + static bool isAcceptableSuffix(const QString &suffix); Q_SIGNALS: void backgroundsFound(const QStringList &paths, const QString &token); diff --git a/wallpapers/image/backgroundlistmodel.cpp b/wallpapers/image/backgroundlistmodel.cpp --- a/wallpapers/image/backgroundlistmodel.cpp +++ b/wallpapers/image/backgroundlistmodel.cpp @@ -522,6 +522,14 @@ return m_suffixes; } +bool BackgroundFinder::isAcceptableSuffix(const QString &suffix) +{ + // Despite its name, suffixes() returns a list of glob patterns. + // Therefore the file suffix check needs to include the "*." prefix. + const QStringList &globPatterns = suffixes(); + return globPatterns.contains("*."+suffix.toLower()); +} + void BackgroundFinder::run() { QTime t; diff --git a/wallpapers/image/image.cpp b/wallpapers/image/image.cpp --- a/wallpapers/image/image.cpp +++ b/wallpapers/image/image.cpp @@ -769,7 +769,7 @@ { if(!m_slideshowBackgrounds.contains(path)) { QFileInfo fileInfo(path); - if(fileInfo.isFile() && BackgroundFinder::suffixes().contains(fileInfo.suffix().toLower())) { + if(fileInfo.isFile() && BackgroundFinder::isAcceptableSuffix(fileInfo.suffix())) { m_slideshowBackgrounds.append(path); m_unseenSlideshowBackgrounds.append(path); if(m_slideshowBackgrounds.count() == 1) {