shift-shell/components/mobileshell/qml/statusbar/TaskWidget.qml
Marco Allegretti 1074b86225 Move shell chrome to shared motion
Use the Motion wrappers for action-drawer transitions, status bar feedback, panel reveal motion, startup feedback, and shell homescreen chrome. Keep non-animation settings reads in ShellSettings where they still control behavior.
2026-05-21 11:12:44 +02:00

67 lines
2.1 KiB
QML

/*
* SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
import QtQuick
import QtQuick.Controls as Controls
import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell as MobileShell
Item {
id: taskIcon
width: parent.height
height: width
readonly property int opacityAnimationDuration: MobileShell.Motion.duration(MobileShell.Motion.EffectsDefault)
// Hide ApplicationStatus and Passive items
opacity: (model.category !== "ApplicationStatus" && model.status !== "Passive") ? 1 : 0
onOpacityChanged: visible = opacity
Behavior on opacity {
MobileShell.MotionNumberAnimation {
type: MobileShell.Motion.EffectsDefault
duration: taskIcon.opacityAnimationDuration
}
}
Kirigami.Icon {
id: icon
source: model.iconName ? model.iconName : (model.icon ? model.icon : "")
width: Math.min(parent.width, parent.height)
height: width
anchors.centerIn: parent
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Window
isMask: true
color: Kirigami.Theme.textColor
}
Controls.ToolTip.text: model.toolTipTitle ? model.toolTipTitle : (model.title ? model.title : "")
Controls.ToolTip.visible: mouseArea.containsMouse && Controls.ToolTip.text !== ""
Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: (mouse) => {
if (!model.service) {
return;
}
var operationName = mouse.button === Qt.RightButton ? "ContextMenu" : "Activate";
var operation = model.service.operationDescription(operationName);
if (!operation) {
return;
}
operation.x = taskIcon.mapToGlobal(0, 0).x;
operation.y = taskIcon.mapToGlobal(0, taskIcon.height).y;
model.service.startOperationCall(operation);
}
}
}