AusweisApp2/resources/qml/Governikus/HistoryView/HistoryListViewDelegateCont...

135 lines
3.6 KiB
QML
Raw Normal View History

2017-07-03 09:30:10 +02:00
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
2017-12-20 14:54:05 +01:00
import Governikus.Global 1.0
2017-07-03 09:30:10 +02:00
Item {
id: baseItem
2017-07-03 09:33:28 +02:00
property bool showDetail: false
property var listModel
2017-07-03 09:30:10 +02:00
Rectangle {
id: background
color: "white"
2017-07-03 09:33:28 +02:00
anchors.left: parent.left
anchors.leftMargin: Utils.dp(5)
2017-07-03 09:30:10 +02:00
anchors.right: parent.right
anchors.rightMargin: Utils.dp(5)
anchors.top: parent.top
anchors.bottom: parent.bottom
2017-07-03 09:33:28 +02:00
HistoryItemImage {
id: categoryImage
imageUrl: historyModelItem ? historyModelItem.providerIcon : ""
visible: !showDetail
}
2017-07-03 09:30:10 +02:00
Rectangle {
2017-12-20 14:54:05 +01:00
id: purposeObject
2018-03-28 15:10:51 +02:00
height: purposeColumn.height
property alias truncated: purposeText.truncated
2017-07-03 09:30:10 +02:00
anchors.verticalCenter: parent.verticalCenter
2017-07-03 09:33:28 +02:00
anchors.left: showDetail ? parent.left : categoryImage.right
2017-12-20 14:54:05 +01:00
anchors.leftMargin: showDetail ? 0 : Utils.dp(15)
anchors.right: deleteButton.left
2017-07-03 09:30:10 +02:00
Column {
2018-03-28 15:10:51 +02:00
id: purposeColumn
2017-07-03 09:30:10 +02:00
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
spacing: Constants.history_delegate_spacing
Text {
id: dateTimeText
verticalAlignment: Text.AlignVCenter
2017-07-03 09:33:28 +02:00
font.pixelSize: Constants.label_font_size
2017-07-03 09:30:10 +02:00
font.capitalization: Font.AllUppercase
color: Constants.blue
2017-12-20 14:54:05 +01:00
text: (!historyModelItem ? "" :
Utils.isToday(historyModelItem.dateTime) ? qsTr("today") :
Utils.isYesterday(historyModelItem.dateTime) ? qsTr("yesterday") :
Utils.isThisWeek(historyModelItem.dateTime) ? historyModelItem.dateTime.toLocaleString(Qt.locale(), qsTr("dddd")) :
historyModelItem.dateTime.toLocaleString(Qt.locale(), qsTr("dd.MM.yyyy"))
) + settingsModel.translationTrigger
2017-07-03 09:30:10 +02:00
}
Text {
id: subjectText
2018-03-28 15:10:51 +02:00
color: Constants.secondary_text
2017-07-03 09:30:10 +02:00
2017-07-03 09:33:28 +02:00
anchors.left: parent.left
anchors.right: parent.right
2017-07-03 09:30:10 +02:00
verticalAlignment: Text.AlignVCenter
2017-07-03 09:33:28 +02:00
font.pixelSize: Constants.label_font_size
wrapMode: Text.WordWrap
text: historyModelItem ? historyModelItem.subject : ""
2017-07-03 09:30:10 +02:00
}
Text {
2017-07-03 09:33:28 +02:00
id: purposeText
2017-07-03 09:30:10 +02:00
2017-07-03 09:33:28 +02:00
anchors.left: parent.left
anchors.right: parent.right
2017-07-03 09:30:10 +02:00
verticalAlignment: Text.AlignVCenter
2017-07-03 09:33:28 +02:00
font.pixelSize: Constants.small_font_size
2017-07-03 09:30:10 +02:00
color: Constants.history_delegate_address_color
2017-07-03 09:33:28 +02:00
wrapMode: Text.WordWrap
2018-03-28 15:10:51 +02:00
maximumLineCount: 2
2017-12-20 14:54:05 +01:00
text: historyModelItem ? !!historyModelItem.purpose ? historyModelItem.purpose : qsTr("Tap for more details") + settingsModel.translationTrigger : ""
2017-07-03 09:30:10 +02:00
}
}
}
2018-03-28 15:10:51 +02:00
Text {
visible: purposeText.truncated
anchors.left: purposeObject.right
anchors.bottom: purposeObject.bottom
font.pixelSize: Constants.small_font_size
color: Constants.history_delegate_address_color
text: "..."
}
2017-12-20 14:54:05 +01:00
Image {
height: Utils.dp(35)
source: "qrc:///images/android/arrowRight.svg"
anchors.right: parent.right
anchors.verticalCenter: purposeObject.verticalCenter
anchors.rightMargin: Utils.dp(2)
fillMode: Image.PreserveAspectFit
}
2017-07-03 09:30:10 +02:00
MouseArea {
anchors.fill: parent
2017-12-20 14:54:05 +01:00
onClicked: firePush(detailsHistoryView, { historyModelItem: historyModelItem })
2017-07-03 09:33:28 +02:00
}
2017-12-20 14:54:05 +01:00
MouseArea {
id: deleteButton
2017-07-03 09:33:28 +02:00
anchors.right: parent.right
2017-12-20 14:54:05 +01:00
anchors.top: parent.top
anchors.topMargin: Utils.dp(5)
height: parent.height * 0.3
2017-07-03 09:33:28 +02:00
width: height
2017-12-20 14:54:05 +01:00
visible: PlatformConstants.is_layout_ios ? false : true
2017-07-03 09:33:28 +02:00
2017-12-20 14:54:05 +01:00
onClicked: {
if (typeof(listModel) === "object") {
listModel.removeRows(historyModelItem ? historyModelItem.index : -1, 1)
2017-07-03 09:30:10 +02:00
}
}
2017-12-20 14:54:05 +01:00
Image {
height: Utils.dp(21)
anchors.right: parent.right
anchors.top: parent.top
source: "qrc:///images/trash_icon.svg"
fillMode: Image.PreserveAspectFit
}
2017-07-03 09:30:10 +02:00
}
}
}