on xenial help sign in
Don't reset the whole model
5a2b91dJosh Arenson
qml/Greeter/WideView.qml+2−2
@@ -153,9 +153,9 @@ FocusScope {
153 // TODO when Qt 5.7
153 // TODO when Qt 5.7
154 //enabled: LightDM.Users.mock
154 //enabled: LightDM.Users.mock
155 target: LightDMService.users
155 target: LightDMService.users
156− onModelReset: {
156+ onDataChanged: {
157 loginList.currentSession = LightDMService.users.data(loginList.currentIndex, LightDMService.userRoles.SessionRole);
157 loginList.currentSession = LightDMService.users.data(loginList.currentIndex, LightDMService.userRoles.SessionRole);
158− }
158+ }
159 }
159 }
160 }
160 }
161
161
tests/mocks/liblightdm/MockUsersModel.cpp+3−3
@@ -81,16 +81,16 @@ void UsersModel::setCurrentSessionName(const QString &sessionName, const QString
81{
81{
82 Q_D(UsersModel);
82 Q_D(UsersModel);
83
83
84− beginResetModel();
84+ int usersIndex = 0;
85−
86 for (auto &entry : d->entries) {
85 for (auto &entry : d->entries) {
87 if (username == entry.username) {
86 if (username == entry.username) {
88 entry.session = sessionName;
87 entry.session = sessionName;
89 break;
88 break;
90 }
89 }
90+ usersIndex++;
91 }
91 }
92
92
93− endResetModel();
93+ dataChanged(index(usersIndex, 0), index(usersIndex, 0), QVector<int>(SessionRole));
94}
94}
95
95
96int UsersModel::rowCount(const QModelIndex &parent) const
96int UsersModel::rowCount(const QModelIndex &parent) const