2 * Copyright (C) 2014-2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "UsersModelPrivate.h"
18#include "UsersModel.h"
25UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
29 char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
31 mockMode = envMockMode;
36void UsersModelPrivate::resetEntries()
42 if (mockMode == "single") {
43 resetEntries_single();
44 } else if (mockMode == "single-passphrase") {
45 resetEntries_singlePassphrase();
46 } else if (mockMode == "single-pin") {
47 resetEntries_singlePin();
48 } else if (mockMode == "full") {
52 // Assign uids in a loop, just to avoid having to muck with them when
53 // adding or removing test users.
54 for (int i = 0; i < entries.size(); i++) {
55 entries[i].uid = i + 1;
59 QDir backgroundDir("/usr/share/backgrounds");
60 QStringList backgrounds = backgroundDir.entryList(QDir::Files);
61 if (!backgrounds.empty()) {
62 for (int i = 0; i < entries.size(); i++) {
63 if (entries[i].background.isNull()) {
64 entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]);
72void UsersModelPrivate::resetEntries_single()
76 { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
80void UsersModelPrivate::resetEntries_singlePassphrase()
84 { "single", "Single User", 0, 0, false, false, "ubuntu", 0 },
88void UsersModelPrivate::resetEntries_singlePin()
92 { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
96void UsersModelPrivate::resetEntries_full()
100 { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
101 { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
102 { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
103 { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
104 { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
105 { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
106 { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
107 { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
108 { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
109 { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
110 { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
111 { "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 },
112 { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 },
113 // white and black are a bit redundant, but useful for manually testing if UI is still readable
114 { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
115 { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
116 { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
117 { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
118 { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
119 { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
120 { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
124} // namespace QLightDM
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list