Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderItemDelegate.qml
Show All 35 Lines | 29 | Item { | |||
---|---|---|---|---|---|
36 | property QtObject popupDialog: loader.item ? loader.item.popupDialog : null | 36 | property QtObject popupDialog: loader.item ? loader.item.popupDialog : null | ||
37 | property Item iconArea: loader.item ? loader.item.iconArea : null | 37 | property Item iconArea: loader.item ? loader.item.iconArea : null | ||
38 | property Item label: loader.item ? loader.item.label : null | 38 | property Item label: loader.item ? loader.item.label : null | ||
39 | property Item labelArea: loader.item ? loader.item.labelArea : null | 39 | property Item labelArea: loader.item ? loader.item.labelArea : null | ||
40 | property Item actionsOverlay: loader.item ? loader.item.actionsOverlay : null | 40 | property Item actionsOverlay: loader.item ? loader.item.actionsOverlay : null | ||
41 | property Item hoverArea: loader.item ? loader.item.hoverArea : null | 41 | property Item hoverArea: loader.item ? loader.item.hoverArea : null | ||
42 | property Item toolTip: loader.item ? loader.item.toolTip : null | 42 | property Item toolTip: loader.item ? loader.item.toolTip : null | ||
43 | 43 | | |||
44 | function openPopup() { | ||||
45 | if (isDir) { | ||||
46 | loader.item.openPopup(); | ||||
47 | } | ||||
48 | } | ||||
49 | | ||||
44 | Loader { | 50 | Loader { | ||
45 | id: loader | 51 | id: loader | ||
46 | 52 | | |||
47 | anchors.fill: parent | 53 | anchors.fill: parent | ||
48 | 54 | | |||
49 | active: !model.blank | 55 | active: !model.blank | ||
50 | 56 | | |||
51 | sourceComponent: delegateImplementation | 57 | sourceComponent: delegateImplementation | ||
Show All 33 Lines | 90 | if (isDir && main.GridView.view.isRootView && impl.popupButton == null) { | |||
85 | impl.popupButton = popupButtonComponent.createObject(actions); | 91 | impl.popupButton = popupButtonComponent.createObject(actions); | ||
86 | } else if (impl.popupButton) { | 92 | } else if (impl.popupButton) { | ||
87 | impl.popupButton.destroy(); | 93 | impl.popupButton.destroy(); | ||
88 | impl.popupButton = null; | 94 | impl.popupButton = null; | ||
89 | } | 95 | } | ||
90 | } | 96 | } | ||
91 | 97 | | |||
92 | onHoveredChanged: { | 98 | onHoveredChanged: { | ||
93 | if (hovered && !main.GridView.view.isRootView && model.isDir) { | 99 | if (hovered && (!main.GridView.view.isRootView || root.containsDrag) && model.isDir) { | ||
94 | openPopupTimer.start(); | 100 | openPopupTimer.start(); | ||
95 | } else if (!hovered) | 101 | } else if (!hovered) | ||
96 | openPopupTimer.stop(); | 102 | openPopupTimer.stop(); | ||
97 | 103 | | |||
98 | if (popupDialog != null) { | 104 | if (popupDialog != null) { | ||
99 | popupDialog.destroy(); | 105 | popupDialog.destroy(); | ||
100 | popupDialog = null; | 106 | popupDialog = null; | ||
101 | } | 107 | } | ||
102 | } | 108 | } | ||
103 | 109 | | |||
104 | function openPopup() { | 110 | function openPopup() { | ||
105 | if (folderViewDialogComponent.status == Component.Ready) { | 111 | if (folderViewDialogComponent.status == Component.Ready) { | ||
106 | impl.popupDialog = folderViewDialogComponent.createObject(impl); | 112 | impl.popupDialog = folderViewDialogComponent.createObject(impl); | ||
107 | impl.popupDialog.visualParent = icon; | 113 | impl.popupDialog.visualParent = icon; | ||
108 | impl.popupDialog.url = model.linkDestinationUrl; | 114 | impl.popupDialog.url = model.linkDestinationUrl; | ||
109 | impl.popupDialog.visible = true; | 115 | impl.popupDialog.visible = true; | ||
110 | } | 116 | } | ||
111 | } | 117 | } | ||
112 | 118 | | |||
113 | Timer { | 119 | Timer { | ||
114 | id: openPopupTimer | 120 | id: openPopupTimer | ||
115 | 121 | | |||
116 | interval: units.longDuration * 3 | 122 | interval: 750 // Magic number that matches Dolphin's auto-expand folders delay. | ||
117 | 123 | | |||
118 | onTriggered: { | 124 | onTriggered: { | ||
119 | impl.openPopup(); | 125 | impl.openPopup(); | ||
120 | } | 126 | } | ||
121 | } | 127 | } | ||
122 | 128 | | |||
129 | Connections { | ||||
130 | target: main.GridView.view | ||||
131 | | ||||
132 | enabled: hovered | ||||
133 | | ||||
134 | onContentXChanged: { | ||||
135 | openPopupTimer.stop(); | ||||
136 | } | ||||
137 | | ||||
138 | onContentYChanged: { | ||||
139 | openPopupTimer.stop(); | ||||
140 | } | ||||
141 | } | ||||
142 | | ||||
123 | PlasmaCore.ToolTipArea { | 143 | PlasmaCore.ToolTipArea { | ||
124 | id: toolTip | 144 | id: toolTip | ||
125 | 145 | | |||
126 | x: frame.x + Math.min(icon.x, label.x) | 146 | x: frame.x + Math.min(icon.x, label.x) | ||
127 | y: frame.y + icon.y | 147 | y: frame.y + icon.y | ||
128 | 148 | | |||
129 | width: Math.max(icon.width, label.width) | 149 | width: Math.max(icon.width, label.width) | ||
130 | height: (label.y + label.paintedHeight) | 150 | height: (label.y + label.paintedHeight) | ||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Line(s) | 278 | PlasmaComponents.Label { | |||
309 | 329 | | |||
310 | Component.onCompleted: textFix.disableMouseHandling(label) // FIXME TODO: See https://codereview.qt-project.org/#/c/113758/ | 330 | Component.onCompleted: textFix.disableMouseHandling(label) // FIXME TODO: See https://codereview.qt-project.org/#/c/113758/ | ||
311 | } | 331 | } | ||
312 | } | 332 | } | ||
313 | 333 | | |||
314 | Column { | 334 | Column { | ||
315 | id: actions | 335 | id: actions | ||
316 | 336 | | |||
337 | visible: { | ||||
338 | if (main.GridView.view.isRootView && root.containsDrag) { | ||||
339 | return false; | ||||
340 | } | ||||
341 | | ||||
342 | if (!main.GridView.view.isRootView && dialog.containsDrag) { | ||||
343 | return false; | ||||
344 | } | ||||
345 | | ||||
346 | if (popupDialog) { | ||||
347 | return false; | ||||
348 | } | ||||
349 | | ||||
350 | return true; | ||||
351 | } | ||||
352 | | ||||
317 | x: units.smallSpacing * 3 | 353 | x: units.smallSpacing * 3 | ||
318 | y: units.smallSpacing * 3 | 354 | y: units.smallSpacing * 3 | ||
319 | 355 | | |||
320 | anchors { | 356 | anchors { | ||
321 | centerIn: root.useListViewMode ? icon : undefined | 357 | centerIn: root.useListViewMode ? icon : undefined | ||
322 | } | 358 | } | ||
323 | 359 | | |||
324 | width: implicitWidth | 360 | width: implicitWidth | ||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |