Skip to content

Commit b6a43bb

Browse files
mobius3plfiorini
authored andcommitted
Provid the role 'needsPassword' in UserModel
1 parent cca46e2 commit b6a43bb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/greeter/UserModel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace SDDM {
3737
QString realName { "" };
3838
QString homeDir { "" };
3939
QString icon { "" };
40+
bool needsPassword { false };
4041
int uid { 0 };
4142
int gid { 0 };
4243
};
@@ -75,6 +76,7 @@ namespace SDDM {
7576
user->homeDir = QString(current_pw->pw_dir);
7677
user->uid = int(current_pw->pw_uid);
7778
user->gid = int(current_pw->pw_gid);
79+
user->needsPassword = strcmp(current_pw->pw_passwd, "") != 0;
7880

7981
// search for face icon
8082
QString userFace = QString("%1/.face.icon").arg(user->homeDir);
@@ -113,6 +115,7 @@ namespace SDDM {
113115
roleNames[RealNameRole] = "realName";
114116
roleNames[HomeDirRole] = "homeDir";
115117
roleNames[IconRole] = "icon";
118+
roleNames[NeedsPasswordRole] = "needsPassword";
116119

117120
return roleNames;
118121
}
@@ -145,6 +148,8 @@ namespace SDDM {
145148
return user->homeDir;
146149
else if (role == IconRole)
147150
return user->icon;
151+
else if (role == NeedsPasswordRole)
152+
return user->needsPassword;
148153

149154
// return empty value
150155
return QVariant();

src/greeter/UserModel.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ namespace SDDM {
3737
NameRole = Qt::UserRole + 1,
3838
RealNameRole,
3939
HomeDirRole,
40-
IconRole
40+
IconRole,
41+
NeedsPasswordRole
4142
};
4243

4344
UserModel(QObject *parent = 0);

0 commit comments

Comments
 (0)