on xenial help sign in
Begin large refactor
commit88f3046f181c2f716978ad842cf8ef02dd72e2f6 authorJosh Arenson <joshua.arenson@canonical.com> dateMon 25 Jul 2016, 17:18 (10 years ago) parent696229c
2 files changed+119−33
qml/Greeter/LoginList.qml+2−2 qml/Greeter/WideView.qml+117−31
qml/Greeter/LoginList.qml+2−2
@@ -35,8 +35,8 @@ StyledItem {
3535 readonly property int highlightedHeight: units.gu(15)
3636 readonly property int moveDuration: 200
3737 property string selectedSession
38− property string currentSession: selectedSession ?
39− selectedSession : userList.currentItem.userSession
38+ property string currentSession//: selectedSession ?
39+ //selectedSession : userList.currentItem.userSession
4040 readonly property string currentUser: userList.currentItem.username
4141 property bool wasPrompted: false
4242
qml/Greeter/WideView.qml+117−31
@@ -27,12 +27,12 @@ FocusScope {
2727 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
2828 property alias infographicModel: coverPage.infographicModel
2929 property alias launcherOffset: coverPage.launcherOffset
30− property alias loginListShown: loginAreaLoader.loginListShown
31− property int currentIndex // Set from outside
30+ property alias loginListShown: loginList.loginListShown
31+ property alias currentIndex: loginList.currentIndex
3232 property int delayMinutes // TODO
33− property bool alphanumeric: true
34− property bool locked
35− property alias sessionToStart: loginAreaLoader.currentSession
33+ property alias alphanumeric: loginList.alphanumeric
34+ property alias locked: loginList.locked
35+ property alias sessionToStart: loginList.currentSession
3636 property var userModel // Set from outside
3737
3838 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
@@ -57,29 +57,29 @@ FocusScope {
5757
5858 readonly property var notifyAuthenticationFailed: ifLoginlistShownThen(doNotifyAuthenticationFailed);
5959 function doNotifyAuthenticationFailed() {
60− loginAreaLoader.item.showError();
60+ loginListm.showError();
6161 }
6262
6363 readonly property var reset: ifLoginlistShownThen(doReset);
6464 function doReset() {
65− loginAreaLoader.item.reset();
65+ loginList.reset();
6666 }
6767
6868 readonly property var showMessage: ifLoginlistShownThen(doShowMessage);
6969 function doShowMessage(html) {
70− loginAreaLoader.item.showMessage(html);
70+ loginList.showMessage(html);
7171 }
7272
7373 readonly property var showPrompt: ifLoginlistShownThen(doShowPrompt);
7474 function doShowPrompt(text, isSecret, isDefaultPrompt) {
75− loginAreaLoader.item.showPrompt(text, isSecret, isDefaultPrompt);
75+ loginList.showPrompt(text, isSecret, isDefaultPrompt);
7676 }
7777
7878 readonly property var tryToUnlock: ifLoginlistShownThen(doTryToUnlock);
7979 function doTryToUnlock(toTheRight) {
8080 if (root.locked) {
8181 coverPage.show();
82− loginAreaLoader.item.tryToUnlock();
82+ loginList.tryToUnlock();
8383 return false;
8484 } else {
8585 var coverChanged = coverPage.shown;
@@ -117,10 +117,11 @@ FocusScope {
117117 height: parent.height
118118 width: parent.width
119119 draggable: !root.locked && !root.waiting
120+ state: "LoginList"
120121
121122 infographics {
122123 height: 0.75 * parent.height
123− anchors.leftMargin: loginAreaLoader.x + loginAreaLoader.width
124+ anchors.leftMargin: loginList.x + loginList.width
124125 }
125126
126127 onTease: root.tease()
@@ -131,9 +132,94 @@ FocusScope {
131132 }
132133 }
133134
135+ LoginList {
136+ id: loginList
137+
138+ property bool loginListShown: true
139+ property bool sessionUpdated: false
140+
141+ height: inputMethod && inputMethod.visible ?
142+ parent.height - inputMethod.keyboardRectangle.height : parent.height
143+ width: units.gu(40)
144+ anchors {
145+ left: parent.left
146+ leftMargin: Math.min(parent.width * 0.16, units.gu(20))
147+ top: parent.top
148+ }
149+
150+ model: root.userModel
151+
152+ currentSession: LightDMService.greeter.defaultSession
153+ onResponded: root.responded(response)
154+ onSelected: root.selected(index)
155+ onSessionChooserButtonClicked: parent.state = "SessionsList"
156+ }
157+
134158 Loader {
135− id: loginAreaLoader
136− objectName: "loginAreaLoader"
159+ id: sessionChooserLoader
160+
161+ height: loginList.height
162+ width: loginList.width
163+ anchors {
164+ left: parent.left
165+ leftMargin: Math.min(parent.width * 0.16, units.gu(20))
166+ top: parent.top
167+ }
168+
169+ active: false
170+
171+ Binding {
172+ target: sessionChooserLoader.item
173+ property: "initiallySelectedSession"
174+ value: loginList.currentSession
175+ }
176+
177+ Connections {
178+ target: sessionChooserLoader.item
179+ onShowLoginList: coverPage.state = "LoginList"
180+ onSessionSelected: {
181+ loginList.sessionUpdated = true
182+ loginList.currentSession = sessionKey
183+ }
184+ ignoreUnknownSignals: true
185+ }
186+ }
187+
188+ states: [
189+ State {
190+ name: "SessionsList"
191+ PropertyChanges { target: loginList; opacity: 0 }
192+ PropertyChanges { target: sessionChooserLoader;
193+ active: true;
194+ opacity: 1
195+ source: "SessionsList.qml"
196+ }
197+ },
198+
199+ State {
200+ name: "LoginList"
201+ PropertyChanges { target: loginList; opacity: 1 }
202+ PropertyChanges { target: sessionChooserLoader;
203+ active: false;
204+ opacity: 0
205+ source: "";
206+ }
207+ }
208+ ]
209+
210+ transitions: [
211+ Transition {
212+ from: "*"
213+ to: "*"
214+ UbuntuNumberAnimation {
215+ property: "opacity";
216+ }
217+ }
218+ ]
219+
220+ /*Loader {
221+ id: loginList
222+ objectName: "loginList"
137223
138224 // True when LoginList is shown, false when SessionList is shown
139225 property bool loginListShown: true
@@ -155,7 +241,7 @@ FocusScope {
155241
156242 UbuntuNumberAnimation {
157243 id: loadingAnimation
158− target: loginAreaLoader.item
244+ target: loginList.item
159245 property: "opacity"
160246 from: 0
161247 to: 1
@@ -163,25 +249,25 @@ FocusScope {
163249 }
164250
165251 Binding {
166− target: loginAreaLoader.item
252+ target: loginList.item
167253 property: "alphanumeric"
168254 value: loginListShown ? root.alphanumeric : null
169255 }
170256
171257 Binding {
172− target: loginAreaLoader.item
258+ target: loginList.item
173259 property: "currentIndex"
174260 value: loginListShown ? root.currentIndex : null
175261 }
176262
177263 Binding {
178− target: loginAreaLoader.item
264+ target: loginList.item
179265 property: "locked"
180266 value: root.locked
181267 }
182268
183269 Binding {
184− target: loginAreaLoader.item
270+ target: loginList.item
185271 property: "model"
186272 value: loginListShown ? root.userModel : null
187273 }
@@ -189,27 +275,27 @@ FocusScope {
189275 // Only inform LoginList if the session isn't the user's default session
190276 // because LoginList gets the default session on its own
191277 Binding {
192− target: loginAreaLoader.item
278+ target: loginList.item
193279 property: "selectedSession"
194− value: loginListShown && loginAreaLoader.sessionUpdated ?
195− loginAreaLoader.currentSession : null
280+ value: loginListShown && loginList.sessionUpdated ?
281+ loginList.currentSession : null
196282 }
197283
198284 Binding {
199− target: loginAreaLoader.item
285+ target: loginList.item
200286 property: "initiallySelectedSession"
201− value: !loginListShown ? loginAreaLoader.currentSession : null
287+ value: !loginListShown ? loginList.currentSession : null
202288 }
203289
204290 Connections {
205− target: loginListShown ? loginAreaLoader.item : null
291+ target: loginListShown ? loginList.item : null
206292 onSelected: root.selected(index)
207293 onResponded: root.responded(response)
208294 // The initially selected session lags behind the component completion
209295 // so this provides the initial session name when available
210296 onLoginListSessionChanged: {
211− if (loginListShown && !loginAreaLoader.sessionUpdated) {
212− loginAreaLoader.currentSession = loginAreaLoader.item.currentSession
297+ if (loginListShown && !loginList.sessionUpdated) {
298+ loginList.currentSession = loginList.item.currentSession
213299 }
214300 }
215301
@@ -218,15 +304,15 @@ FocusScope {
218304 }
219305
220306 Connections {
221− target: !loginListShown ? loginAreaLoader.item : null
307+ target: !loginListShown ? loginList.item : null
222308 onSessionSelected: {
223− loginAreaLoader.sessionUpdated = true
224− loginAreaLoader.currentSession = sessionKey
309+ loginList.sessionUpdated = true
310+ loginList.currentSession = sessionKey
225311 }
226312
227− onShowLoginList: loginAreaLoader.loginListShown = true
313+ onShowLoginList: loginList.loginListShown = true
228314 ignoreUnknownSignals: true
229315 }
230− }
316+ }*/
231317 }
232318}