Skip to content

Commit

Permalink
Simplify activity list delegates by making them ItemDelegates, clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
  • Loading branch information
claucambra committed Jul 28, 2022
1 parent 16fd9c5 commit 7976538
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions src/gui/tray/ActivityItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15
import Style 1.0
import com.nextcloud.desktopclient 1.0

MouseArea {
ItemDelegate {
id: root

property Flickable flickable
Expand All @@ -21,28 +21,19 @@ MouseArea {
: Qt.darker(UserModel.currentUser.headerColor, 1.5)

enabled: (model.path !== "" || model.link !== "" || model.isCurrentUserFileActivity === true)
hoverEnabled: true

// We center the children vertically in the middle of this MouseArea to create the padding.
height: contentLayout.implicitHeight + (Style.standardSpacing * 2)
padding: Style.standardSpacing

Accessible.role: Accessible.ListItem
Accessible.name: (model.path !== "" && model.displayPath !== "") ? qsTr("Open %1 locally").arg(model.displayPath) : model.message
Accessible.onPressAction: root.clicked()

function toggleReplyOptions() {
isTalkReplyOptionVisible = !isTalkReplyOptionVisible
}

Rectangle {
id: activityHover
anchors.fill: parent
color: (parent.containsMouse ? Style.lightHover : "transparent")
background: Rectangle {
color: root.hovered ? Style.lightHover : "transparent"
}

ToolTip {
id: activityMouseAreaTooltip
visible: containsMouse && !activityContent.childHovered && model.displayLocation !== ""
visible: root.hovered && !activityContent.childHovered && model.displayLocation !== ""
delay: Qt.styleHints.mousePressAndHoldInterval
text: qsTr("In %1").arg(model.displayLocation)
contentItem: Label {
Expand All @@ -55,13 +46,12 @@ MouseArea {
}
}

ColumnLayout {
contentItem: ColumnLayout {
id: contentLayout
anchors.left: root.left
anchors.right: root.right
anchors.rightMargin: Style.standardSpacing
anchors.leftMargin: Style.standardSpacing
anchors.verticalCenter: parent.verticalCenter

spacing: Style.activityContentSpace

Expand Down Expand Up @@ -121,7 +111,7 @@ MouseArea {
adjustedHeaderColor: root.adjustedHeaderColor

onTriggerAction: activityModel.slotTriggerAction(model.index, actionIndex)
onShowReplyField: root.toggleReplyOptions()
onShowReplyField: root.isTalkReplyOptionVisible = true
}
}
}

0 comments on commit 7976538

Please sign in to comment.