Changeset View
Changeset View
Standalone View
Standalone View
greeter/greeterapp.cpp
Show All 19 Lines | |||||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | #include "greeterapp.h" | 21 | #include "greeterapp.h" | ||
22 | #include "kscreensaversettingsbase.h" | 22 | #include "kscreensaversettingsbase.h" | ||
23 | #include "authenticator.h" | 23 | #include "authenticator.h" | ||
24 | #include "noaccessnetworkaccessmanagerfactory.h" | 24 | #include "noaccessnetworkaccessmanagerfactory.h" | ||
25 | #include "wallpaper_integration.h" | 25 | #include "wallpaper_integration.h" | ||
26 | #include "lnf_integration.h" | 26 | #include "lnf_integration.h" | ||
27 | 27 | | |||
28 | #include <kscreenlocker_greet_logging.h> | ||||
28 | #include <config-kscreenlocker.h> | 29 | #include <config-kscreenlocker.h> | ||
29 | 30 | | |||
30 | // KDE | 31 | // KDE | ||
31 | #include <KAuthorized> | 32 | #include <KAuthorized> | ||
32 | #include <KCrash> | 33 | #include <KCrash> | ||
33 | #include <kdeclarative/kdeclarative.h> | 34 | #include <kdeclarative/kdeclarative.h> | ||
34 | #include <KDeclarative/KQuickAddons/QuickViewSharedEngine> | 35 | #include <KDeclarative/KQuickAddons/QuickViewSharedEngine> | ||
35 | #include <KDeclarative/QmlObjectSharedEngine> | 36 | #include <KDeclarative/QmlObjectSharedEngine> | ||
▲ Show 20 Lines • Show All 216 Lines • ▼ Show 20 Line(s) | 237 | { | |||
252 | } | 253 | } | ||
253 | m_plasmaShell = r->createPlasmaShell(i.name, i.version, this); | 254 | m_plasmaShell = r->createPlasmaShell(i.name, i.version, this); | ||
254 | } | 255 | } | ||
255 | 256 | | |||
256 | void UnlockApp::loadWallpaperPlugin(KQuickAddons::QuickViewSharedEngine *view) | 257 | void UnlockApp::loadWallpaperPlugin(KQuickAddons::QuickViewSharedEngine *view) | ||
257 | { | 258 | { | ||
258 | auto package = m_wallpaperIntegration->package(); | 259 | auto package = m_wallpaperIntegration->package(); | ||
259 | if (!package.isValid()) { | 260 | if (!package.isValid()) { | ||
260 | qWarning() << "Error loading the wallpaper, no valid package loaded"; | 261 | qCWarning(KSCREENLOCKER_GREET) << "Error loading the wallpaper, no valid package loaded"; | ||
261 | return; | 262 | return; | ||
262 | } | 263 | } | ||
263 | 264 | | |||
264 | auto qmlObject = new KDeclarative::QmlObjectSharedEngine(view); | 265 | auto qmlObject = new KDeclarative::QmlObjectSharedEngine(view); | ||
265 | qmlObject->setInitializationDelayed(true); | 266 | qmlObject->setInitializationDelayed(true); | ||
266 | qmlObject->setPackage(package); | 267 | qmlObject->setPackage(package); | ||
267 | qmlObject->rootContext()->setContextProperty(QStringLiteral("wallpaper"), m_wallpaperIntegration); | 268 | qmlObject->rootContext()->setContextProperty(QStringLiteral("wallpaper"), m_wallpaperIntegration); | ||
268 | view->setProperty("wallpaperGraphicsObject", QVariant::fromValue(qmlObject)); | 269 | view->setProperty("wallpaperGraphicsObject", QVariant::fromValue(qmlObject)); | ||
269 | connect(qmlObject, &KDeclarative::QmlObject::finished, this, | 270 | connect(qmlObject, &KDeclarative::QmlObject::finished, this, | ||
270 | [this, qmlObject, view] { | 271 | [this, qmlObject, view] { | ||
271 | auto item = qobject_cast<QQuickItem*>(qmlObject->rootObject()); | 272 | auto item = qobject_cast<QQuickItem*>(qmlObject->rootObject()); | ||
272 | if (!item) { | 273 | if (!item) { | ||
273 | qWarning() << "Wallpaper needs to be a QtQuick Item"; | 274 | qCWarning(KSCREENLOCKER_GREET) << "Wallpaper needs to be a QtQuick Item"; | ||
274 | return; | 275 | return; | ||
275 | } | 276 | } | ||
276 | item->setParentItem(view->rootObject()); | 277 | item->setParentItem(view->rootObject()); | ||
277 | item->setZ(-1000); | 278 | item->setZ(-1000); | ||
278 | 279 | | |||
279 | //set anchors | 280 | //set anchors | ||
280 | QQmlExpression expr(qmlObject->engine()->rootContext(), item, QStringLiteral("parent")); | 281 | QQmlExpression expr(qmlObject->engine()->rootContext(), item, QStringLiteral("parent")); | ||
281 | QQmlProperty prop(item, QStringLiteral("anchors.fill")); | 282 | QQmlProperty prop(item, QStringLiteral("anchors.fill")); | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 300 | for (int i = m_views.count(); i < nScreens; ++i) { | |||
341 | context->setContextProperty(QStringLiteral("defaultToSwitchUser"), m_defaultToSwitchUser); | 342 | context->setContextProperty(QStringLiteral("defaultToSwitchUser"), m_defaultToSwitchUser); | ||
342 | context->setContextProperty(QStringLiteral("config"), m_lnfIntegration->configuration()); | 343 | context->setContextProperty(QStringLiteral("config"), m_lnfIntegration->configuration()); | ||
343 | 344 | | |||
344 | view->setSource(m_mainQmlPath); | 345 | view->setSource(m_mainQmlPath); | ||
345 | // on error, load the fallback lockscreen to not lock the user out of the system | 346 | // on error, load the fallback lockscreen to not lock the user out of the system | ||
346 | if (view->status() != QQmlComponent::Ready) { | 347 | if (view->status() != QQmlComponent::Ready) { | ||
347 | static const QUrl fallbackUrl(QUrl(QStringLiteral("qrc:/fallbacktheme/LockScreen.qml"))); | 348 | static const QUrl fallbackUrl(QUrl(QStringLiteral("qrc:/fallbacktheme/LockScreen.qml"))); | ||
348 | 349 | | |||
349 | qWarning() << "Failed to load lockscreen QML, falling back to built-in locker"; | 350 | qCWarning(KSCREENLOCKER_GREET) | ||
351 | << "Failed to load lockscreen QML, falling back to built-in locker"; | ||||
352 | | ||||
350 | m_mainQmlPath = fallbackUrl; | 353 | m_mainQmlPath = fallbackUrl; | ||
351 | view->setSource(fallbackUrl); | 354 | view->setSource(fallbackUrl); | ||
352 | } | 355 | } | ||
353 | view->setResizeMode(KQuickAddons::QuickViewSharedEngine::SizeRootObjectToView); | 356 | view->setResizeMode(KQuickAddons::QuickViewSharedEngine::SizeRootObjectToView); | ||
354 | 357 | | |||
355 | loadWallpaperPlugin(view); | 358 | loadWallpaperPlugin(view); | ||
356 | // overwrite the factory set by kdeclarative | 359 | // overwrite the factory set by kdeclarative | ||
357 | auto oldFactory = view->engine()->networkAccessManagerFactory(); | 360 | auto oldFactory = view->engine()->networkAccessManagerFactory(); | ||
▲ Show 20 Lines • Show All 415 Lines • Show Last 20 Lines |