2017-06-13 17:45:52 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
|
|
|
BackgroundItem {
|
|
|
|
id: delegate
|
|
|
|
signal send (string notice)
|
|
|
|
signal navigateTo(string link)
|
|
|
|
width: parent.width
|
|
|
|
height: miniHeader.height + lblContent.height + Theme.paddingLarge + (ministatus.visible ? ministatus.height : 0) +Theme.paddingLarge
|
|
|
|
MiniStatus {
|
|
|
|
id: ministatus
|
|
|
|
anchors {
|
|
|
|
leftMargin: Theme.horizontalPageMargin
|
|
|
|
rightMargin: Theme.horizontalPageMargin
|
|
|
|
top: parent.top
|
|
|
|
topMargin: Theme.paddingMedium
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Image {
|
|
|
|
id: avatar
|
|
|
|
anchors {
|
|
|
|
top: ministatus.visible ? ministatus.bottom : parent.top
|
|
|
|
topMargin: ministatus.visible ? Theme.paddingMedium : Theme.paddingLarge
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: Theme.horizontalPageMargin
|
|
|
|
}
|
|
|
|
asynchronous: true
|
|
|
|
width: Theme.iconSizeMedium
|
|
|
|
height: width
|
|
|
|
smooth: true
|
|
|
|
source: account_avatar
|
|
|
|
visible: true
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: {
|
|
|
|
pageStack.push(Qt.resolvedUrl("../Profile.qml"), {
|
2017-06-15 01:48:53 +03:00
|
|
|
"displayname": model.account_username,
|
|
|
|
"username": model.account_acct,
|
|
|
|
"user_id": model.account_id,
|
|
|
|
"profileImage": model.account_avatar
|
2017-06-13 17:45:52 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
color: Theme.highlightDimmerColor
|
|
|
|
width: Theme.iconSizeSmall
|
|
|
|
height: width
|
|
|
|
visible: typeof status_reblog !== "undefined" && status_reblog
|
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: -width/3
|
|
|
|
left: parent.left
|
|
|
|
leftMargin: -width/3
|
|
|
|
}
|
|
|
|
Image {
|
|
|
|
asynchronous: true
|
|
|
|
width: Theme.iconSizeSmall
|
|
|
|
height: width
|
|
|
|
smooth: true
|
2017-06-14 17:57:44 +03:00
|
|
|
source: typeof reblog_account_avatar !== "undefined" ? reblog_account_avatar : ''
|
2017-06-13 17:45:52 +03:00
|
|
|
visible: typeof status_reblog !== "undefined" && status_reblog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MiniHeader {
|
|
|
|
id: miniHeader
|
|
|
|
anchors {
|
|
|
|
top: avatar.top
|
|
|
|
left: avatar.right
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id: lblContent
|
|
|
|
anchors {
|
|
|
|
left: miniHeader.left
|
|
|
|
leftMargin: Theme.paddingMedium
|
|
|
|
right: miniHeader.right
|
|
|
|
rightMargin: Theme.horizontalPageMargin
|
|
|
|
top: miniHeader.bottom
|
|
|
|
topMargin: Theme.paddingSmall
|
|
|
|
bottomMargin: Theme.paddingLarge
|
|
|
|
}
|
|
|
|
height: content.length ? paintedHeight : 0
|
|
|
|
onLinkActivated: {
|
|
|
|
console.log(link)
|
|
|
|
if (link[0] === "@") {
|
|
|
|
pageStack.push(Qt.resolvedUrl("../Profile.qml"), {
|
|
|
|
"name": "",
|
|
|
|
"username": link.substring(1),
|
|
|
|
"profileImage": ""
|
|
|
|
})
|
|
|
|
} else if (link[0] === "#") {
|
|
|
|
|
|
|
|
pageStack.pop(pageStack.find(function(page) {
|
|
|
|
var check = page.isFirstPage === true;
|
|
|
|
if (check)
|
|
|
|
page.onLinkActivated(link)
|
|
|
|
return check;
|
|
|
|
}));
|
|
|
|
|
|
|
|
send(link)
|
|
|
|
} else {
|
|
|
|
pageStack.push(Qt.resolvedUrl("../Browser.qml"), {"href" : link})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
text: content
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
linkColor : Theme.highlightColor
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
font.pixelSize: Theme.fontSizeSmall
|
2017-06-15 17:03:20 +03:00
|
|
|
color: (pressed ? Theme.highlightColor : (highlight ? Theme.primaryColor : Theme.secondaryColor))
|
2017-06-13 17:45:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onClicked: {
|
2017-06-15 17:03:20 +03:00
|
|
|
var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
|
|
|
m.append(mdl.get(index))
|
2017-06-13 17:45:52 +03:00
|
|
|
pageStack.push(Qt.resolvedUrl("../Conversation.qml"), {
|
2017-06-15 17:03:20 +03:00
|
|
|
toot_id: status_id,
|
2017-06-13 17:45:52 +03:00
|
|
|
title: account_display_name,
|
2017-06-15 01:48:53 +03:00
|
|
|
description: '@'+account_acct,
|
2017-06-13 17:45:52 +03:00
|
|
|
avatar: account_avatar,
|
2017-06-15 17:03:20 +03:00
|
|
|
mdl: m,
|
2017-06-13 17:45:52 +03:00
|
|
|
type: "reply"
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|