on xenial help sign in
With property
commit44c3a720161efbe43179962305c2a87ea67bb8a0 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateFri 5 Dec 2014, 15:44 (12 years ago) parent173d3d0
2 files changed+30−28
qml/Launcher/Launcher.qml+27−25 tests/qmltests/tst_Shell.qml+3−3
qml/Launcher/Launcher.qml+27−25
@@ -23,6 +23,7 @@ import Unity.Launcher 0.1
2323Item {
2424 id: root
2525
26+ property bool autohideEnabled: false
2627 property bool available: true // can be used to disable all interactions
2728
2829 property int panelWidth: units.gu(8)
@@ -42,14 +43,13 @@ Item {
4243 // emitted when the dash icon in the launcher has been tapped
4344 signal showDashHome()
4445
45−// FIXME Similar code will be needed on desktop autohide (see dismissTimer and other code commented out)
46−// onStateChanged: {
47−// if (state == "") {
48−// dismissTimer.stop()
49−// } else {
50−// dismissTimer.restart()
51−// }
52−// }
46+ onStateChanged: {
47+ if (state == "") {
48+ dismissTimer.stop()
49+ } else {
50+ dismissTimer.restart()
51+ }
52+ }
5353
5454 function hide() {
5555 switchToNextState("")
@@ -84,18 +84,20 @@ Item {
8484 property string mode: "teasing"
8585 }
8686
87−// Timer {
88−// id: dismissTimer
89−// objectName: "dismissTimer"
90−// interval: 5000
91−// onTriggered: {
92−// if (!panel.preventHiding) {
93−// root.state = ""
94−// } else {
95−// dismissTimer.restart()
96−// }
97−// }
98−// }
87+ Timer {
88+ id: dismissTimer
89+ objectName: "dismissTimer"
90+ interval: 5000
91+ onTriggered: {
92+ if (root.autohideEnabled) {
93+ if (!panel.preventHiding) {
94+ root.state = ""
95+ } else {
96+ dismissTimer.restart()
97+ }
98+ }
99+ }
100+ }
99101
100102 // Because the animation on x is disabled while dragging
101103 // switching state directly in the drag handlers would not animate
@@ -211,11 +213,11 @@ Item {
211213 root.showDashHome();
212214 }
213215
214−// onPreventHidingChanged: {
215−// if (dismissTimer.running) {
216−// dismissTimer.restart();
217−// }
218−// }
216+ onPreventHidingChanged: {
217+ if (dismissTimer.running) {
218+ dismissTimer.restart();
219+ }
220+ }
219221
220222 Behavior on x {
221223 enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate;
tests/qmltests/tst_Shell.qml+3−3
@@ -745,9 +745,9 @@ Item {
745745
746746 var launcher = findChild(shell, "launcher");
747747
748−// // ensure the launcher dimissal timer never gets triggered during the test run
749−// var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
750−// dismissTimer.interval = 60 * 60 * 1000;
748+ // ensure the launcher dimissal timer never gets triggered during the test run
749+ var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
750+ dismissTimer.interval = 60 * 60 * 1000;
751751
752752 dragLauncherIntoView();
753753