on xenial help sign in
Use OrientationLock.savedOrientation. Rename deviceOrientation to deviceOrientationAngle
69190a1Gerry Boland
qml/Shell.qml+19−12
@@ -62,6 +62,22 @@ Item {
62 property int failedLoginsDelayAttempts: 7 // number of failed logins
62 property int failedLoginsDelayAttempts: 7 // number of failed logins
63 property int failedLoginsDelaySeconds: 5 * 60 // seconds of forced waiting
63 property int failedLoginsDelaySeconds: 5 * 60 // seconds of forced waiting
64
64
65+ property int orientation
66+ readonly property int deviceOrientationAngle: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
67+ onDeviceOrientationAngleChanged: {
68+ if (!OrientationLock.enabled) {
69+ orientation = Screen.orientation;
70+ }
71+ }
72+ readonly property bool orientationLockEnabled: OrientationLock.enabled
73+ onOrientationLockEnabledChanged: {
74+ if (orientationLockEnabled) {
75+ OrientationLock.savedOrientation = Screen.orientation;
76+ } else {
77+ orientation = Screen.orientation;
78+ }
79+ }
80+
65 function activateApplication(appId) {
81 function activateApplication(appId) {
66 if (ApplicationManager.findApplication(appId)) {
82 if (ApplicationManager.findApplication(appId)) {
67 ApplicationManager.requestFocusApplication(appId);
83 ApplicationManager.requestFocusApplication(appId);
@@ -86,6 +102,9 @@ Item {
86
102
87 Component.onCompleted: {
103 Component.onCompleted: {
88 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
104 Theme.name = "Ubuntu.Components.Themes.SuruGradient"
105+ if (orientationLockEnabled) {
106+ orientation = OrientationLock.savedOrientation;
107+ }
89 }
108 }
90
109
91 GSettings {
110 GSettings {
@@ -171,18 +190,6 @@ Item {
171 }
190 }
172 }
191 }
173
192
174− property int orientation
175− readonly property int deviceOrientation: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
176− onDeviceOrientationChanged: {
177− if (!OrientationLock.enabled)
178− orientation = Screen.orientation;
179− }
180− readonly property bool orientationLockEnabled: OrientationLock.enabled
181− onOrientationLockEnabledChanged: {
182− if (!OrientationLock.enabled)
183− orientation = Screen.orientation;
184− }
185−
186 Loader {
193 Loader {
187 id: applicationsDisplayLoader
194 id: applicationsDisplayLoader
188 anchors.fill: parent
195 anchors.fill: parent