[users] Give Config object a user and login name

- This is incomplete, because the business logic of guessing
  a login from the username is not here.
main
Adriaan de Groot 5 years ago
parent 35916eb20f
commit 66ae1823a5

@ -70,6 +70,27 @@ Config::setSudoersGroup( const QString& group )
} }
void
Config::setLoginName( const QString& login )
{
if ( login != m_loginName )
{
m_loginName = login;
emit loginNameChanged( login );
}
}
void
Config::setUserName( const QString& name )
{
if ( name != m_fullName )
{
m_fullName = name;
emit userNameChanged( name );
}
}
void void
Config::setConfigurationMap( const QVariantMap& configurationMap ) Config::setConfigurationMap( const QVariantMap& configurationMap )
{ {

@ -33,6 +33,9 @@ class Config : public QObject
Q_PROPERTY( QString autologinGroup READ autologinGroup WRITE setAutologinGroup NOTIFY autologinGroupChanged ) Q_PROPERTY( QString autologinGroup READ autologinGroup WRITE setAutologinGroup NOTIFY autologinGroupChanged )
Q_PROPERTY( QString sudoersGroup READ sudoersGroup WRITE setSudoersGroup NOTIFY sudoersGroupChanged ) Q_PROPERTY( QString sudoersGroup READ sudoersGroup WRITE setSudoersGroup NOTIFY sudoersGroupChanged )
Q_PROPERTY( QString userName READ userName WRITE setUserName NOTIFY userNameChanged )
Q_PROPERTY( QString loginName READ loginName WRITE setLoginName NOTIFY loginNameChanged )
public: public:
Config( QObject* parent = nullptr ); Config( QObject* parent = nullptr );
~Config(); ~Config();
@ -51,6 +54,11 @@ public:
/// The group of which users who can "sudo" must be a member /// The group of which users who can "sudo" must be a member
QString sudoersGroup() const { return m_sudoersGroup; } QString sudoersGroup() const { return m_sudoersGroup; }
/// The full (GECOS) name of the user
QString userName() const { return m_fullName; }
/// The login name of the user
QString loginName() const { return m_loginName; }
public Q_SLOTS: public Q_SLOTS:
/** @brief Sets the user's shell if possible /** @brief Sets the user's shell if possible
* *
@ -67,15 +75,24 @@ public Q_SLOTS:
/// Sets the sudoer group; empty is ignored /// Sets the sudoer group; empty is ignored
void setSudoersGroup( const QString& group ); void setSudoersGroup( const QString& group );
/// Sets the full name, may guess a loginName
void setUserName( const QString& name );
/// Sets the login name
void setLoginName( const QString& login );
signals: signals:
void userShellChanged( const QString& ); void userShellChanged( const QString& );
void autologinGroupChanged( const QString& ); void autologinGroupChanged( const QString& );
void sudoersGroupChanged( const QString& ); void sudoersGroupChanged( const QString& );
void userNameChanged( const QString& );
void loginNameChanged( const QString& );
private: private:
QString m_userShell; QString m_userShell;
QString m_autologinGroup; QString m_autologinGroup;
QString m_sudoersGroup; QString m_sudoersGroup;
QString m_fullName;
QString m_loginName;
}; };
#endif #endif

Loading…
Cancel
Save