Skip to content

Commit 612f5f5

Browse files
committed
Fix LauncherIcon toggling expand (Issue #157)
Show icon active effect on expand for 600ms like upstream.
1 parent 288a911 commit 612f5f5

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

package/contents/ui/LauncherIcon.qml

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import QtQuick.Layouts
33
import org.kde.plasma.core as PlasmaCore
44
import org.kde.draganddrop as DragAndDrop
55
import org.kde.kirigami as Kirigami
6+
import org.kde.plasma.plasmoid
67

78
MouseArea {
89
id: launcherIcon
@@ -61,30 +62,28 @@ MouseArea {
6162
source: "start-here-kde-symbolic"
6263
width: launcherIcon.iconSize
6364
height: launcherIcon.iconSize
64-
active: launcherIcon.containsMouse
65+
active: launcherIcon.containsMouse && !justOpenedTimer.running
6566
smooth: true
6667
}
6768

6869
// Debugging
6970
// Rectangle { anchors.fill: parent; border.color: "#ff0"; color: "transparent"; border.width: 1; }
7071
// Rectangle { anchors.fill: icon; border.color: "#f00"; color: "transparent"; border.width: 1; }
7172

73+
Accessible.name: Plasmoid.title
74+
Accessible.role: Accessible.Button
7275

7376
hoverEnabled: true
7477
// cursorShape: Qt.PointingHandCursor
7578

76-
onClicked: {
77-
plasmoid.expanded = !plasmoid.expanded
78-
}
79+
property bool wasExpanded
80+
onPressed: wasExpanded = widget.expanded
81+
onClicked: widget.expanded = !wasExpanded
7982

8083
property alias activateOnDrag: dropArea.enabled
8184
DragAndDrop.DropArea {
8285
id: dropArea
8386
anchors.fill: parent
84-
85-
onDragEnter: {
86-
dragHoverTimer.restart()
87-
}
8887
}
8988

9089
onContainsMouseChanged: {
@@ -96,6 +95,7 @@ MouseArea {
9695
Timer {
9796
id: dragHoverTimer
9897
interval: 250 // Same as taskmanager's activationTimer in MouseHandler.qml
99-
onTriggered: plasmoid.expanded = true
98+
running: dropArea.containsDrag
99+
onTriggered: widget.expanded = true
100100
}
101101
}

package/contents/ui/main.qml

+12-5
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,10 @@ PlasmoidItem {
9797
toolTipMainText: ""
9898
toolTipSubText: ""
9999

100-
// TODO Plasma6 update broke button so need to check default
101-
// compactRepresentation: LauncherIcon {
102-
// id: panelItem
103-
// iconSource: plasmoid.configuration.icon || "start-here-kde-symbolic"
104-
// }
100+
compactRepresentation: LauncherIcon {
101+
id: panelItem
102+
iconSource: plasmoid.configuration.icon || "start-here-kde-symbolic"
103+
}
105104

106105
hideOnWindowDeactivate: !widget.userConfiguring
107106
activationTogglesExpanded: true
@@ -118,8 +117,16 @@ PlasmoidItem {
118117
// fullRepresentationItem.tileGrid.addDefaultTiles()
119118
// var testTile = fullRepresentationItem.tileGrid.getTileAt(0, 1)
120119
// fullRepresentationItem.tileGrid.editTile(testTile)
120+
121+
// Show icon active effect without hovering
122+
justOpenedTimer.start()
121123
}
122124
}
125+
Timer {
126+
id: justOpenedTimer
127+
repeat: false
128+
interval: 600
129+
}
123130

124131
// property alias searchResultsView: popup.searchView.searchResultsView
125132
// width: popup.width

0 commit comments

Comments
 (0)