Created attachment 181888 [details] Screenshot See screenshot.
I can confirm this on git-master. For Wallpaper type: Image, the wallpapers are not listed alphabetically I also see Mountain - Coast - Nexus Also, Volna comes before Nuvole
(In reply to TraceyC from comment #1) > Also, Volna comes before Nuvole I can't reproduce this, Nuvole is in the right place. Volna is the alphabetically last one, is Nuvole maybe a different version? (e.g. ~/kde/usr/share/wallpapers vs /usr/share/wallpapers)
Nuvole - /usr/share/wallpapers/Next/contents/images_dark - this one comes after Volna Volna - /home/tracey/kde/usr/share/wallpapers/Volna/contents/images There is a second instance of Nuvole in /home/tracey/kde/usr/share/wallpapers/Nuvole/contents/images_dark that's in the right place alphabetically
The solution is probably somewhere in https://invent.kde.org/plasma/plasma-workspace/-/tree/master/wallpapers/image/plugin/model; currently trying to figure it out.
This is a bit complicated. There are two base wallpaper models: one for standalone images (ImageListModel), and one for packages (PackageListModel). On top of them is another model that combines them into one (ImageListProxyModel). Then when used for a slideshow, a proxy model (SlideFilterModel) introduces sorting, but sorts by filename rather than display name. There is no proxy model to introduce sorting for non-slideshow image wallpaper views; ImageProxyModel gets used directly. So we need to: 1. Fix the slideshow sorting to sort by display name, not file path 2. Introduce sorting of the same kind for non-slideshow views, probably by creating a second proxy model for it I'm going to try to do #1 first, and then try my luck at #2, but I may eventually need someone else to help or take over.
While investigating, I also found another bug with the display string being improper with some images, and proposed a fix with https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5580.
Something like this should fix #1, but I haven't gotten it to fully work yet, and my Qt model-fu may not be sufficient to continue here. If anyone enterprising wants to pick up from here (or redo it from scratch to be better), feel free. diff --git a/wallpapers/image/plugin/slidefiltermodel.cpp b/wallpapers/image/plugin/slidefiltermodel.cpp index ed10a20b33..1f09771e03 100644 --- a/wallpapers/image/plugin/slidefiltermodel.cpp +++ b/wallpapers/image/plugin/slidefiltermodel.cpp @@ -19,6 +19,11 @@ namespace { +inline QString getDisplayName(const QModelIndex &modelIndex) +{ + return modelIndex.data(Qt::DisplayRole).toString(); +} + inline QString getLocalFilePath(const QModelIndex &modelIndex) { return modelIndex.data(ImageRoles::PathRole).toUrl().toLocalFile(); @@ -145,20 +150,22 @@ bool SlideFilterModel::lessThan(const QModelIndex &source_left, const QModelInde QFileInfo rightFile(getLocalFilePath(source_right)); QString leftFilePath = getFilePathWithDir(leftFile); QString rightFilePath = getFilePathWithDir(rightFile); + const QString leftImage(getDisplayName(source_left)); + const QString rightImage(getDisplayName(source_right)); if (leftFilePath == rightFilePath) { - return QString::compare(leftFile.fileName(), rightFile.fileName(), cs) < 0; + return QString::compare(leftImage, rightImage, cs) < 0; } else if (leftFilePath.startsWith(rightFilePath, cs)) { return true; } else if (rightFilePath.startsWith(leftFilePath, cs)) { return false; } else { - return QString::compare(leftFilePath, rightFilePath, cs) < 0; + return QString::compare(leftImage, rightImage, cs) < 0; } } else { - QFileInfo leftFile(getLocalFilePath(source_left)); - QFileInfo rightFile(getLocalFilePath(source_right)); - return QString::compare(leftFile.fileName(), rightFile.fileName(), cs) < 0; + const QString leftImage(getDisplayName(source_left)); + const QString rightImage(getDisplayName(source_right)); + return QString::compare(leftImage, rightImage, cs) < 0; } case SortingMode::AlphabeticalReversed: if (m_SortingFoldersFirst) { @@ -166,20 +173,22 @@ bool SlideFilterModel::lessThan(const QModelIndex &source_left, const QModelInde QFileInfo rightFile(getLocalFilePath(source_right)); QString leftFilePath = getFilePathWithDir(leftFile); QString rightFilePath = getFilePathWithDir(rightFile); + const QString leftImage(getDisplayName(source_left)); + const QString rightImage(getDisplayName(source_right)); if (leftFilePath == rightFilePath) { - return QString::compare(leftFile.fileName(), rightFile.fileName(), cs) > 0; + return QString::compare(leftImage, rightImage, cs) > 0; } else if (leftFilePath.startsWith(rightFilePath, cs)) { return true; } else if (rightFilePath.startsWith(leftFilePath, cs)) { return false; } else { - return QString::compare(leftFilePath, rightFilePath, cs) > 0; + return QString::compare(leftImage, rightImage, cs) > 0; } } else { - QFileInfo leftFile(getLocalFilePath(source_left)); - QFileInfo rightFile(getLocalFilePath(source_right)); - return QString::compare(leftFile.fileName(), rightFile.fileName(), cs) > 0; + const QString leftImage(getDisplayName(source_left)); + const QString rightImage(getDisplayName(source_right)); + return QString::compare(leftImage, rightImage, cs) > 0; } case SortingMode::Modified: // oldest first {
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5841
Git commit ddb208848825473cd67a82e9243f3024e2288369 by David Redondo. Committed on 26/09/2025 at 10:12. Pushed by davidre into branch 'master'. wallpapers/slideshow: Use user visible strings for sorting Sorting the file names leads to puzzling results for the user. Co-Authored-By: Nate Graham <nate@kde.org> M +19 -10 wallpapers/image/plugin/slidefiltermodel.cpp https://invent.kde.org/plasma/plasma-workspace/-/commit/ddb208848825473cd67a82e9243f3024e2288369
Git commit 6b72204bb4ba3547450e368d70338d79decf8f70 by David Redondo. Committed on 26/09/2025 at 10:12. Pushed by davidre into branch 'master'. wallpapers/image: Sort wallpapers alphabetically FIXED-IN: 6.5 M +24 -1 wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml https://invent.kde.org/plasma/plasma-workspace/-/commit/6b72204bb4ba3547450e368d70338d79decf8f70
Git commit 3b00327fd74d7297b94cdbb61fa8d22918d83863 by David Redondo. Committed on 26/09/2025 at 11:56. Pushed by davidre into branch 'Plasma/6.5'. wallpapers/slideshow: Use user visible strings for sorting Sorting the file names leads to puzzling results for the user. Co-Authored-By: Nate Graham <nate@kde.org> (cherry picked from commit ddb208848825473cd67a82e9243f3024e2288369) M +19 -10 wallpapers/image/plugin/slidefiltermodel.cpp https://invent.kde.org/plasma/plasma-workspace/-/commit/3b00327fd74d7297b94cdbb61fa8d22918d83863
Git commit 3785a93f002eac41b90a0b3c74a995b1e286d0ec by David Redondo. Committed on 26/09/2025 at 11:56. Pushed by davidre into branch 'Plasma/6.5'. wallpapers/image: Sort wallpapers alphabetically FIXED-IN: 6.5 (cherry picked from commit 6b72204bb4ba3547450e368d70338d79decf8f70) M +24 -1 wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml https://invent.kde.org/plasma/plasma-workspace/-/commit/3785a93f002eac41b90a0b3c74a995b1e286d0ec