Commit bd2cb091 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Handle fallback packages when checking for screenlocker API version

The current lookandfeel package may not contain the
"X-Plasma-ApiVersion" metadata key but at the same time also not define
a custom lockscreen, instead relying on the fallback mechanism. In that
case, we would end up setting the package path to an empty string,
causing everything else that is using the package to treat it as

To fix that, we need to check if the lockscreen comes from the current
package and if not, check the API version of the fallback package
instead. Additionally, we also should explicitly set the package path to
the default of Breeze instead of using an empty string as path, which
implies an invalid package rather than "use the default".

(cherry picked from commit fdbba676)
parent 8558db3d
Pipeline #184428 passed with stage
in 2 minutes and 20 seconds
......@@ -101,6 +101,25 @@ void disableDrKonqi()
// that would enable drkonqi
// Verify that a package or its fallback is using the right API
bool verifyPackageApi(const KPackage::Package &package)
if (package.metadata().value("X-Plasma-APIVersion", QStringLiteral("1")).toInt() >= 2) {
return true;
if (!package.filePath("lockscreenmainscript").contains(package.path())) {
// The current package does not contain the lock screen and we are
// using the fallback package. So check to see if that package has
// the right version instead.
if (package.fallbackPackage().metadata().value("X-Plasma-APIVersion", QStringLiteral("1")).toInt() >= 2) {
return true;
return false;
class FocusOutEventFilter : public QAbstractNativeEventFilter
......@@ -186,10 +205,9 @@ void UnlockApp::initialize()
if (!KScreenSaverSettingsBase::theme().isEmpty()) {
QString plasmaApiVersion = package.metadata().value("X-Plasma-APIVersion", QStringLiteral("1"));
if (plasmaApiVersion.toInt() <= 1) {
if (!verifyPackageApi(package)) {
qCWarning(KSCREENLOCKER_GREET) << "Lockscreen QML outdated, falling back to default";
m_mainQmlPath = package.fileUrl("lockscreenmainscript");
Supports Markdown
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