Commit fafdffc3 authored by Tomi Leppänen's avatar Tomi Leppänen

[nemo-systemsettings] Allow setting UserInfo uid from QML. Contributes to JB#49640

Signed-off-by: Tomi Leppänen's avatarTomi Leppänen <tomi.leppanen@jolla.com>
parent 54a20b06
......@@ -292,6 +292,13 @@ int UserInfo::uid() const
return (int)d->m_uid;
}
void UserInfo::setUid(int uid)
{
Q_D(const UserInfo);
if ((uid_t)uid != d->m_uid)
replace(UserInfo(uid).d_ptr);
}
/**
* Returs true if user is logged in on seat0 and is the active user, i.e. the current user
*/
......
......@@ -50,7 +50,7 @@ class SYSTEMSETTINGS_EXPORT UserInfo: public QObject
Q_PROPERTY(QString username READ username NOTIFY usernameChanged)
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(UserType type READ type CONSTANT)
Q_PROPERTY(int uid READ uid NOTIFY uidChanged)
Q_PROPERTY(int uid READ uid WRITE setUid NOTIFY uidChanged)
Q_PROPERTY(bool current READ current NOTIFY currentChanged)
friend class UserModel;
......@@ -75,6 +75,7 @@ public:
QString name() const;
UserType type() const;
int uid() const;
void setUid(int uid);
bool current() const;
Q_INVOKABLE void reset();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment