@@ -67,6 +67,8 @@ UsersModel::UsersModel(QObject *parent)
68 connect(MockController::instance(), &MockController::userModeChanged,
68 connect(MockController::instance(), &MockController::userModeChanged,
69 this, &UsersModel::resetEntries);
69 this, &UsersModel::resetEntries);
70+ connect(MockController::instance(), &MockController::sessionNameChanged,
71+ this, &UsersModel::setCurrentSessionName);
70 resetEntries();
72 resetEntries();
@@ -75,6 +77,22 @@ UsersModel::~UsersModel()
75 delete d_ptr;
77 delete d_ptr;
80+void UsersModel::setCurrentSessionName(const QString &sessionName, const QString &username)
85+ for (auto &entry : d->entries) {
86+ if (username == entry.username) {
87+ entry.session = sessionName;
93+ dataChanged(index(usersIndex, 0), index(usersIndex, 0), QVector<int>(SessionRole));
78int UsersModel::rowCount(const QModelIndex &parent) const
96int UsersModel::rowCount(const QModelIndex &parent) const
80 Q_D(const UsersModel);
98 Q_D(const UsersModel);
@@ -138,28 +156,33 @@ void UsersModel::resetEntries()
138 } else if (userMode == "single-pin") {
156 } else if (userMode == "single-pin") {
139 d->entries = {{"has-pin", "Has PIN", "", 0, false, false, "ubuntu", 0}};
157 d->entries = {{"has-pin", "Has PIN", "", 0, false, false, "ubuntu", 0}};
140 } else if (userMode == "full") {
158 } else if (userMode == "full") {
160+ * Since the real model sorts these entries alphabetically, the model indices
161+ * don't line up correctly. The easiest way to fix this is to ensure that this
162+ * list of entries REMAINS IN ALPHABETICAL ORDER at all times.
141 d->entries = {
164 d->entries = {
165+ { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
166+ { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
167+ { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
168+ { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 },
169+ { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
170+ { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
142 { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
171 { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
143 { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
172 { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
144− { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
145− { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
146− { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
147− { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
148− { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
149 { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
173 { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
174+ { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
150 { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
175 { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
151− { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
152− { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
153 { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
176 { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
154− { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 },
177+ { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
155− // white and black are a bit redundant, but useful for manually testing if UI is still readable
156− { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
157− { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
158 { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
178 { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
159− { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
179+ { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
160 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
180 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
161− { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
181+ { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
162− { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
182+ { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
183+ // white and black are a bit redundant, but useful for manually testing if UI is still readable
184+ { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
185+ { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 }