moment/src/qml/Chat/Timeline/EventFile.qml

44 lines
1.2 KiB
QML
Raw Normal View History

2019-09-14 17:48:53 -04:00
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../../Base"
2019-12-16 18:05:09 -04:00
import "../../utils.js" as Utils
2019-09-14 17:48:53 -04:00
HTile {
2019-12-16 18:05:09 -04:00
id: file
width: Math.min(
eventDelegate.width,
eventContent.maxMessageWidth,
Math.max(theme.chat.message.fileMinWidth, implicitWidth),
2019-11-11 05:34:46 -04:00
)
height: Math.max(theme.chat.message.avatarSize, implicitHeight)
2019-11-11 05:34:46 -04:00
title.text: loader.singleMediaInfo.media_title || qsTr("Untitled file")
2019-09-14 17:48:53 -04:00
title.elide: Text.ElideMiddle
subtitle.text: CppUtils.formattedBytes(loader.singleMediaInfo.media_size)
2019-09-14 17:48:53 -04:00
image: HIcon {
svgName: "download"
}
2019-12-16 18:05:09 -04:00
onLeftClicked: download(Qt.openUrlExternally)
onRightClicked: eventDelegate.openContextMenu()
onHoveredChanged: {
if (! hovered) {
eventDelegate.hoveredMediaTypeUrl = []
return
}
eventDelegate.hoveredMediaTypeUrl = [
EventDelegate.Media.File,
loader.downloadedPath.replace(/^file:\/\//, "") || loader.mediaUrl
2019-12-16 18:05:09 -04:00
]
}
property EventMediaLoader loader
readonly property bool cryptDict: loader.singleMediaInfo.media_crypt_dict
readonly property bool isEncrypted: ! Utils.isEmptyObject(cryptDict)
2019-09-14 17:48:53 -04:00
}