Changeset View
Changeset View
Standalone View
Standalone View
greeter/greeterapp.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 104 | UnlockApp::UnlockApp(int &argc, char **argv) | |||
---|---|---|---|---|---|
105 | : QGuiApplication(argc, argv) | 105 | : QGuiApplication(argc, argv) | ||
106 | , m_resetRequestIgnoreTimer(new QTimer(this)) | 106 | , m_resetRequestIgnoreTimer(new QTimer(this)) | ||
107 | , m_delayedLockTimer(nullptr) | 107 | , m_delayedLockTimer(nullptr) | ||
108 | , m_testing(false) | 108 | , m_testing(false) | ||
109 | , m_ignoreRequests(false) | 109 | , m_ignoreRequests(false) | ||
110 | , m_immediateLock(false) | 110 | , m_immediateLock(false) | ||
111 | , m_graceTime(0) | 111 | , m_graceTime(0) | ||
112 | , m_noLock(false) | 112 | , m_noLock(false) | ||
113 | , m_cursorHidden(false) | ||||
113 | , m_defaultToSwitchUser(false) | 114 | , m_defaultToSwitchUser(false) | ||
114 | , m_wallpaperIntegration(new WallpaperIntegration(this)) | 115 | , m_wallpaperIntegration(new WallpaperIntegration(this)) | ||
115 | , m_lnfIntegration(new LnFIntegration(this)) | 116 | , m_lnfIntegration(new LnFIntegration(this)) | ||
116 | { | 117 | { | ||
117 | m_authenticator = createAuthenticator(); | 118 | m_authenticator = createAuthenticator(); | ||
118 | connect(m_authenticator, &Authenticator::succeeded, this, &QCoreApplication::quit); | 119 | connect(m_authenticator, &Authenticator::succeeded, this, &QCoreApplication::quit); | ||
119 | initialize(); | 120 | initialize(); | ||
120 | connect(this, &UnlockApp::screenAdded, this, &UnlockApp::desktopResized); | 121 | connect(this, &UnlockApp::screenAdded, this, &UnlockApp::desktopResized); | ||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 267 | for (int i = m_views.count(); i < nScreens; ++i) { | |||
300 | const KUser user; | 301 | const KUser user; | ||
301 | const QString fullName = user.property(KUser::FullName).toString(); | 302 | const QString fullName = user.property(KUser::FullName).toString(); | ||
302 | 303 | | |||
303 | context->setContextProperty(QStringLiteral("kscreenlocker_userName"), fullName.isEmpty() ? user.loginName() : fullName); | 304 | context->setContextProperty(QStringLiteral("kscreenlocker_userName"), fullName.isEmpty() ? user.loginName() : fullName); | ||
304 | context->setContextProperty(QStringLiteral("kscreenlocker_userImage"), user.faceIconPath()); | 305 | context->setContextProperty(QStringLiteral("kscreenlocker_userImage"), user.faceIconPath()); | ||
305 | context->setContextProperty(QStringLiteral("authenticator"), m_authenticator); | 306 | context->setContextProperty(QStringLiteral("authenticator"), m_authenticator); | ||
306 | context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_interfaceVersion"), 2); | 307 | context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_interfaceVersion"), 2); | ||
307 | context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_view"), view); | 308 | context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_view"), view); | ||
309 | context->setContextProperty(QStringLiteral("org_kde_plasma_screenlocker_greeter_app"), this); | ||||
308 | context->setContextProperty(QStringLiteral("defaultToSwitchUser"), m_defaultToSwitchUser); | 310 | context->setContextProperty(QStringLiteral("defaultToSwitchUser"), m_defaultToSwitchUser); | ||
309 | context->setContextProperty(QStringLiteral("config"), m_lnfIntegration->configuration()); | 311 | context->setContextProperty(QStringLiteral("config"), m_lnfIntegration->configuration()); | ||
310 | 312 | | |||
311 | view->setSource(m_mainQmlPath); | 313 | view->setSource(m_mainQmlPath); | ||
312 | // on error, load the fallback lockscreen to not lock the user out of the system | 314 | // on error, load the fallback lockscreen to not lock the user out of the system | ||
313 | if (view->status() == QQmlComponent::Error) { | 315 | if (view->status() == QQmlComponent::Error) { | ||
314 | static const QUrl fallbackUrl(QUrl(QStringLiteral("qrc:/fallbacktheme/LockScreen.qml"))); | 316 | static const QUrl fallbackUrl(QUrl(QStringLiteral("qrc:/fallbacktheme/LockScreen.qml"))); | ||
315 | 317 | | |||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Line(s) | 453 | { | |||
453 | m_delayedLockTimer = nullptr; | 455 | m_delayedLockTimer = nullptr; | ||
454 | 456 | | |||
455 | foreach (KQuickAddons::QuickViewSharedEngine *view, m_views) { | 457 | foreach (KQuickAddons::QuickViewSharedEngine *view, m_views) { | ||
456 | QQmlProperty lockProperty(view->rootObject(), QStringLiteral("locked")); | 458 | QQmlProperty lockProperty(view->rootObject(), QStringLiteral("locked")); | ||
457 | lockProperty.write(true); | 459 | lockProperty.write(true); | ||
458 | } | 460 | } | ||
459 | } | 461 | } | ||
460 | 462 | | |||
463 | /* | ||||
464 | * This functionality exists and is exposed to QML, because the QML part | ||||
465 | * is not able to reliably hide the cursor via MouseArea. | ||||
466 | * See: https://bugreports.qt.io/browse/QTBUG-41045 | ||||
467 | */ | ||||
468 | void UnlockApp::setCursorHidden(bool cursorHidden) { | ||||
469 | if (m_cursorHidden == cursorHidden) { | ||||
470 | return; | ||||
471 | } | ||||
472 | m_cursorHidden = cursorHidden; | ||||
473 | if (cursorHidden) { | ||||
474 | setOverrideCursor(Qt::BlankCursor); | ||||
475 | } else { | ||||
476 | restoreOverrideCursor(); | ||||
477 | } | ||||
478 | Q_EMIT cursorHiddenChanged(); | ||||
479 | } | ||||
480 | | ||||
461 | void UnlockApp::resetRequestIgnore() | 481 | void UnlockApp::resetRequestIgnore() | ||
462 | { | 482 | { | ||
463 | m_ignoreRequests = false; | 483 | m_ignoreRequests = false; | ||
464 | } | 484 | } | ||
465 | 485 | | |||
466 | void UnlockApp::suspendToRam() | 486 | void UnlockApp::suspendToRam() | ||
467 | { | 487 | { | ||
468 | if (m_ignoreRequests) { | 488 | if (m_ignoreRequests) { | ||
▲ Show 20 Lines • Show All 276 Lines • Show Last 20 Lines |