Changeset View
Changeset View
Standalone View
Standalone View
processcore/extended_process_list.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 91 | { | |||
---|---|---|---|---|---|
103 | d->m_coreAttributes << loginSensor; | 103 | d->m_coreAttributes << loginSensor; | ||
104 | 104 | | |||
105 | auto uidSensor = new ProcessSensor<qlonglong>(this, QStringLiteral("uid"), i18n("UID"), &KSysGuard::Process::uid, KSysGuard::Process::Uids, ForwardFirstEntry); | 105 | auto uidSensor = new ProcessSensor<qlonglong>(this, QStringLiteral("uid"), i18n("UID"), &KSysGuard::Process::uid, KSysGuard::Process::Uids, ForwardFirstEntry); | ||
106 | d->m_coreAttributes << uidSensor; | 106 | d->m_coreAttributes << uidSensor; | ||
107 | 107 | | |||
108 | auto userNameSensor = new ProcessSensor<QString>( | 108 | auto userNameSensor = new ProcessSensor<QString>( | ||
109 | this, QStringLiteral("username"), i18n("Username"), [this](KSysGuard::Process *p) { | 109 | this, QStringLiteral("username"), i18n("Username"), [this](KSysGuard::Process *p) { | ||
110 | const K_UID uid = p->uid(); | 110 | const K_UID uid = p->uid(); | ||
111 | auto userIt = d->m_userCache.constFind(uid); | 111 | auto userIt = d->m_userCache.find(uid); | ||
112 | if (userIt == d->m_userCache.constEnd()) { | 112 | if (userIt == d->m_userCache.end()) { | ||
113 | userIt = d->m_userCache.insert(uid, KUser(uid)); | 113 | userIt = d->m_userCache.insert(uid, KUser(uid)); | ||
114 | } | 114 | } | ||
115 | return userIt->loginName(); | 115 | return userIt->loginName(); | ||
116 | }, | 116 | }, | ||
117 | KSysGuard::Process::Uids, ForwardFirstEntry); | 117 | KSysGuard::Process::Uids, ForwardFirstEntry); | ||
118 | d->m_coreAttributes << userNameSensor; | 118 | d->m_coreAttributes << userNameSensor; | ||
119 | 119 | | |||
120 | auto canUserLoginSensor = new ProcessSensor<bool>( | 120 | auto canUserLoginSensor = new ProcessSensor<bool>( | ||
121 | this, QStringLiteral("canUserLogin"), i18n("Can Login"), [this](KSysGuard::Process *p) { | 121 | this, QStringLiteral("canUserLogin"), i18n("Can Login"), [this](KSysGuard::Process *p) { | ||
122 | const K_UID uid = p->uid(); | 122 | const K_UID uid = p->uid(); | ||
123 | if (uid == 65534) { // special value meaning nobody | 123 | if (uid == 65534) { // special value meaning nobody | ||
124 | return false; | 124 | return false; | ||
125 | } | 125 | } | ||
126 | auto userIt = d->m_userCache.constFind(uid); | 126 | auto userIt = d->m_userCache.find(uid); | ||
127 | if (userIt == d->m_userCache.constEnd()) { | 127 | if (userIt == d->m_userCache.end()) { | ||
128 | userIt = d->m_userCache.insert(uid, KUser(uid)); | 128 | userIt = d->m_userCache.insert(uid, KUser(uid)); | ||
129 | } | 129 | } | ||
130 | 130 | | |||
131 | if (!userIt->isValid()) { | 131 | if (!userIt->isValid()) { | ||
132 | // For some reason the user isn't recognised. This might happen under certain security situations. | 132 | // For some reason the user isn't recognised. This might happen under certain security situations. | ||
133 | // Just return true to be safe | 133 | // Just return true to be safe | ||
134 | return true; | 134 | return true; | ||
135 | } | 135 | } | ||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |