mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
plasma: warn when the KUser object is not valid in kill runner
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e0f5820d6b
commit
a92fd69279
2 changed files with 8 additions and 16 deletions
|
@ -88,7 +88,14 @@ void KillRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
const quint64 pid = process->pid;
|
||||
const qlonglong uid = process->uid;
|
||||
const QString user = getUserName(uid);
|
||||
QString user;
|
||||
KUser kuser(uid);
|
||||
if (kuser.isValid()) {
|
||||
user = kuser.loginName();
|
||||
} else {
|
||||
kWarning() << "No user with UID" << uid << "was found";
|
||||
user = QLatin1String("root");
|
||||
}
|
||||
|
||||
QVariantList data;
|
||||
data << pid << user;
|
||||
|
@ -156,14 +163,4 @@ QList<QAction*> KillRunner::actionsForMatch(const Plasma::QueryMatch &match)
|
|||
return ret;
|
||||
}
|
||||
|
||||
QString KillRunner::getUserName(qlonglong uid)
|
||||
{
|
||||
KUser user(uid);
|
||||
if (user.isValid()) {
|
||||
return user.loginName();
|
||||
}
|
||||
kDebug() << QString("No user with UID %1 was found").arg(uid);
|
||||
return "root";//No user with UID uid was found, so root is used
|
||||
}
|
||||
|
||||
#include "moc_killrunner.cpp"
|
||||
|
|
|
@ -41,11 +41,6 @@ public:
|
|||
void reloadConfiguration();
|
||||
|
||||
private:
|
||||
/** @param uid the uid of the user
|
||||
* @return the username of the user with the UID uid
|
||||
*/
|
||||
QString getUserName(qlonglong uid);
|
||||
|
||||
/** The trigger word */
|
||||
QString m_triggerWord;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue