Commit bfb91f9d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Make sure we're looking both for json and desktop metadata

We shouldn't assume metadata is in metadata.desktop

REVIEW: 129276
parent 3f859c3d
......@@ -141,8 +141,8 @@ PlasmaQuick::ConfigModel *ContainmentConfigView::wallpaperConfigModel()
QStringList packages;
foreach (const QString &sdir, dir.entryList(QDir::AllDirs | QDir::Readable)) {
QString metadata = dirPath + '/' + sdir + "/metadata.desktop";
if (QFile::exists(metadata)) {
const QString metadata = dirPath + '/' + sdir;
if (QFile::exists(metadata + "/metadata.json") || QFile::exists(metadata + "/metadata.desktop")) {
packages << sdir;
}
}
......
......@@ -510,6 +510,11 @@ QScriptValue ScriptEngine::V1::loadTemplate(QScriptContext *context, QScriptEngi
if (sc) {
const QString overridePackagePath = sc->lookAndFeelPackage().path() + QStringLiteral("contents/layouts/") + pluginData.pluginId();
path = overridePackagePath + QStringLiteral("/metadata.json");
if (QFile::exists(path)) {
package.setPath(overridePackagePath);
}
path = overridePackagePath + QStringLiteral("/metadata.desktop");
if (QFile::exists(path)) {
package.setPath(overridePackagePath);
......@@ -518,7 +523,10 @@ QScriptValue ScriptEngine::V1::loadTemplate(QScriptContext *context, QScriptEngi
}
if (!package.isValid()) {
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, package.defaultPackageRoot() + pluginData.pluginId() + "/metadata.desktop");
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, package.defaultPackageRoot() + pluginData.pluginId() + "/metadata.json");
if (path.isEmpty()) {
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, package.defaultPackageRoot() + pluginData.pluginId() + "/metadata.desktop");
}
if (path.isEmpty()) {
// qDebug() << "script path is empty";
return false;
......
......@@ -559,7 +559,7 @@ void BackgroundFinder::run()
}
const QString filePath = wp.filePath();
if (QFile::exists(filePath + QString::fromLatin1("/metadata.desktop"))) {
if (QFile::exists(filePath + QString::fromLatin1("/metadata.desktop")) || QFile::exists(filePath + QString::fromLatin1("/metadata.json"))) {
package.setPath(filePath);
if (package.isValid()) {
if (!package.filePath("images").isEmpty()) {
......
......@@ -453,7 +453,9 @@ void Image::setSingleImage()
}
} else {
//if it's not an absolute path, check if it's just a wallpaper name
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("wallpapers/") + QString(m_wallpaper + QString::fromLatin1("/metadata.desktop")));
QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("wallpapers/") + QString(m_wallpaper + QString::fromLatin1("/metadata.json")));
if (path.isEmpty())
path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("wallpapers/") + QString(m_wallpaper + QString::fromLatin1("/metadata.desktop")));
if (!path.isEmpty()) {
QDir dir(path);
......
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