Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/BackButtonItem.qml
Show All 28 Lines | 28 | PlasmaCore.FrameSvgItem { | |||
---|---|---|---|---|---|
29 | id: upButton | 29 | id: upButton | ||
30 | 30 | | |||
31 | width: gridView.cellWidth | 31 | width: gridView.cellWidth | ||
32 | height: visible ? gridView.cellHeight : 0 | 32 | height: visible ? gridView.cellHeight : 0 | ||
33 | 33 | | |||
34 | visible: history.length != 0 | 34 | visible: history.length != 0 | ||
35 | 35 | | |||
36 | property bool ignoreClick: false | 36 | property bool ignoreClick: false | ||
37 | property bool containsDrag: false | ||||
37 | 38 | | |||
38 | imagePath: "widgets/viewitem" | 39 | imagePath: "widgets/viewitem" | ||
39 | 40 | | |||
41 | function handleDragMove() { | ||||
42 | containsDrag = true; | ||||
43 | hoverActivateTimer.restart(); | ||||
44 | } | ||||
45 | | ||||
46 | function endDragMove() { | ||||
47 | containsDrag = false; | ||||
48 | hoverActivateTimer.stop(); | ||||
49 | } | ||||
50 | | ||||
40 | MouseArea { | 51 | MouseArea { | ||
41 | id: mouseArea | 52 | id: mouseArea | ||
42 | 53 | | |||
43 | anchors.fill: parent | 54 | anchors.fill: parent | ||
44 | 55 | | |||
45 | acceptedButtons: Qt.LeftButton | Qt.BackButton | 56 | acceptedButtons: Qt.LeftButton | Qt.BackButton | ||
46 | hoverEnabled: true | 57 | hoverEnabled: true | ||
47 | 58 | | |||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 97 | PlasmaComponents.Label { | |||
100 | 111 | | |||
101 | maximumLineCount: root.isPopup ? 1 : plasmoid.configuration.textLines | 112 | maximumLineCount: root.isPopup ? 1 : plasmoid.configuration.textLines | ||
102 | wrapMode: Text.Wrap | 113 | wrapMode: Text.Wrap | ||
103 | elide: Text.ElideRight | 114 | elide: Text.ElideRight | ||
104 | 115 | | |||
105 | text: i18n("Back") | 116 | text: i18n("Back") | ||
106 | } | 117 | } | ||
107 | 118 | | |||
119 | Timer { | ||||
120 | id: hoverActivateTimer | ||||
121 | | ||||
122 | interval: root.hoverActivateDelay | ||||
123 | | ||||
124 | onTriggered: doBack() | ||||
125 | } | ||||
126 | | ||||
108 | states: [ | 127 | states: [ | ||
109 | State { | 128 | State { | ||
110 | name: "hover" | 129 | name: "hover" | ||
111 | when: mouseArea.containsMouse | 130 | when: mouseArea.containsMouse || containsDrag | ||
112 | 131 | | |||
113 | PropertyChanges { | 132 | PropertyChanges { | ||
114 | target: upButton | 133 | target: upButton | ||
115 | prefix: "hover" | 134 | prefix: "hover" | ||
116 | } | 135 | } | ||
117 | } | 136 | } | ||
118 | ] | 137 | ] | ||
119 | } | 138 | } |