wallpapers/image: Fix slideshow not remembering the last shown picture
Original commit message(s)
- wallpapers/image: Fix slideshow not remembering the last shown picture
When a slideshow wallpaper is saved, the image URL is stored as a string like "file:///path/to/image.jpg". When Plasma restarts, this URL string is passed to SlideModel::indexOf().
The previous code used QUrl::fromLocalFile(packagePath) which incorrectly treats the URL string as a local file path, creating a malformed URL like "file:file:///path/to/image.jpg". This caused the image lookup to fail (indexOf() returned -1), making the slideshow restart from the first image instead of the last shown one.
Fix this by using QUrl::fromUserInput(packagePath) which correctly handles both local file paths and URL strings.
Also add a unit test to verify indexOf() works correctly with URL strings.
Reason for the change
Test plan
Screenshots or screen recordings
Bugs fixed
BUG: 512559 Assisted-by: Kilo Code: glm-5