Changeset View
Changeset View
Standalone View
Standalone View
components/sessionsprivate/sessionsmodel.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 67 | { | |||
---|---|---|---|---|---|
68 | return const_cast<SessionsModel *>(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QLatin1String("start_new_session")); | 68 | return const_cast<SessionsModel *>(this)->m_displayManager.numReserve() > 0 && KAuthorized::authorizeAction(QLatin1String("start_new_session")); | ||
69 | } | 69 | } | ||
70 | 70 | | |||
71 | bool SessionsModel::shouldLock() const | 71 | bool SessionsModel::shouldLock() const | ||
72 | { | 72 | { | ||
73 | return m_shouldLock; | 73 | return m_shouldLock; | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | bool SessionsModel::includeUnusedSessions() const | ||||
77 | { | ||||
78 | return m_includeUnusedSessions; | ||||
79 | } | ||||
80 | | ||||
81 | void SessionsModel::setIncludeUnusedSessions(bool includeUnusedSessions) | ||||
82 | { | ||||
83 | if (m_includeUnusedSessions != includeUnusedSessions) { | ||||
84 | m_includeUnusedSessions = includeUnusedSessions; | ||||
85 | | ||||
86 | reload(); | ||||
87 | | ||||
88 | emit includeUnusedSessionsChanged(); | ||||
89 | } | ||||
90 | } | ||||
91 | | ||||
76 | void SessionsModel::switchUser(int vt, bool shouldLock) | 92 | void SessionsModel::switchUser(int vt, bool shouldLock) | ||
77 | { | 93 | { | ||
78 | if (vt < 0) { | 94 | if (vt < 0) { | ||
79 | startNewSession(shouldLock); | 95 | startNewSession(shouldLock); | ||
80 | return; | 96 | return; | ||
81 | } | 97 | } | ||
82 | 98 | | |||
83 | if (!canSwitchUser()) { | 99 | if (!canSwitchUser()) { | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 152 | { | |||
152 | m_data.clear(); | 168 | m_data.clear(); | ||
153 | m_data.reserve(sessions.count()); | 169 | m_data.reserve(sessions.count()); | ||
154 | 170 | | |||
155 | foreach (const SessEnt &session, sessions) { | 171 | foreach (const SessEnt &session, sessions) { | ||
156 | if (!session.vt || session.self) { | 172 | if (!session.vt || session.self) { | ||
157 | continue; | 173 | continue; | ||
158 | } | 174 | } | ||
159 | 175 | | |||
176 | if (!m_includeUnusedSessions && session.session.isEmpty()) { | ||||
177 | continue; | ||||
178 | } | ||||
179 | | ||||
160 | SessionEntry entry; | 180 | SessionEntry entry; | ||
161 | entry.name = session.user; | 181 | entry.name = session.user; | ||
162 | entry.displayNumber = session.display; | 182 | entry.displayNumber = session.display; | ||
163 | entry.vtNumber = session.vt; | 183 | entry.vtNumber = session.vt; | ||
164 | entry.session = session.session; | 184 | entry.session = session.session; | ||
165 | entry.isTty = session.tty; | 185 | entry.isTty = session.tty; | ||
166 | 186 | | |||
167 | auto it = kusers.constFind(session.user); | 187 | auto it = kusers.constFind(session.user); | ||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |