diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 4cb3d5c5a..7cc4cb73f 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -1,817 +1,817 @@ /***************************************************************** ksmserver - the KDE session management server Copyright 2000 Matthias Ettrich relatively small extensions by Oswald Buddenhagen some code taken from the dcopserver (part of the KDE libraries), which is Copyright 1999 Matthias Ettrich Copyright 1999 Preston Brown Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include #include // HAVE_LIMITS_H #include #include #include #include #include #include #ifdef HAVE_SYS_TIME_H #include #endif #include #include #include #include #include #include #include #include #include #ifdef HAVE_LIMITS_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "server.h" #include "global.h" #include "client.h" #include #include #include #include #include void KSMServer::logout( int confirm, int sdtype, int sdmode ) { // KDE5: remove me if (sdtype == KWorkSpace::ShutdownTypeLogout) sdtype = KWorkSpace::ShutdownTypeNone; shutdown( (KWorkSpace::ShutdownConfirm)confirm, (KWorkSpace::ShutdownType)sdtype, (KWorkSpace::ShutdownMode)sdmode ); } bool KSMServer::canShutdown() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); config->reparseConfiguration(); // config may have changed in the KControl module KConfigGroup cg( config, "General"); return cg.readEntry( "offerShutdown", true ) && KDisplayManager().canShutdown(); } bool KSMServer::isShuttingDown() const { return state >= Shutdown; } bool readFromPipe(int pipe) { QFile readPipe; if (!readPipe.open(pipe, QIODevice::ReadOnly)) { return false; } QByteArray result = readPipe.readLine(); if (result.isEmpty()) { return false; } bool ok = false; const int number = result.toInt(&ok); if (!ok) { return false; } KSMServer::self()->shutdownType = KWorkSpace::ShutdownType(number); return true; } void KSMServer::shutdown( KWorkSpace::ShutdownConfirm confirm, KWorkSpace::ShutdownType sdtype, KWorkSpace::ShutdownMode sdmode ) { qCDebug(KSMSERVER) << "Shutdown called with confirm " << confirm << " type " << sdtype << " and mode " << sdmode; pendingShutdown.stop(); if( dialogActive ) return; if( state >= Shutdown ) // already performing shutdown return; if( state != Idle ) // performing startup { // perform shutdown as soon as startup is finished, in order to avoid saving partial session if( !pendingShutdown.isActive()) { pendingShutdown.start( 1000 ); pendingShutdown_confirm = confirm; pendingShutdown_sdtype = sdtype; pendingShutdown_sdmode = sdmode; } return; } KSharedConfig::Ptr config = KSharedConfig::openConfig(); config->reparseConfiguration(); // config may have changed in the KControl module KConfigGroup cg( config, "General"); bool logoutConfirmed = (confirm == KWorkSpace::ShutdownConfirmYes) ? false : (confirm == KWorkSpace::ShutdownConfirmNo) ? true : !cg.readEntry( "confirmLogout", true ); bool choose = false; bool maysd = false; if (cg.readEntry( "offerShutdown", true ) && KDisplayManager().canShutdown()) maysd = true; if (!maysd) { if (sdtype != KWorkSpace::ShutdownTypeNone && sdtype != KWorkSpace::ShutdownTypeDefault && logoutConfirmed) return; /* unsupported fast shutdown */ sdtype = KWorkSpace::ShutdownTypeNone; } else if (sdtype == KWorkSpace::ShutdownTypeDefault) { sdtype = (KWorkSpace::ShutdownType) cg.readEntry( "shutdownType", (int)KWorkSpace::ShutdownTypeNone ); choose = true; } if (sdmode == KWorkSpace::ShutdownModeDefault) sdmode = KWorkSpace::ShutdownModeInteractive; qCDebug(KSMSERVER) << "After modifications confirm is " << confirm << " type is " << sdtype << " and mode " << sdmode; QString bopt; if ( !logoutConfirmed ) { int pipeFds[2]; if (pipe(pipeFds) != 0) { return; } QProcess *p = new QProcess(this); p->setProgram(QStringLiteral(LOGOUT_GREETER_BIN)); QStringList arguments; if (maysd) { arguments << QStringLiteral("--shutdown-allowed"); } if (choose) { arguments << QStringLiteral("--choose"); } if (sdtype != KWorkSpace::ShutdownTypeDefault) { arguments << QStringLiteral("--mode"); switch (sdtype) { case KWorkSpace::ShutdownTypeHalt: arguments << QStringLiteral("shutdown"); break; case KWorkSpace::ShutdownTypeReboot: arguments << QStringLiteral("reboot"); break; case KWorkSpace::ShutdownTypeNone: default: // logout arguments << QStringLiteral("logout"); break; } } arguments << QStringLiteral("--mode-fd"); arguments << QString::number(pipeFds[1]); p->setArguments(arguments); const int resultPipe = pipeFds[0]; connect(p, static_cast(&QProcess::error), this, [this, resultPipe, sdmode, sdtype] { close(resultPipe); dialogActive = false; auto fallbackPrompt = new QMessageBox; fallbackPrompt->setAttribute(Qt::WA_DeleteOnClose, true); fallbackPrompt->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); switch (sdtype) { case KWorkSpace::ShutdownTypeHalt: //i18nd is used as this patch was backported to an LTS with stable translations - fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shutdown")); + fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down")); break; case KWorkSpace::ShutdownTypeReboot: fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Reboot")); break; case KWorkSpace::ShutdownTypeNone: Q_FALLTHROUGH(); default: fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Logout")); break; } connect(fallbackPrompt, &QMessageBox::buttonClicked, this, [=](QAbstractButton *button) { if (button != fallbackPrompt->button(QMessageBox::Ok)) { return; } shutdownType = sdtype; shutdownMode = sdmode; bootOption = QString(); performLogout(); }); fallbackPrompt->show(); } ); connect(p, static_cast(&QProcess::finished), this, [this, resultPipe, sdmode, p] (int exitCode) { p->deleteLater(); dialogActive = false; if (exitCode != 0) { close(resultPipe); return; } QFutureWatcher *watcher = new QFutureWatcher(); QObject::connect(watcher, &QFutureWatcher::finished, this, [this, sdmode, watcher] { const bool result = watcher->result(); if (!result) { // it failed to read, don't logout return; } shutdownMode = sdmode; bootOption = QString(); performLogout(); }, Qt::QueuedConnection); QObject::connect(watcher, &QFutureWatcher::finished, watcher, &QFutureWatcher::deleteLater, Qt::QueuedConnection); watcher->setFuture(QtConcurrent::run(readFromPipe, resultPipe)); } ); dialogActive = true; p->start(); close(pipeFds[1]); } else { shutdownType = sdtype; shutdownMode = sdmode; bootOption = bopt; performLogout(); } } void KSMServer::performLogout() { // If the logout was confirmed, let's start a powermanagement inhibition. // We store the cookie so we can interrupt it if the logout will be canceled inhibitCookie = Solid::PowerManagement::beginSuppressingSleep(QStringLiteral("Shutting down system")); // shall we save the session on logout? KConfigGroup cg(KSharedConfig::openConfig(), "General"); saveSession = ( cg.readEntry( "loginMode", QStringLiteral( "restorePreviousLogout" ) ) == QStringLiteral( "restorePreviousLogout" ) ); qCDebug(KSMSERVER) << "saveSession is " << saveSession; if ( saveSession ) sessionGroup = QStringLiteral( "Session: " ) + QString::fromLocal8Bit( SESSION_PREVIOUS_LOGOUT ); // Set the real desktop background to black so that exit looks // clean regardless of what was on "our" desktop. QPalette palette; palette.setColor( QApplication::desktop()->backgroundRole(), Qt::black ); QApplication::setPalette(palette); state = Shutdown; wmPhase1WaitingCount = 0; saveType = saveSession?SmSaveBoth:SmSaveGlobal; #ifndef NO_LEGACY_SESSION_MANAGEMENT performLegacySessionSave(); #endif startProtection(); foreach( KSMClient* c, clients ) { c->resetState(); // Whoever came with the idea of phase 2 got it backwards // unfortunately. Window manager should be the very first // one saving session data, not the last one, as possible // user interaction during session save may alter // window positions etc. // Moreover, KWin's focus stealing prevention would lead // to undesired effects while session saving (dialogs // wouldn't be activated), so it needs be assured that // KWin will turn it off temporarily before any other // user interaction takes place. // Therefore, make sure the WM finishes its phase 1 // before others a chance to change anything. // KWin will check if the session manager is ksmserver, // and if yes it will save in phase 1 instead of phase 2. if( isWM( c ) ) ++wmPhase1WaitingCount; } if (wmPhase1WaitingCount > 0) { foreach( KSMClient* c, clients ) { if( isWM( c ) ) SmsSaveYourself( c->connection(), saveType, true, SmInteractStyleAny, false ); } } else { // no WM, simply start them all foreach( KSMClient* c, clients ) SmsSaveYourself( c->connection(), saveType, true, SmInteractStyleAny, false ); } qCDebug(KSMSERVER) << "clients should be empty, " << clients.isEmpty(); if ( clients.isEmpty() ) completeShutdownOrCheckpoint(); dialogActive = false; } void KSMServer::pendingShutdownTimeout() { shutdown( pendingShutdown_confirm, pendingShutdown_sdtype, pendingShutdown_sdmode ); } void KSMServer::saveCurrentSession() { if ( state != Idle || dialogActive ) return; if ( currentSession().isEmpty() || currentSession() == QString::fromLocal8Bit( SESSION_PREVIOUS_LOGOUT ) ) sessionGroup = QStringLiteral("Session: ") + QString::fromLocal8Bit( SESSION_BY_USER ); state = Checkpoint; wmPhase1WaitingCount = 0; saveType = SmSaveLocal; saveSession = true; #ifndef NO_LEGACY_SESSION_MANAGEMENT performLegacySessionSave(); #endif foreach( KSMClient* c, clients ) { c->resetState(); if( isWM( c ) ) ++wmPhase1WaitingCount; } if (wmPhase1WaitingCount > 0) { foreach( KSMClient* c, clients ) { if( isWM( c ) ) SmsSaveYourself( c->connection(), saveType, false, SmInteractStyleNone, false ); } } else { foreach( KSMClient* c, clients ) SmsSaveYourself( c->connection(), saveType, false, SmInteractStyleNone, false ); } if ( clients.isEmpty() ) completeShutdownOrCheckpoint(); } void KSMServer::saveCurrentSessionAs( const QString &session ) { if ( state != Idle || dialogActive ) return; sessionGroup = QStringLiteral( "Session: " ) + session; saveCurrentSession(); } // callbacks void KSMServer::saveYourselfDone( KSMClient* client, bool success ) { if ( state == Idle ) { // State saving when it's not shutdown or checkpoint. Probably // a shutdown was canceled and the client is finished saving // only now. Discard the saved state in order to avoid // the saved data building up. QStringList discard = client->discardCommand(); if( !discard.isEmpty()) executeCommand( discard ); return; } if ( success ) { client->saveYourselfDone = true; completeShutdownOrCheckpoint(); } else { // fake success to make KDE's logout not block with broken // apps. A perfect ksmserver would display a warning box at // the very end. client->saveYourselfDone = true; completeShutdownOrCheckpoint(); } startProtection(); if( isWM( client ) && !client->wasPhase2 && wmPhase1WaitingCount > 0 ) { --wmPhase1WaitingCount; // WM finished its phase1, save the rest if( wmPhase1WaitingCount == 0 ) { foreach( KSMClient* c, clients ) if( !isWM( c )) SmsSaveYourself( c->connection(), saveType, saveType != SmSaveLocal, saveType != SmSaveLocal ? SmInteractStyleAny : SmInteractStyleNone, false ); } } } void KSMServer::interactRequest( KSMClient* client, int /*dialogType*/ ) { if ( state == Shutdown || state == ClosingSubSession ) client->pendingInteraction = true; else SmsInteract( client->connection() ); handlePendingInteractions(); } void KSMServer::interactDone( KSMClient* client, bool cancelShutdown_ ) { if ( client != clientInteracting ) return; // should not happen clientInteracting = nullptr; if ( cancelShutdown_ ) cancelShutdown( client ); else handlePendingInteractions(); } void KSMServer::phase2Request( KSMClient* client ) { client->waitForPhase2 = true; client->wasPhase2 = true; completeShutdownOrCheckpoint(); if( isWM( client ) && wmPhase1WaitingCount > 0 ) { --wmPhase1WaitingCount; // WM finished its phase1 and requests phase2, save the rest if( wmPhase1WaitingCount == 0 ) { foreach( KSMClient* c, clients ) if( !isWM( c )) SmsSaveYourself( c->connection(), saveType, saveType != SmSaveLocal, saveType != SmSaveLocal ? SmInteractStyleAny : SmInteractStyleNone, false ); } } } void KSMServer::handlePendingInteractions() { if ( clientInteracting ) return; foreach( KSMClient* c, clients ) { if ( c->pendingInteraction ) { clientInteracting = c; c->pendingInteraction = false; break; } } if ( clientInteracting ) { endProtection(); SmsInteract( clientInteracting->connection() ); } else { startProtection(); } } void KSMServer::cancelShutdown( KSMClient* c ) { clientInteracting = nullptr; qCDebug(KSMSERVER) << state; if ( state == ClosingSubSession ) { clientsToKill.clear(); clientsToSave.clear(); emit subSessionCloseCanceled(); } else { Solid::PowerManagement::stopSuppressingSleep(inhibitCookie); qCDebug(KSMSERVER) << "Client " << c->program() << " (" << c->clientId() << ") canceled shutdown."; KNotification::event( QStringLiteral( "cancellogout" ), i18n( "Logout canceled by '%1'", c->program()), QPixmap() , nullptr , KNotification::DefaultEvent ); foreach( KSMClient* c, clients ) { SmsShutdownCancelled( c->connection() ); if( c->saveYourselfDone ) { // Discard also saved state. QStringList discard = c->discardCommand(); if( !discard.isEmpty()) executeCommand( discard ); } } } state = Idle; } void KSMServer::startProtection() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); config->reparseConfiguration(); // config may have changed in the KControl module KConfigGroup cg( config, "General" ); int timeout = cg.readEntry( "clientShutdownTimeoutSecs", 15 ) * 1000; protectionTimer.setSingleShot( true ); protectionTimer.start( timeout ); } void KSMServer::endProtection() { protectionTimer.stop(); } /* Internal protection slot, invoked when clients do not react during shutdown. */ void KSMServer::protectionTimeout() { if ( ( state != Shutdown && state != Checkpoint && state != ClosingSubSession ) || clientInteracting ) return; foreach( KSMClient* c, clients ) { if ( !c->saveYourselfDone && !c->waitForPhase2 ) { qCDebug(KSMSERVER) << "protectionTimeout: client " << c->program() << "(" << c->clientId() << ")"; c->saveYourselfDone = true; } } completeShutdownOrCheckpoint(); startProtection(); } void KSMServer::completeShutdownOrCheckpoint() { qCDebug(KSMSERVER) << "completeShutdownOrCheckpoint called"; if ( state != Shutdown && state != Checkpoint && state != ClosingSubSession ) return; QList pendingClients; if (state == ClosingSubSession) pendingClients = clientsToSave; else pendingClients = clients; foreach( KSMClient* c, pendingClients ) { if ( !c->saveYourselfDone && !c->waitForPhase2 ) return; // not done yet } // do phase 2 bool waitForPhase2 = false; foreach( KSMClient* c, pendingClients ) { if ( !c->saveYourselfDone && c->waitForPhase2 ) { c->waitForPhase2 = false; SmsSaveYourselfPhase2( c->connection() ); waitForPhase2 = true; } } if ( waitForPhase2 ) return; if ( saveSession ) storeSession(); else discardSession(); qCDebug(KSMSERVER) << "state is " << state; if ( state == Shutdown ) { KNotification *n = KNotification::event(QStringLiteral("exitkde"), QString(), QPixmap(), nullptr, KNotification::DefaultEvent); // Plasma says good bye connect(n, &KNotification::closed, this, &KSMServer::startKilling); state = WaitingForKNotify; // https://bugs.kde.org/show_bug.cgi?id=228005 // if sound is not working for some reason (e.g. no phonon // backends are installed) the closed() signal never happens // and logoutSoundFinished() never gets called. Add this timer to make // sure the shutdown procedure continues even if sound system is broken. QTimer::singleShot(5000, this, [=]{ if (state == WaitingForKNotify) { n->deleteLater(); startKilling(); } }); createLogoutEffectWidget(); } else if ( state == Checkpoint ) { foreach( KSMClient* c, clients ) { SmsSaveComplete( c->connection()); } state = Idle; } else { //ClosingSubSession startKillingSubSession(); } } void KSMServer::startKilling() { qCDebug(KSMSERVER) << "Starting killing clients"; if (state == Killing) { // we are already killing return; } // kill all clients state = Killing; foreach( KSMClient* c, clients ) { if( isWM( c )) // kill the WM as the last one in order to reduce flicker continue; qCDebug(KSMSERVER) << "startKilling: client " << c->program() << "(" << c->clientId() << ")"; SmsDie( c->connection() ); } qCDebug(KSMSERVER) << " We killed all clients. We have now clients.count()=" << clients.count() << endl; completeKilling(); QTimer::singleShot( 10000, this, &KSMServer::timeoutQuit ); } void KSMServer::completeKilling() { qCDebug(KSMSERVER) << "KSMServer::completeKilling clients.count()=" << clients.count() << endl; if( state == Killing ) { bool wait = false; foreach( KSMClient* c, clients ) { if( isWM( c )) continue; wait = true; // still waiting for clients to go away } if( wait ) return; killWM(); } } void KSMServer::killWM() { if( state != Killing ) return; delete logoutEffectWidget; qCDebug(KSMSERVER) << "Starting killing WM"; state = KillingWM; bool iswm = false; foreach( KSMClient* c, clients ) { if( isWM( c )) { iswm = true; qCDebug(KSMSERVER) << "killWM: client " << c->program() << "(" << c->clientId() << ")"; SmsDie( c->connection() ); } } if( iswm ) { completeKillingWM(); QTimer::singleShot( 5000, this, &KSMServer::timeoutWMQuit ); } else killingCompleted(); } void KSMServer::completeKillingWM() { qCDebug(KSMSERVER) << "KSMServer::completeKillingWM clients.count()=" << clients.count() << endl; if( state == KillingWM ) { if( clients.isEmpty()) killingCompleted(); } } // shutdown is fully complete void KSMServer::killingCompleted() { qApp->quit(); } void KSMServer::timeoutQuit() { foreach( KSMClient* c, clients ) { qCWarning(KSMSERVER) << "SmsDie timeout, client " << c->program() << "(" << c->clientId() << ")" ; } killWM(); } void KSMServer::timeoutWMQuit() { if( state == KillingWM ) { qCWarning(KSMSERVER) << "SmsDie WM timeout" ; } killingCompleted(); } void KSMServer::createLogoutEffectWidget() { // Ok, this is rather a hack. In order to fade the whole desktop when playing the logout // sound, killing applications and leaving KDE, create a dummy window that triggers // the logout fade effect again. logoutEffectWidget = new QWidget( nullptr, Qt::X11BypassWindowManagerHint ); logoutEffectWidget->winId(); // workaround for Qt4.3 setWindowRole() assert logoutEffectWidget->setWindowRole( QStringLiteral( "logouteffect" ) ); // Qt doesn't set this on unmanaged windows //FIXME: or does it? XChangeProperty( QX11Info::display(), logoutEffectWidget->winId(), XInternAtom( QX11Info::display(), "WM_WINDOW_ROLE", False ), XA_STRING, 8, PropModeReplace, (unsigned char *)"logouteffect", strlen( "logouteffect" )); logoutEffectWidget->setGeometry( -100, -100, 1, 1 ); logoutEffectWidget->show(); } void KSMServer::saveSubSession(const QString &name, QStringList saveAndClose, QStringList saveOnly) { if( state != Idle ) { // performing startup qCDebug(KSMSERVER) << "not idle!" << state; return; } qCDebug(KSMSERVER) << name << saveAndClose << saveOnly; state = ClosingSubSession; saveType = SmSaveBoth; //both or local? what oes it mean? saveSession = true; sessionGroup = QStringLiteral( "SubSession: " ) + name; #ifndef NO_LEGACY_SESSION_MANAGEMENT //performLegacySessionSave(); FIXME #endif startProtection(); foreach( KSMClient* c, clients ) { if (saveAndClose.contains(QString::fromLocal8Bit(c->clientId()))) { c->resetState(); SmsSaveYourself( c->connection(), saveType, true, SmInteractStyleAny, false ); clientsToSave << c; clientsToKill << c; } else if (saveOnly.contains(QString::fromLocal8Bit(c->clientId()))) { c->resetState(); SmsSaveYourself( c->connection(), saveType, true, SmInteractStyleAny, false ); clientsToSave << c; } } completeShutdownOrCheckpoint(); } void KSMServer::startKillingSubSession() { qCDebug(KSMSERVER) << "Starting killing clients"; // kill all clients state = KillingSubSession; foreach( KSMClient* c, clientsToKill ) { qCDebug(KSMSERVER) << "completeShutdown: client " << c->program() << "(" << c->clientId() << ")"; SmsDie( c->connection() ); } qCDebug(KSMSERVER) << " We killed some clients. We have now clients.count()=" << clients.count() << endl; completeKillingSubSession(); QTimer::singleShot( 10000, this, &KSMServer::signalSubSessionClosed ); } void KSMServer::completeKillingSubSession() { qCDebug(KSMSERVER) << "KSMServer::completeKillingSubSession clients.count()=" << clients.count() << endl; if( state == KillingSubSession ) { bool wait = false; foreach( KSMClient* c, clientsToKill ) { if( isWM( c )) continue; wait = true; // still waiting for clients to go away } if( wait ) return; signalSubSessionClosed(); } } void KSMServer::signalSubSessionClosed() { if( state != KillingSubSession ) return; clientsToKill.clear(); clientsToSave.clear(); //TODO tell the subSession manager the close request was carried out //so that plasma can close its stuff state = Idle; qCDebug(KSMSERVER) << state; emit subSessionClosed(); } diff --git a/lookandfeel/contents/logout/Logout.qml b/lookandfeel/contents/logout/Logout.qml index d32006d09..f26b15645 100644 --- a/lookandfeel/contents/logout/Logout.qml +++ b/lookandfeel/contents/logout/Logout.qml @@ -1,245 +1,245 @@ /*************************************************************************** * Copyright (C) 2014 by Aleix Pol Gonzalez * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.2 import QtQuick.Layouts 1.2 import QtQuick.Controls 1.1 as Controls import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kcoreaddons 1.0 as KCoreAddons import "../components" import "timer.js" as AutoTriggerTimer import org.kde.plasma.private.sessions 2.0 PlasmaCore.ColorScope { id: root colorGroup: PlasmaCore.Theme.ComplementaryColorGroup height: screenGeometry.height width: screenGeometry.width signal logoutRequested() signal haltRequested() signal suspendRequested(int spdMethod) signal rebootRequested() signal rebootRequested2(int opt) signal cancelRequested() signal lockScreenRequested() property alias backgroundColor: backgroundRect.color function sleepRequested() { root.suspendRequested(2); } function hibernateRequested() { root.suspendRequested(4); } property real timeout: 30 property real remainingTime: root.timeout property var currentAction: { switch (sdtype) { case ShutdownType.ShutdownTypeReboot: return root.rebootRequested; case ShutdownType.ShutdownTypeHalt: return root.haltRequested; default: return root.logoutRequested; } } KCoreAddons.KUser { id: kuser } // For showing a "other users are logged in" hint SessionsModel { id: sessionsModel includeUnusedSessions: false } Controls.Action { onTriggered: root.cancelRequested() shortcut: "Escape" } onRemainingTimeChanged: { if (remainingTime <= 0) { root.currentAction(); } } Timer { id: countDownTimer running: true repeat: true interval: 1000 onTriggered: remainingTime-- Component.onCompleted: { AutoTriggerTimer.addCancelAutoTriggerCallback(function() { countDownTimer.running = false; }); } } function isLightColor(color) { return Math.max(color.r, color.g, color.b) > 0.5 } Rectangle { id: backgroundRect anchors.fill: parent //use "black" because this is intended to look like a general darkening of the scene. a dark gray as normal background would just look too "washed out" color: root.isLightColor(PlasmaCore.ColorScope.backgroundColor) ? PlasmaCore.ColorScope.backgroundColor : "black" opacity: 0.5 } MouseArea { anchors.fill: parent onClicked: root.cancelRequested() } UserDelegate { width: units.iconSizes.enormous height: width anchors { horizontalCenter: parent.horizontalCenter bottom: parent.verticalCenter } constrainText: false avatarPath: kuser.faceIconUrl iconSource: "user-identity" isCurrent: true name: kuser.fullName } ColumnLayout { anchors { top: parent.verticalCenter topMargin: units.gridUnit * 2 horizontalCenter: parent.horizontalCenter } spacing: units.largeSpacing height: Math.max(implicitHeight, units.gridUnit * 10) width: Math.max(implicitWidth, units.gridUnit * 16) PlasmaComponents.Label { Layout.maximumWidth: units.gridUnit * 16 Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap font.italic: true text: i18ndp("plasma_lookandfeel_org.kde.lookandfeel", "One other user is currently logged in. If the computer is shut down or rebooted, that user may lose work.", "%1 other users are currently logged in. If the computer is shut down or rebooted, those users may lose work.", sessionsModel.count) visible: sessionsModel.count > 1 } RowLayout { spacing: units.largeSpacing * 2 Layout.alignment: Qt.AlignHCenter LogoutButton { id: suspendButton iconSource: "system-suspend" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Suspend") action: root.sleepRequested KeyNavigation.left: logoutButton KeyNavigation.right: hibernateButton visible: spdMethods.SuspendState } LogoutButton { id: hibernateButton iconSource: "system-suspend-hibernate" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Hibernate") action: root.hibernateRequested KeyNavigation.left: suspendButton KeyNavigation.right: rebootButton visible: spdMethods.HibernateState } LogoutButton { id: rebootButton iconSource: "system-reboot" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Reboot") action: root.rebootRequested KeyNavigation.left: hibernateButton KeyNavigation.right: shutdownButton focus: sdtype == ShutdownType.ShutdownTypeReboot visible: maysd } LogoutButton { id: shutdownButton iconSource: "system-shutdown" - text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shutdown") + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shut Down") action: root.haltRequested KeyNavigation.left: rebootButton KeyNavigation.right: logoutButton focus: sdtype == ShutdownType.ShutdownTypeHalt visible: maysd } LogoutButton { id: logoutButton iconSource: "system-log-out" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Logout") action: root.logoutRequested KeyNavigation.left: shutdownButton KeyNavigation.right: suspendButton focus: sdtype == ShutdownType.ShutdownTypeNone visible: canLogout } } PlasmaComponents.Label { Layout.alignment: Qt.AlignHCenter //opacity, as visible would re-layout opacity: countDownTimer.running ? 1 : 0 Behavior on opacity { OpacityAnimator { duration: units.longDuration easing.type: Easing.InOutQuad } } text: { switch (sdtype) { case ShutdownType.ShutdownTypeReboot: return i18ndp("plasma_lookandfeel_org.kde.lookandfeel", "Reboot in 1 second", "Reboot in %1 seconds", root.remainingTime); case ShutdownType.ShutdownTypeHalt: return i18ndp("plasma_lookandfeel_org.kde.lookandfeel", "Shutting down in 1 second", "Shutting down in %1 seconds", root.remainingTime); default: return i18ndp("plasma_lookandfeel_org.kde.lookandfeel", "Logging out in 1 second", "Logging out in %1 seconds", root.remainingTime); } } } RowLayout { Layout.alignment: Qt.AlignHCenter PlasmaComponents.Button { enabled: root.currentAction != null text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "OK") onClicked: root.currentAction() } PlasmaComponents.Button { text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel") onClicked: root.cancelRequested() } } } } diff --git a/runners/sessions/sessionrunner.cpp b/runners/sessions/sessionrunner.cpp index 6013c2903..f82a7b655 100644 --- a/runners/sessions/sessionrunner.cpp +++ b/runners/sessions/sessionrunner.cpp @@ -1,279 +1,280 @@ /* * Copyright (C) 2006 Aaron Seigo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License version 2 as * published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sessionrunner.h" #include #include #include #include #include "kworkspace.h" #include "screensaver_interface.h" K_EXPORT_PLASMA_RUNNER(calculatorrunner, SessionRunner) SessionRunner::SessionRunner(QObject *parent, const QVariantList &args) : Plasma::AbstractRunner(parent, args) { setObjectName( QLatin1String("Sessions" )); setPriority(LowPriority); setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::NetworkLocation); m_canLogout = KAuthorized::authorizeAction(QStringLiteral("logout")) && KAuthorized::authorize(QStringLiteral("logout")); if (m_canLogout) { addSyntax(Plasma::RunnerSyntax(i18nc("log out command", "logout"), i18n("Logs out, exiting the current desktop session"))); - addSyntax(Plasma::RunnerSyntax(i18nc("shutdown computer command", "shutdown"), + addSyntax(Plasma::RunnerSyntax(i18nc("shut down computer command", "shut down"), i18n("Turns off the computer"))); } if (KAuthorized::authorizeAction(QStringLiteral("lock_screen")) && m_canLogout) { addSyntax(Plasma::RunnerSyntax(i18nc("lock screen command", "lock"), i18n("Locks the current sessions and starts the screen saver"))); } Plasma::RunnerSyntax rebootSyntax(i18nc("restart computer command", "restart"), i18n("Reboots the computer")); rebootSyntax.addExampleQuery(i18nc("restart computer command", "reboot")); addSyntax(rebootSyntax); m_triggerWord = i18nc("switch user command", "switch"); addSyntax(Plasma::RunnerSyntax(i18nc("switch user command", "switch :q:"), i18n("Switches to the active session for the user :q:, " "or lists all active sessions if :q: is not provided"))); Plasma::RunnerSyntax fastUserSwitchSyntax(i18n("switch user"), i18n("Starts a new session as a different user")); fastUserSwitchSyntax.addExampleQuery(i18n("new session")); addSyntax(fastUserSwitchSyntax); //"SESSIONS" should not be translated; it's used programmaticaly setDefaultSyntax(Plasma::RunnerSyntax(QStringLiteral("SESSIONS"), i18n("Lists all sessions"))); } SessionRunner::~SessionRunner() { } void SessionRunner::matchCommands(QList &matches, const QString& term) { if (!m_canLogout) { return; } if (term.compare(i18nc("log out command","logout"), Qt::CaseInsensitive) == 0 || term.compare(i18n("log out"), Qt::CaseInsensitive) == 0) { Plasma::QueryMatch match(this); match.setText(i18nc("log out command","Logout")); match.setIconName(QStringLiteral("system-log-out")); match.setData(LogoutAction); match.setType(Plasma::QueryMatch::ExactMatch); match.setRelevance(0.9); matches << match; } else if (term.compare(i18nc("restart computer command", "restart"), Qt::CaseInsensitive) == 0 || term.compare(i18nc("restart computer command", "reboot"), Qt::CaseInsensitive) == 0) { Plasma::QueryMatch match(this); match.setText(i18n("Restart the computer")); match.setIconName(QStringLiteral("system-reboot")); match.setData(RestartAction); match.setType(Plasma::QueryMatch::ExactMatch); match.setRelevance(0.9); matches << match; - } else if (term.compare(i18nc("shutdown computer command","shutdown"), Qt::CaseInsensitive) == 0) { + } else if (term.compare(i18nc("shut down computer command","shut down"), Qt::CaseInsensitive) == 0 || + term.compare(i18nc("shut down computer command", "shutdown"), Qt::CaseInsensitive) == 0) { Plasma::QueryMatch match(this); - match.setText(i18n("Shutdown the computer")); + match.setText(i18n("Shut down the computer")); match.setIconName(QStringLiteral("system-shutdown")); match.setData(ShutdownAction); match.setType(Plasma::QueryMatch::ExactMatch); match.setRelevance(0.9); matches << match; } else if (term.compare(i18nc("lock screen command","lock"), Qt::CaseInsensitive) == 0) { if (KAuthorized::authorizeAction(QStringLiteral("lock_screen"))) { Plasma::QueryMatch match(this); match.setText(i18n("Lock the screen")); match.setIconName(QStringLiteral("system-lock-screen")); match.setData(LockAction); match.setType(Plasma::QueryMatch::ExactMatch); match.setRelevance(0.9); matches << match; } } } void SessionRunner::match(Plasma::RunnerContext &context) { const QString term = context.query(); QString user; bool matchUser = false; QList matches; if (term.size() < 3) { return; } // first compare with SESSIONS. this must *NOT* be translated (i18n) // as it is used as an internal command trigger (e.g. via d-bus), // not as a user supplied query. and yes, "Ugh, magic strings" bool listAll = term.compare(QLatin1String("SESSIONS"), Qt::CaseInsensitive) == 0 || term.compare(i18nc("User sessions", "sessions"), Qt::CaseInsensitive) == 0; if (!listAll) { //no luck, try the "switch" user command if (term.startsWith(m_triggerWord, Qt::CaseInsensitive)) { user = term.right(term.size() - m_triggerWord.length()).trimmed(); listAll = user.isEmpty(); matchUser = !listAll; } else { // we know it's not SESSION or "switch ", so let's // try some other possibilities matchCommands(matches, term); } } bool switchUser = listAll || term.compare(i18n("switch user"), Qt::CaseInsensitive) == 0 || term.compare(i18n("new session"), Qt::CaseInsensitive) == 0; if (switchUser && KAuthorized::authorizeAction(QStringLiteral("start_new_session")) && dm.isSwitchable() && dm.numReserve() >= 0) { Plasma::QueryMatch match(this); match.setType(Plasma::QueryMatch::ExactMatch); match.setIconName(QStringLiteral("system-switch-user")); match.setText(i18n("New Session")); matches << match; } // now add the active sessions if (listAll || matchUser) { SessList sessions; dm.localSessions(sessions); foreach (const SessEnt& session, sessions) { if (!session.vt || session.self) { continue; } QString name = KDisplayManager::sess2Str(session); Plasma::QueryMatch::Type type = Plasma::QueryMatch::NoMatch; qreal relevance = 0.7; if (listAll) { type = Plasma::QueryMatch::ExactMatch; relevance = 1; } else if (matchUser) { if (name.compare(user, Qt::CaseInsensitive) == 0) { // we need an elif branch here because we don't // want the last conditional to be checked if !listAll type = Plasma::QueryMatch::ExactMatch; relevance = 1; } else if (name.contains(user, Qt::CaseInsensitive)) { type = Plasma::QueryMatch::PossibleMatch; } } if (type != Plasma::QueryMatch::NoMatch) { Plasma::QueryMatch match(this); match.setType(type); match.setRelevance(relevance); match.setIconName(QStringLiteral("user-identity")); match.setText(name); match.setData(QString::number(session.vt)); matches << match; } } } context.addMatches(matches); } void SessionRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match) { Q_UNUSED(context); if (match.data().type() == QVariant::Int) { KWorkSpace::ShutdownType type = KWorkSpace::ShutdownTypeDefault; switch (match.data().toInt()) { case LogoutAction: type = KWorkSpace::ShutdownTypeNone; break; case RestartAction: type = KWorkSpace::ShutdownTypeReboot; break; case ShutdownAction: type = KWorkSpace::ShutdownTypeHalt; break; case LockAction: lock(); return; break; } if (type != KWorkSpace::ShutdownTypeDefault) { KWorkSpace::ShutdownConfirm confirm = KWorkSpace::ShutdownConfirmDefault; KWorkSpace::requestShutDown(confirm, type); return; } } if (!match.data().toString().isEmpty()) { dm.lockSwitchVT(match.data().toString().toInt()); return; } //TODO: this message is too verbose and too technical. int result = QMessageBox::warning( nullptr, i18n("Warning - New Session"), i18n("

You have chosen to open another desktop session.
" "The current session will be hidden " "and a new login screen will be displayed.
" "An F-key is assigned to each session; " "F%1 is usually assigned to the first session, " "F%2 to the second session and so on. " "You can switch between sessions by pressing " "Ctrl, Alt and the appropriate F-key at the same time. " "Additionally, the KDE Panel and Desktop menus have " "actions for switching between sessions.

", 7, 8)); if (result == QMessageBox::Cancel) { return; } lock(); dm.startReserve(); } void SessionRunner::lock() { QString interface(QStringLiteral("org.freedesktop.ScreenSaver")); org::freedesktop::ScreenSaver screensaver(interface, QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus()); if (screensaver.isValid()) { screensaver.Lock(); } } #include "sessionrunner.moc" diff --git a/sddm-theme/Main.qml b/sddm-theme/Main.qml index 3ef30117d..293e1a022 100644 --- a/sddm-theme/Main.qml +++ b/sddm-theme/Main.qml @@ -1,433 +1,433 @@ /* * Copyright 2016 David Edmundson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.1 import QtGraphicalEffects 1.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import "components" PlasmaCore.ColorScope { id: root colorGroup: PlasmaCore.Theme.ComplementaryColorGroup width: 1600 height: 900 property string notificationMessage LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true PlasmaCore.DataSource { id: keystateSource engine: "keystate" connectedSources: "Caps Lock" } Item { id: wallpaper anchors.fill: parent Repeater { model: screenModel Background { x: geometry.x; y: geometry.y; width: geometry.width; height: geometry.height sceneBackgroundType: config.type sceneBackgroundColor: config.color sceneBackgroundImage: config.background } } } MouseArea { id: loginScreenRoot anchors.fill: parent property bool uiVisible: true property bool blockUI: mainStack.depth > 1 || userListComponent.mainPasswordBox.text.length > 0 || inputPanel.keyboardActive || config.type != "image" hoverEnabled: true drag.filterChildren: true onPressed: uiVisible = true; onPositionChanged: uiVisible = true; onUiVisibleChanged: { if (blockUI) { fadeoutTimer.running = false; } else if (uiVisible) { fadeoutTimer.restart(); } } onBlockUIChanged: { if (blockUI) { fadeoutTimer.running = false; uiVisible = true; } else { fadeoutTimer.restart(); } } //takes one full minute for the ui to disappear Timer { id: fadeoutTimer running: true interval: 60000 onTriggered: { if (!loginScreenRoot.blockUI) { loginScreenRoot.uiVisible = false; } } } WallpaperFader { visible: config.type == "image" anchors.fill: parent state: loginScreenRoot.uiVisible ? "on" : "off" source: wallpaper mainStack: mainStack footer: footer clock: clock } DropShadow { id: clockShadow anchors.fill: clock source: clock horizontalOffset: 0 verticalOffset: 1 radius: 12 samples: 32 spread: 0.2 color: Qt.rgba(0, 0, 0, 1) Behavior on opacity { OpacityAnimator { duration: 1000 easing.type: Easing.InOutQuad } } } Clock { id: clock visible: y > 0 property Item shadow: clockShadow y: (userListComponent.userList.y + mainStack.y)/2 - height/2 anchors.horizontalCenter: parent.horizontalCenter } StackView { id: mainStack anchors { left: parent.left right: parent.right } height: root.height focus: true //StackView is an implicit focus scope, so we need to give this focus so the item inside will have it Timer { //SDDM has a bug in 0.13 where even though we set the focus on the right item within the window, the window doesn't have focus //it is fixed in 6d5b36b28907b16280ff78995fef764bb0c573db which will be 0.14 //we need to call "window->activate()" *After* it's been shown. We can't control that in QML so we use a shoddy timer //it's been this way for all Plasma 5.x without a huge problem running: true repeat: false interval: 200 onTriggered: mainStack.forceActiveFocus() } initialItem: Login { id: userListComponent userListModel: userModel userListCurrentIndex: userModel.lastIndex >= 0 ? userModel.lastIndex : 0 lastUserName: userModel.lastUser showUserList: { if ( !userListModel.hasOwnProperty("count") || !userListModel.hasOwnProperty("disableAvatarsThreshold")) return (userList.y + mainStack.y) > 0 if ( userListModel.count == 0 ) return false return userListModel.count <= userListModel.disableAvatarsThreshold && (userList.y + mainStack.y) > 0 } notificationMessage: { var text = "" if (keystateSource.data["Caps Lock"]["Locked"]) { text += i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on") if (root.notificationMessage) { text += " • " } } text += root.notificationMessage return text } actionItems: [ ActionButton { iconSource: "system-suspend" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Suspend") onClicked: sddm.suspend() enabled: sddm.canSuspend visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-reboot" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Restart") onClicked: sddm.reboot() enabled: sddm.canReboot visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-shutdown" - text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shutdown") + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Shut Down") onClicked: sddm.powerOff() enabled: sddm.canPowerOff visible: !inputPanel.keyboardActive }, ActionButton { iconSource: "system-switch-user" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Different User") onClicked: mainStack.push(userPromptComponent) enabled: true visible: !userListComponent.showUsernamePrompt && !inputPanel.keyboardActive }] onLoginRequest: { root.notificationMessage = "" sddm.login(username, password, sessionButton.currentIndex) } } Behavior on opacity { OpacityAnimator { duration: units.longDuration } } } Loader { id: inputPanel state: "hidden" property bool keyboardActive: item ? item.active : false onKeyboardActiveChanged: { if (keyboardActive) { state = "visible" } else { state = "hidden"; } } source: "components/VirtualKeyboard.qml" anchors { left: parent.left right: parent.right } function showHide() { state = state == "hidden" ? "visible" : "hidden"; } states: [ State { name: "visible" PropertyChanges { target: mainStack y: Math.min(0, root.height - inputPanel.height - userListComponent.visibleBoundary) } PropertyChanges { target: inputPanel y: root.height - inputPanel.height opacity: 1 } }, State { name: "hidden" PropertyChanges { target: mainStack y: 0 } PropertyChanges { target: inputPanel y: root.height - root.height/4 opacity: 0 } } ] transitions: [ Transition { from: "hidden" to: "visible" SequentialAnimation { ScriptAction { script: { inputPanel.item.activated = true; Qt.inputMethod.show(); } } ParallelAnimation { NumberAnimation { target: mainStack property: "y" duration: units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: inputPanel property: "y" duration: units.longDuration easing.type: Easing.OutQuad } OpacityAnimator { target: inputPanel duration: units.longDuration easing.type: Easing.OutQuad } } } }, Transition { from: "visible" to: "hidden" SequentialAnimation { ParallelAnimation { NumberAnimation { target: mainStack property: "y" duration: units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: inputPanel property: "y" duration: units.longDuration easing.type: Easing.InQuad } OpacityAnimator { target: inputPanel duration: units.longDuration easing.type: Easing.InQuad } } ScriptAction { script: { Qt.inputMethod.hide(); } } } } ] } Component { id: userPromptComponent Login { showUsernamePrompt: true notificationMessage: root.notificationMessage userListModel: QtObject { property string name: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Login as different user") property string iconSource: "" } onLoginRequest: { root.notificationMessage = "" sddm.login(username, password, sessionButton.currentIndex) } actionItems: [ ActionButton { iconSource: "go-previous" text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Back") onClicked: mainStack.pop() } ] } } //Footer RowLayout { id: footer anchors { bottom: parent.bottom left: parent.left right: parent.right margins: units.smallSpacing } Behavior on opacity { OpacityAnimator { duration: units.longDuration } } PlasmaComponents.ToolButton { text: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to show/hide virtual keyboard", "Virtual Keyboard") iconName: inputPanel.keyboardActive ? "input-keyboard-virtual-on" : "input-keyboard-virtual-off" onClicked: inputPanel.showHide() visible: inputPanel.status == Loader.Ready } KeyboardButton { } SessionButton { id: sessionButton } Item { Layout.fillWidth: true } Battery { } } } Connections { target: sddm onLoginFailed: { notificationMessage = i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Login Failed") } onLoginSucceeded: { //note SDDM will kill the greeter at some random point after this //there is no certainty any transition will finish, it depends on the time it //takes to complete the init mainStack.opacity = 0 footer.opacity = 0 } } onNotificationMessageChanged: { if (notificationMessage) { notificationResetTimer.start(); } } Timer { id: notificationResetTimer interval: 3000 onTriggered: notificationMessage = "" } }