Changeset View
Changeset View
Standalone View
Standalone View
greeter/greeterapp.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
48 | #include <KWayland/Client/surface.h> | 48 | #include <KWayland/Client/surface.h> | ||
49 | // Qt | 49 | // Qt | ||
50 | #include <QClipboard> | 50 | #include <QClipboard> | ||
51 | #include <QAbstractNativeEventFilter> | 51 | #include <QAbstractNativeEventFilter> | ||
52 | #include <QtCore/QTimer> | 52 | #include <QtCore/QTimer> | ||
53 | #include <QtGui/QKeyEvent> | 53 | #include <QtGui/QKeyEvent> | ||
54 | #include <qscreen.h> | 54 | #include <qscreen.h> | ||
55 | #include <QThread> | 55 | #include <QThread> | ||
56 | #include <QMimeData> | ||||
56 | 57 | | |||
57 | #include <QQuickView> | 58 | #include <QQuickView> | ||
58 | #include <QQuickItem> | 59 | #include <QQuickItem> | ||
59 | #include <QQmlContext> | 60 | #include <QQmlContext> | ||
60 | #include <QQmlEngine> | 61 | #include <QQmlEngine> | ||
61 | #include <QQmlProperty> | 62 | #include <QQmlProperty> | ||
62 | #include <QQmlExpression> | 63 | #include <QQmlExpression> | ||
63 | 64 | | |||
▲ Show 20 Lines • Show All 331 Lines • ▼ Show 20 Line(s) | |||||
395 | 396 | | |||
396 | void UnlockApp::markViewsAsVisible(KQuickAddons::QuickViewSharedEngine *view) | 397 | void UnlockApp::markViewsAsVisible(KQuickAddons::QuickViewSharedEngine *view) | ||
397 | { | 398 | { | ||
398 | disconnect(view, &QQuickWindow::frameSwapped, this, 0); | 399 | disconnect(view, &QQuickWindow::frameSwapped, this, 0); | ||
399 | QQmlProperty showProperty(view->rootObject(), QStringLiteral("viewVisible")); | 400 | QQmlProperty showProperty(view->rootObject(), QStringLiteral("viewVisible")); | ||
400 | showProperty.write(true); | 401 | showProperty.write(true); | ||
401 | // random state update, actually rather required on init only | 402 | // random state update, actually rather required on init only | ||
402 | QMetaObject::invokeMethod(this, "getFocus", Qt::QueuedConnection); | 403 | QMetaObject::invokeMethod(this, "getFocus", Qt::QueuedConnection); | ||
403 | QGuiApplication::clipboard()->clear(); | 404 | | ||
404 | QGuiApplication::clipboard()->clear(QClipboard::Selection); | 405 | auto mime1 = new QMimeData; | ||
406 | //Effectively we want to clear the clipboard | ||||
407 | //however some clipboard managers (like klipper with it's default settings) | ||||
408 | //will prevent an empty clipbard | ||||
409 | //we need some non-empty non-text mimeData to replace the clipboard so we don't leak real data to a user pasting into the text field | ||||
410 | //as the clipboard is cleared on close, klipper will then put the original text back when we exit | ||||
411 | mime1->setData(QStringLiteral("x-kde-lockscreen"), QByteArrayLiteral("empty")); | ||||
412 | //ownership is transferred | ||||
413 | QGuiApplication::clipboard()->setMimeData(mime1, QClipboard::Clipboard); | ||||
414 | | ||||
415 | auto mime2 = new QMimeData; | ||||
416 | mime2->setData(QStringLiteral("x-kde-lockscreen"), QByteArrayLiteral("empty")); | ||||
417 | QGuiApplication::clipboard()->setMimeData(mime2, QClipboard::Selection); | ||||
405 | } | 418 | } | ||
406 | 419 | | |||
407 | void UnlockApp::getFocus() | 420 | void UnlockApp::getFocus() | ||
408 | { | 421 | { | ||
409 | if (m_views.isEmpty()) { | 422 | if (m_views.isEmpty()) { | ||
410 | return; | 423 | return; | ||
411 | } | 424 | } | ||
412 | QWindow *w = 0; | 425 | QWindow *w = 0; | ||
▲ Show 20 Lines • Show All 331 Lines • Show Last 20 Lines |