2021-01-12 15:03:39 +01:00
|
|
|
import QtQuick 2.5
|
|
|
|
import QtQuick.Controls 2.1
|
2019-11-30 01:43:39 +01:00
|
|
|
import im.nheko 1.0
|
2019-09-18 22:58:25 +02:00
|
|
|
|
2021-01-16 16:02:55 +01:00
|
|
|
ImageButton {
|
2020-10-08 21:11:21 +02:00
|
|
|
id: indicator
|
|
|
|
|
|
|
|
width: 16
|
|
|
|
height: 16
|
2021-01-16 16:02:55 +01:00
|
|
|
hoverEnabled: true
|
2021-01-16 16:16:27 +01:00
|
|
|
changeColorOnHover: (model.state == MtxEvent.Read)
|
|
|
|
ToolTip.visible: hovered && model.state != MtxEvent.Empty
|
2020-10-08 21:11:21 +02:00
|
|
|
ToolTip.text: {
|
|
|
|
switch (state) {
|
|
|
|
case MtxEvent.Failed:
|
|
|
|
return qsTr("Failed");
|
|
|
|
case MtxEvent.Sent:
|
|
|
|
return qsTr("Sent");
|
|
|
|
case MtxEvent.Received:
|
|
|
|
return qsTr("Received");
|
|
|
|
case MtxEvent.Read:
|
|
|
|
return qsTr("Read");
|
|
|
|
default:
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-16 16:02:55 +01:00
|
|
|
onClicked: {
|
2021-01-16 16:16:27 +01:00
|
|
|
if (model.state == MtxEvent.Read)
|
|
|
|
TimelineManager.timeline.readReceiptsAction(model.id);
|
2020-10-08 21:11:21 +02:00
|
|
|
}
|
|
|
|
|
2021-01-16 16:02:55 +01:00
|
|
|
image: {
|
2021-01-16 16:16:27 +01:00
|
|
|
switch (model.state) {
|
2021-01-16 16:02:55 +01:00
|
|
|
case MtxEvent.Failed:
|
|
|
|
return ":/icons/icons/ui/remove-symbol.png";
|
|
|
|
case MtxEvent.Sent:
|
|
|
|
return ":/icons/icons/ui/clock.png";
|
|
|
|
case MtxEvent.Received:
|
|
|
|
return ":/icons/icons/ui/checkmark.png";
|
|
|
|
case MtxEvent.Read:
|
|
|
|
return ":/icons/icons/ui/double-tick-indicator.png";
|
|
|
|
default:
|
|
|
|
return "";
|
2020-10-08 21:11:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|