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

56 lines
1.4 KiB
QML
Raw Normal View History

2019-12-19 22:46:16 +11:00
// SPDX-License-Identifier: LGPL-3.0-or-later
2019-09-15 07:48:53 +10:00
import QtQuick 2.12
import QtQuick.Layouts 1.12
2019-12-27 23:58:24 +11:00
import CppUtils 0.1
2019-12-18 19:53:08 +11:00
import "../../../Base"
2019-09-15 07:48:53 +10:00
HTile {
2019-12-17 09:05:09 +11:00
id: file
width: Math.min(
eventDelegate.width,
eventContent.maxMessageWidth,
Math.max(theme.chat.message.fileMinWidth, implicitWidth),
2019-11-11 20:34:46 +11:00
)
height: Math.max(theme.chat.message.avatarSize, implicitHeight)
2019-11-11 20:34:46 +11:00
title.text: loader.singleMediaInfo.media_title || qsTr("Untitled file")
2019-09-15 07:48:53 +10:00
title.elide: Text.ElideMiddle
subtitle.text: CppUtils.formattedBytes(loader.singleMediaInfo.media_size)
2019-09-15 07:48:53 +10:00
image: HIcon {
svgName: "download"
}
2019-12-17 09:05:09 +11:00
onRightClicked: eventDelegate.openContextMenu()
onLeftClicked:
eventList.selectedCount ?
eventDelegate.toggleChecked() : download(Qt.openUrlExternally)
2019-12-17 09:05:09 +11:00
onHoveredChanged: {
if (! hovered) {
eventDelegate.hoveredMediaTypeUrl = []
return
}
eventDelegate.hoveredMediaTypeUrl = [
EventDelegate.Media.File,
loader.downloadedPath.replace(/^file:\/\//, "") || loader.mediaUrl
2019-12-17 09:05:09 +11:00
]
}
property EventMediaLoader loader
readonly property bool cryptDict:
JSON.parse(loader.singleMediaInfo.media_crypt_dict)
readonly property bool isEncrypted: ! utils.isEmptyObject(cryptDict)
Binding on backgroundColor {
value: "blue" // XXX
when: eventDelegate.checked
}
2019-09-15 07:48:53 +10:00
}