wallpapers/image: add current image to list if it's not in list

The current wallpaper image can be set by a Plasma script. In that case,
the wallpaper is not added to the list, so also check the current image
is already added after opening the config dialog.

BUG: 458364
FIXED-IN: 5.26
wilder-5.26
Fushan Wen 4 years ago
parent 01a5763602
commit 51107d9ab4
  1. 8
      wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml
  2. 2
      wallpapers/image/plugin/imagebackend.cpp

@ -24,9 +24,13 @@ Item {
Connections { Connections {
target: imageWallpaper target: imageWallpaper
function onLoadingChanged() { function onLoadingChanged() {
if (!imageWallpaper.loading) { if (imageWallpaper.loading) {
wallpapersGrid.resetCurrentIndex(); return;
} }
if (configDialog.currentWallpaper === "org.kde.image" && imageModel.indexOf(cfg_Image) < 0) {
imageWallpaper.addUsersWallpaper(cfg_Image);
}
wallpapersGrid.resetCurrentIndex();
} }
function onWallpaperBrowseCompleted() { function onWallpaperBrowseCompleted() {

@ -376,7 +376,7 @@ void ImageBackend::slotWallpaperBrowseCompleted()
QString ImageBackend::addUsersWallpaper(const QUrl &url) QString ImageBackend::addUsersWallpaper(const QUrl &url)
{ {
auto results = static_cast<ImageProxyModel *>(wallpaperModel())->addBackground(url.toLocalFile()); auto results = static_cast<ImageProxyModel *>(wallpaperModel())->addBackground(url.isLocalFile() ? url.toLocalFile() : url.toString());
if (!m_usedInConfig) { if (!m_usedInConfig) {
m_model->commitAddition(); m_model->commitAddition();

Loading…
Cancel
Save