2020-10-31 22:49:03 +03:00
|
|
|
import QtQuick 2.6
|
2020-10-19 13:20:02 +03:00
|
|
|
import Sailfish.Silica 1.0
|
2020-11-25 02:23:38 +03:00
|
|
|
import WerkWolf.Fernschreiber 1.0
|
|
|
|
|
2020-10-19 13:20:02 +03:00
|
|
|
ListItem {
|
|
|
|
id: chatListViewItem
|
|
|
|
|
|
|
|
property alias primaryText: primaryText //usually chat name
|
|
|
|
property alias prologSecondaryText: prologSecondaryText //usually last sender name
|
|
|
|
property alias secondaryText: secondaryText //usually last message
|
|
|
|
property alias tertiaryText: tertiaryText //usually last message date
|
|
|
|
|
2020-11-28 21:11:51 +03:00
|
|
|
property int unreadCount: 0
|
2020-11-25 02:23:38 +03:00
|
|
|
property bool isSecret: false
|
2020-12-03 02:50:38 +03:00
|
|
|
property bool isVerified: false
|
2020-12-31 02:19:36 +03:00
|
|
|
property bool isMarkedAsUnread: false
|
2020-10-19 13:20:02 +03:00
|
|
|
property alias pictureThumbnail: pictureThumbnail
|
|
|
|
|
|
|
|
contentHeight: mainRow.height + separator.height + 2 * Theme.paddingMedium
|
|
|
|
contentWidth: parent.width
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: mainColumn
|
|
|
|
width: parent.width - ( 2 * Theme.horizontalPageMargin )
|
|
|
|
spacing: Theme.paddingSmall
|
|
|
|
anchors {
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
id: mainRow
|
|
|
|
height: contentColumn.height
|
|
|
|
spacing: Theme.paddingMedium
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: pictureColumn
|
|
|
|
width: contentColumn.height - Theme.paddingSmall
|
|
|
|
height: contentColumn.height - Theme.paddingSmall
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
|
|
|
Item {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.width
|
|
|
|
|
|
|
|
ProfileThumbnail {
|
|
|
|
id: pictureThumbnail
|
|
|
|
replacementStringHint: primaryText.text
|
|
|
|
width: parent.width
|
|
|
|
height: parent.width
|
|
|
|
}
|
|
|
|
|
2020-11-25 02:23:38 +03:00
|
|
|
Rectangle {
|
|
|
|
id: chatSecretBackground
|
|
|
|
color: Theme.overlayBackgroundColor
|
|
|
|
width: Theme.fontSizeExtraLarge
|
|
|
|
height: Theme.fontSizeExtraLarge
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
radius: parent.width / 2
|
|
|
|
visible: chatListViewItem.isSecret
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
source: "image://theme/icon-s-secure"
|
|
|
|
height: Theme.fontSizeMedium
|
|
|
|
width: Theme.fontSizeMedium
|
|
|
|
anchors.centerIn: chatSecretBackground
|
|
|
|
visible: chatListViewItem.isSecret
|
|
|
|
}
|
|
|
|
|
2020-10-19 13:20:02 +03:00
|
|
|
Rectangle {
|
|
|
|
id: chatUnreadMessagesCountBackground
|
|
|
|
color: Theme.highlightBackgroundColor
|
|
|
|
width: Theme.fontSizeLarge
|
|
|
|
height: Theme.fontSizeLarge
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
radius: parent.width / 2
|
2020-12-31 02:19:36 +03:00
|
|
|
visible: chatListViewItem.unreadCount > 0 || chatListViewItem.isMarkedAsUnread
|
2020-10-19 13:20:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
id: chatUnreadMessagesCount
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
font.bold: true
|
|
|
|
color: Theme.primaryColor
|
|
|
|
anchors.centerIn: chatUnreadMessagesCountBackground
|
2020-12-31 02:19:36 +03:00
|
|
|
visible: chatListViewItem.unreadCount > 0
|
2020-10-19 13:20:02 +03:00
|
|
|
text: chatListViewItem.unreadCount > 99 ? "99+" : chatListViewItem.unreadCount
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: contentColumn
|
2020-12-03 02:50:38 +03:00
|
|
|
width: mainColumn.width - pictureColumn.width - mainRow.spacing
|
2020-10-19 13:20:02 +03:00
|
|
|
spacing: Theme.paddingSmall
|
|
|
|
|
2020-12-03 02:50:38 +03:00
|
|
|
Row {
|
|
|
|
id: primaryTextRow
|
|
|
|
spacing: Theme.paddingMedium
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: primaryText
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
font.pixelSize: Theme.fontSizeMedium
|
|
|
|
truncationMode: TruncationMode.Fade
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0), implicitWidth)
|
|
|
|
}
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: verifiedImage
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
source: chatListViewItem.isVerified ? "../../images/icon-verified.svg" : ""
|
|
|
|
sourceSize.width: Theme.iconSizeExtraSmall
|
|
|
|
width: Theme.iconSizeExtraSmall
|
|
|
|
visible: status === Image.Ready
|
|
|
|
}
|
2020-10-19 13:20:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Row {
|
|
|
|
width: parent.width
|
|
|
|
spacing: Theme.paddingSmall
|
2020-11-22 02:39:49 +03:00
|
|
|
Label {
|
2020-10-19 13:20:02 +03:00
|
|
|
id: prologSecondaryText
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
2020-11-22 21:16:11 +03:00
|
|
|
width: Math.min(implicitWidth, parent.width)
|
2020-10-19 13:20:02 +03:00
|
|
|
color: Theme.highlightColor
|
|
|
|
textFormat: Text.StyledText
|
2020-11-22 02:39:49 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
2020-10-19 13:20:02 +03:00
|
|
|
}
|
2020-11-22 02:39:49 +03:00
|
|
|
Label {
|
2020-10-19 13:20:02 +03:00
|
|
|
id: secondaryText
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
width: parent.width - Theme.paddingMedium - prologSecondaryText.width
|
2020-11-22 02:39:49 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
2020-10-19 13:20:02 +03:00
|
|
|
textFormat: Text.StyledText
|
2020-11-25 02:23:38 +03:00
|
|
|
visible: prologSecondaryText.width < ( parent.width - Theme.paddingLarge )
|
2020-10-19 13:20:02 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-22 02:39:49 +03:00
|
|
|
Label {
|
2020-10-19 13:20:02 +03:00
|
|
|
id: tertiaryText
|
|
|
|
width: parent.width
|
|
|
|
font.pixelSize: Theme.fontSizeTiny
|
|
|
|
color: Theme.secondaryColor
|
2020-11-22 02:39:49 +03:00
|
|
|
truncationMode: TruncationMode.Fade
|
2020-10-19 13:20:02 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: separator
|
|
|
|
anchors {
|
|
|
|
top: mainColumn.bottom
|
|
|
|
topMargin: Theme.paddingMedium
|
|
|
|
}
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
color: Theme.primaryColor
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|