...
 
Commits (2)
......@@ -184,11 +184,17 @@ void DeviceState::connectUserManager()
{
Q_D(DeviceState);
QDBusConnection::systemBus().connect(SAILFISH_USERMANAGER_DBUS_INTERFACE,
SAILFISH_USERMANAGER_DBUS_OBJECT_PATH,
SAILFISH_USERMANAGER_DBUS_INTERFACE,
"aboutToChangeCurrentUser",
d,
SLOT(emitUserSwitching(uint)));
SAILFISH_USERMANAGER_DBUS_OBJECT_PATH,
SAILFISH_USERMANAGER_DBUS_INTERFACE,
"aboutToChangeCurrentUser",
d,
SLOT(emitUserSwitching(uint)));
QDBusConnection::systemBus().connect(SAILFISH_USERMANAGER_DBUS_INTERFACE,
SAILFISH_USERMANAGER_DBUS_OBJECT_PATH,
SAILFISH_USERMANAGER_DBUS_INTERFACE,
"currentUserChangeFailed",
d,
SLOT(emitUserSwitchingFailed(uint)));
}
void DeviceState::disconnectUserManager()
......@@ -199,7 +205,13 @@ void DeviceState::disconnectUserManager()
SAILFISH_USERMANAGER_DBUS_INTERFACE,
"aboutToChangeCurrentUser",
d,
SLOT(emitUserChanging(uint)));
SLOT(emitUserSwitching(uint)));
QDBusConnection::systemBus().disconnect(SAILFISH_USERMANAGER_DBUS_INTERFACE,
SAILFISH_USERMANAGER_DBUS_OBJECT_PATH,
SAILFISH_USERMANAGER_DBUS_INTERFACE,
"currentUserChangeFailed",
d,
SLOT(emitUserSwitchingFailed(uint)));
}
} // DeviceState namespace
......@@ -67,7 +67,8 @@ public:
RebootDeniedUSB, //!< Reboot denied because USB is connected in mass storage mode
ShutdownDeniedUSB, //!< Shutdown denied because USB is connected in mass storage mode
Reboot, //!< Reboot
UserSwitching //!< User switching
UserSwitching, //!< User switching
UserSwitchingFailed //!< User switching failed
};
public:
......
......@@ -107,6 +107,11 @@ namespace DeviceState
emit nextUserChanged(uid);
emit systemStateChanged(DeviceState::UserSwitching);
}
void emitUserSwitchingFailed(uint uid) {
Q_UNUSED(uid)
emit systemStateChanged(DeviceState::UserSwitchingFailed);
}
};
}
#endif // DEVICESTATE_P_H
......@@ -56,6 +56,7 @@ void ShutdownScreen::setWindowVisible(bool visible)
}
if (!m_window->isVisible()) {
m_window->setContextProperty("shutdownMode", m_shutdownMode);
m_window->show();
emit windowVisibleChanged();
}
......@@ -107,6 +108,17 @@ void ShutdownScreen::applySystemState(DeviceState::DeviceState::StateIndication
applySystemState(DeviceState::DeviceState::Shutdown);
break;
case DeviceState::DeviceState::UserSwitchingFailed:
m_shutdownMode = "userswitchFailed";
m_window->setContextProperty("shutdownMode", m_shutdownMode);
emit userSwitchFailed();
QTimer::singleShot(10000, this, [this] {
// Allow for some time for the notification to be visible
setWindowVisible(false);
m_shutdownMode.clear();
});
break;
default:
break;
}
......
......@@ -55,6 +55,8 @@ public:
signals:
//! Sent when the visibility of the window has changed.
void windowVisibleChanged();
//! Sent when user change has failed.
void userSwitchFailed();
private slots:
/*!
......