Commit 8be6fb74 authored by Nate Graham's avatar Nate Graham 💤
Browse files

[wallpapers/image] Add default XDG wallpaper locations for slideshow

Summary:
BUG: 415461
FIXED-IN: 5.18.0
Depends on D26510

Right now when you first change the wallpaper plugin to slideshow, no locations are
pre-configured, so you have to add one yourself. This patch adds a
`preferred:wallpaperlocations` token as the default that gets replaced in the user's
config file at runtime with the XDG wallpaper locations.

Test Plan:
Log in as new user > right-click desktop > configure > change to slideshow wallpaper
See that`/usr/share/wallpapers` is already in the list of wallpaper locations; how nice

Reviewers: #plasma, #vdg, ndavis, davidedmundson

Reviewed By: #plasma, #vdg, ndavis, davidedmundson

Subscribers: davidre, broulik, davidedmundson, ndavis, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26483
parent 61a89ec9
......@@ -149,9 +149,6 @@ void Image::setRenderingMode(RenderingMode mode)
m_mode = mode;
if (m_mode == SlideShow) {
if (m_slidePaths.isEmpty()) {
m_slidePaths << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("share/wallpapers"), QStandardPaths::LocateDirectory);
}
startSlideshow();
......@@ -359,8 +356,15 @@ void Image::setSlidePaths(const QStringList &slidePaths)
m_slidePaths = slidePaths;
m_slidePaths.removeAll(QString());
if (m_slidePaths.isEmpty()) {
m_slidePaths << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("share/wallpapers"), QStandardPaths::LocateDirectory);
if (!m_slidePaths.isEmpty()) {
// Replace 'preferred://wallpaperlocations' with real paths
const QStringList preProcessedPaths = m_slidePaths;
for (const QString &path : preProcessedPaths) {
if (path == QLatin1String("preferred://wallpaperlocations")) {
m_slidePaths << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("wallpapers"), QStandardPaths::LocateDirectory);
m_slidePaths.removeAll(path);
}
}
}
if (m_mode == SlideShow) {
......
......@@ -24,7 +24,7 @@
</entry>
<entry name="SlidePaths" type="StringList">
<label>Paths used for the slideshow</label>
<default></default>
<default>preferred://wallpaperlocations</default>
</entry>
<entry name="SlideInterval" type="int">
<label>Interval between slides (s)</label>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment