You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.0 KiB
65 lines
2.0 KiB
From b6a43bb50bf055a327e50eb292565d08b8e6b6a5 Mon Sep 17 00:00:00 2001
|
|
From: Leonardo <leonardo.guilherme@gmail.com>
|
|
Date: Wed, 11 Mar 2015 12:12:44 -0300
|
|
Subject: [PATCH 45/70] Provid the role 'needsPassword' in UserModel
|
|
|
|
---
|
|
src/greeter/UserModel.cpp | 5 +++++
|
|
src/greeter/UserModel.h | 3 ++-
|
|
2 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/greeter/UserModel.cpp b/src/greeter/UserModel.cpp
|
|
index e28f40a..82d123c 100644
|
|
--- a/src/greeter/UserModel.cpp
|
|
+++ b/src/greeter/UserModel.cpp
|
|
@@ -37,6 +37,7 @@ namespace SDDM {
|
|
QString realName { "" };
|
|
QString homeDir { "" };
|
|
QString icon { "" };
|
|
+ bool needsPassword { false };
|
|
int uid { 0 };
|
|
int gid { 0 };
|
|
};
|
|
@@ -75,6 +76,7 @@ namespace SDDM {
|
|
user->homeDir = QString(current_pw->pw_dir);
|
|
user->uid = int(current_pw->pw_uid);
|
|
user->gid = int(current_pw->pw_gid);
|
|
+ user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0;
|
|
|
|
// search for face icon
|
|
QString userFace = QString("%1/.face.icon").arg(user->homeDir);
|
|
@@ -113,6 +115,7 @@ namespace SDDM {
|
|
roleNames[RealNameRole] = "realName";
|
|
roleNames[HomeDirRole] = "homeDir";
|
|
roleNames[IconRole] = "icon";
|
|
+ roleNames[NeedsPasswordRole] = "needsPassword";
|
|
|
|
return roleNames;
|
|
}
|
|
@@ -145,6 +148,8 @@ namespace SDDM {
|
|
return user->homeDir;
|
|
else if (role == IconRole)
|
|
return user->icon;
|
|
+ else if (role == NeedsPasswordRole)
|
|
+ return user->needsPassword;
|
|
|
|
// return empty value
|
|
return QVariant();
|
|
diff --git a/src/greeter/UserModel.h b/src/greeter/UserModel.h
|
|
index 8cc355f..99d2770 100644
|
|
--- a/src/greeter/UserModel.h
|
|
+++ b/src/greeter/UserModel.h
|
|
@@ -37,7 +37,8 @@ namespace SDDM {
|
|
NameRole = Qt::UserRole + 1,
|
|
RealNameRole,
|
|
HomeDirRole,
|
|
- IconRole
|
|
+ IconRole,
|
|
+ NeedsPasswordRole
|
|
};
|
|
|
|
UserModel(QObject *parent = 0);
|
|
--
|
|
2.4.3
|
|
|