[Lock Screen] Show "Switch User" button only if allowed
ClosedPublic

Authored by broulik on Nov 2 2016, 4:19 PM.

Details

Summary

Only the button if there's a session to switch to and/or the user is allowed to launch a new session.

Test Plan

Default setup, no other session: Got the button with a switch user entry
Disabled new session starting via kiosk restriction: No swtich user entry
Started a new session on console: Got the button again

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik updated this revision to Diff 7834.Nov 2 2016, 4:19 PM
broulik retitled this revision from to [Lock Screen] Show "Switch User" button only if allowed.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added reviewers: Plasma, romangg.
broulik set the repository for this revision to R120 Plasma Workspace.
Restricted Application added a project: Plasma. · View Herald TranscriptNov 2 2016, 4:19 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

If switching is disabled, we still want to hide the button.

I think we need:
(count > 0 || canStartNew) && canSwitch


bool SessionsModel::canSwitchUser() const

{

return const_cast<SessionsModel *>(this)->m_displayManager.isSwitchable() && KAuthorized::authorizeAction(QLatin1String("switch_user"));

}

bool SessionsModel::canStartNewSession() const
{

return const_cast<SessionsModel *>(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QLatin1String("start_new_session"));

}

broulik updated this revision to Diff 7866.Nov 3 2016, 3:38 PM

Take into account canSwitchUser

mart accepted this revision.Nov 4 2016, 10:24 AM
mart added a reviewer: mart.
This revision is now accepted and ready to land.Nov 4 2016, 10:24 AM
romangg accepted this revision.Nov 6 2016, 4:26 PM
romangg edited edge metadata.
This revision was automatically updated to reflect the committed changes.