diff options
author | Michael Terry <michael.terry@canonical.com> | 2011-12-07 11:50:54 -0500 |
---|---|---|
committer | Michael Terry <michael.terry@canonical.com> | 2011-12-07 11:50:54 -0500 |
commit | 4a972090a4a30ab5e18b41de6110e74d820e6ce4 (patch) | |
tree | 1f7178c44addb34233d761e73f272b17bb8e519f /liblightdm-qt | |
parent | 99feb696b581c364df7fb2f5b7d6cd90e80381a8 (diff) | |
download | lightdm-4a972090a4a30ab5e18b41de6110e74d820e6ce4.tar.gz |
Support grabbing user's background from accountsservice if available
Diffstat (limited to 'liblightdm-qt')
-rw-r--r-- | liblightdm-qt/QLightDM/usersmodel.h | 3 | ||||
-rw-r--r-- | liblightdm-qt/usersmodel.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/liblightdm-qt/QLightDM/usersmodel.h b/liblightdm-qt/QLightDM/usersmodel.h index 39b94188..f6bfc444 100644 --- a/liblightdm-qt/QLightDM/usersmodel.h +++ b/liblightdm-qt/QLightDM/usersmodel.h @@ -30,7 +30,8 @@ public: enum UserModelRoles {NameRole = Qt::UserRole, RealNameRole, - LoggedInRole}; + LoggedInRole, + BackgroundRole}; int rowCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; diff --git a/liblightdm-qt/usersmodel.cpp b/liblightdm-qt/usersmodel.cpp index dcd3b58b..63781b58 100644 --- a/liblightdm-qt/usersmodel.cpp +++ b/liblightdm-qt/usersmodel.cpp @@ -26,6 +26,7 @@ public: QString realName; QString homeDirectory; QString image; + QString background; bool isLoggedIn; QString displayName() const; }; @@ -91,6 +92,7 @@ void UsersModelPrivate::loadUsers() user.homeDirectory = QString::fromLocal8Bit(lightdm_user_get_home_directory(ldmUser)); user.realName = QString::fromLocal8Bit(lightdm_user_get_real_name(ldmUser)); user.image = QString::fromLocal8Bit(lightdm_user_get_image(ldmUser)); + user.background = QString::fromLocal8Bit(lightdm_user_get_background(ldmUser)); user.isLoggedIn = lightdm_user_get_logged_in(ldmUser); users.append(user); } @@ -116,6 +118,7 @@ void UsersModelPrivate::cb_userAdded(LightDMUserList *user_list, LightDMUser *ld user.homeDirectory = QString::fromLocal8Bit(lightdm_user_get_home_directory(ldmUser)); user.realName = QString::fromLocal8Bit(lightdm_user_get_real_name(ldmUser)); user.image = QString::fromLocal8Bit(lightdm_user_get_image(ldmUser)); + user.background = QString::fromLocal8Bit(lightdm_user_get_background(ldmUser)); user.isLoggedIn = lightdm_user_get_logged_in(ldmUser); that->users.append(user); @@ -136,6 +139,7 @@ void UsersModelPrivate::cb_userChanged(LightDMUserList *user_list, LightDMUser * that->users[i].homeDirectory = QString::fromLocal8Bit(lightdm_user_get_home_directory(ldmUser)); that->users[i].realName = QString::fromLocal8Bit(lightdm_user_get_real_name(ldmUser)); that->users[i].image = QString::fromLocal8Bit(lightdm_user_get_image(ldmUser)); + that->users[i].background = QString::fromLocal8Bit(lightdm_user_get_background(ldmUser)); that->users[i].isLoggedIn = lightdm_user_get_logged_in(ldmUser); QModelIndex index = that->q_ptr->createIndex(i, 0); @@ -209,6 +213,8 @@ QVariant UsersModel::data(const QModelIndex &index, int role) const return d->users[row].realName; case UsersModel::LoggedInRole: return d->users[row].isLoggedIn; + case UsersModel::BackgroundRole: + return QPixmap(d->users[row].background); } return QVariant(); |