2017-08-29 05:02:56 +00:00
|
|
|
import QtQuick 2.4
|
2017-08-29 14:28:33 +00:00
|
|
|
import QtQuick.Controls 2.1
|
|
|
|
import QtQuick.Controls.Material 2.1
|
2017-08-29 05:02:56 +00:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
|
|
|
|
Popup {
|
2019-05-09 03:39:02 +00:00
|
|
|
property var message
|
|
|
|
|
2017-08-29 05:02:56 +00:00
|
|
|
id: popup
|
|
|
|
|
|
|
|
modal: true
|
|
|
|
// focus: true
|
2019-05-06 18:19:57 +00:00
|
|
|
height: Math.min(mainWindow.height * 0.8, layout.implicitHeight + 32)
|
2017-08-29 05:02:56 +00:00
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
Flickable {
|
|
|
|
id: flickable
|
2017-08-29 05:02:56 +00:00
|
|
|
anchors.fill: parent
|
2019-05-06 18:19:57 +00:00
|
|
|
clip: true
|
|
|
|
contentHeight: layout.height
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
width: parent.width
|
|
|
|
MessageView {
|
2019-05-09 03:39:02 +00:00
|
|
|
showActionButtons: false
|
2019-05-09 04:19:52 +00:00
|
|
|
visible: message != null
|
2019-05-09 03:39:02 +00:00
|
|
|
name: message.name
|
|
|
|
messageid: message.messageid
|
|
|
|
posturl: message.posturl
|
|
|
|
author: message.author
|
|
|
|
authorid: message.authorid
|
|
|
|
authorurl: message.authorurl
|
|
|
|
avatar: message.avatar
|
|
|
|
body: message.body
|
|
|
|
createdat: message.createdat
|
|
|
|
actor: message.actor
|
|
|
|
actorname: message.actorname
|
2019-05-10 14:47:26 +00:00
|
|
|
actorid: message.actorid
|
2019-05-09 03:39:02 +00:00
|
|
|
reply: message.reply
|
|
|
|
replytoid: message.replytoid
|
|
|
|
replytoauthor: message.replytoauthor
|
|
|
|
forward: message.forward
|
|
|
|
mention: message.mention
|
|
|
|
like: message.like
|
|
|
|
mediapreview: message.mediapreview
|
|
|
|
mediaurl: message.mediaurl
|
|
|
|
liked: message.liked
|
|
|
|
shared: message.shared
|
2019-05-06 18:19:57 +00:00
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
Label {
|
2019-05-09 04:19:52 +00:00
|
|
|
visible: message != null
|
2019-05-10 18:17:45 +00:00
|
|
|
text: qsTr("Replying to %1").arg(message.name)
|
2019-05-06 18:19:57 +00:00
|
|
|
opacity: 0.3
|
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
TextArea {
|
|
|
|
id: messageArea
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.minimumHeight: 128
|
|
|
|
focus: true
|
|
|
|
selectByMouse: true
|
2019-05-09 04:19:52 +00:00
|
|
|
placeholderText: message != null ? qsTr("Post your reply") : qsTr("What's happening?")
|
2019-05-06 18:19:57 +00:00
|
|
|
wrapMode: TextArea.Wrap
|
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
Label {
|
|
|
|
id: remCharsLabel
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-09 03:37:31 +00:00
|
|
|
font.pointSize: 12
|
2019-05-06 18:19:57 +00:00
|
|
|
text: accountBridge.postSizeLimit - messageArea.text.length
|
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
Button {
|
|
|
|
id: sendButton
|
|
|
|
enabled: remCharsLabel.text >= 0 && messageArea.text.length > 0
|
|
|
|
Layout.alignment: Qt.AlignBottom | Qt.AlignRight
|
|
|
|
highlighted: true
|
2019-05-09 04:19:52 +00:00
|
|
|
text: message != null ? qsTr("Reply") : qsTr("Post")
|
2017-08-29 05:02:56 +00:00
|
|
|
|
2019-05-06 18:19:57 +00:00
|
|
|
onClicked: {
|
|
|
|
popup.close()
|
|
|
|
var msg = messageArea.text
|
2019-05-12 00:49:27 +00:00
|
|
|
var msgid = "";
|
2019-05-09 04:19:52 +00:00
|
|
|
if (message != null) {
|
2019-05-12 00:49:27 +00:00
|
|
|
msgid = message.messageid
|
2019-05-10 18:17:45 +00:00
|
|
|
msg = "@" + message.author + " " + msg
|
2019-05-06 18:19:57 +00:00
|
|
|
}
|
2019-05-12 00:49:27 +00:00
|
|
|
uiBridge.postButton(msgid, msg)
|
2019-05-06 18:19:57 +00:00
|
|
|
messageArea.clear()
|
2017-08-31 14:20:52 +00:00
|
|
|
}
|
2017-08-29 05:02:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|