Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/CompactRepresentation.qml
- This file was copied to containments/desktop/package/contents/ui/FolderViewDropArea.qml.
Show All 20 Lines | |||||
21 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 | ||
22 | 22 | | |||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 23 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.draganddrop 2.0 as DragDrop | 24 | import org.kde.draganddrop 2.0 as DragDrop | ||
25 | 25 | | |||
26 | DragDrop.DropArea { | 26 | DragDrop.DropArea { | ||
27 | property Item folderView: null | 27 | property Item folderView: null | ||
28 | 28 | | |||
29 | onContainsDragChanged: { | ||||
30 | if (containsDrag) { | ||||
31 | hoverActivateTimer.restart(); | ||||
32 | } else { | ||||
33 | hoverActivateTimer.stop(); | ||||
34 | } | ||||
35 | } | ||||
36 | | ||||
29 | onDrop: folderView.model.dropCwd(event) | 37 | onDrop: folderView.model.dropCwd(event) | ||
30 | preventStealing: true | 38 | preventStealing: true | ||
31 | 39 | | |||
40 | function toggle() { | ||||
41 | plasmoid.expanded = !plasmoid.expanded; | ||||
42 | } | ||||
43 | | ||||
32 | PlasmaCore.IconItem { | 44 | PlasmaCore.IconItem { | ||
33 | id: icon | 45 | id: icon | ||
34 | 46 | | |||
35 | anchors.fill: parent | 47 | anchors.fill: parent | ||
36 | 48 | | |||
37 | active: mouseArea.containsMouse | 49 | active: mouseArea.containsMouse | ||
38 | 50 | | |||
39 | source: plasmoid.configuration.useCustomIcon ? plasmoid.configuration.icon : folderView.model.iconName | 51 | source: plasmoid.configuration.useCustomIcon ? plasmoid.configuration.icon : folderView.model.iconName | ||
40 | } | 52 | } | ||
41 | 53 | | |||
42 | MouseArea | 54 | MouseArea | ||
43 | { | 55 | { | ||
44 | id: mouseArea | 56 | id: mouseArea | ||
45 | 57 | | |||
46 | anchors.fill: parent | 58 | anchors.fill: parent | ||
47 | 59 | | |||
48 | hoverEnabled: true | 60 | hoverEnabled: true | ||
49 | 61 | | |||
50 | onClicked: { | 62 | onClicked: toggle() | ||
51 | plasmoid.expanded = !plasmoid.expanded; | | |||
52 | } | 63 | } | ||
64 | | ||||
65 | Timer { | ||||
66 | id: hoverActivateTimer | ||||
67 | | ||||
68 | interval: root.hoverActivateDelay | ||||
69 | | ||||
70 | onTriggered: toggle() | ||||
53 | } | 71 | } | ||
54 | } | 72 | } |