2017-01-26 21:55:31 +01:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Controls 1.4
|
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
import "qrc:/js/news.js" as Newsjs
|
2017-03-25 23:36:14 +01:00
|
|
|
import "qrc:/js/helper.js" as Helperjs
|
2017-01-26 21:55:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: newsitem
|
|
|
|
width: newsView.width
|
|
|
|
height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
|
|
|
|
|
|
|
property string attending: ""
|
|
|
|
onAttendingChanged: {attendLabel.visible=true;
|
|
|
|
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
|
2017-01-29 17:26:09 +01:00
|
|
|
|
2017-01-26 21:55:31 +01:00
|
|
|
signal replyto(string parent_id)
|
2017-01-29 17:26:09 +01:00
|
|
|
|
2017-03-25 23:36:14 +01:00
|
|
|
function showActivityContacts(contacts){
|
|
|
|
var component = Qt.createComponent("qrc:/qml/newsqml/FriendicaActivities.qml");
|
|
|
|
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
2017-01-26 21:55:31 +01:00
|
|
|
|
2017-01-29 17:26:09 +01:00
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
|
|
|
|
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
|
2017-01-29 17:26:09 +01:00
|
|
|
|
2017-01-26 21:55:31 +01:00
|
|
|
Rectangle{
|
|
|
|
width:newsitem.width
|
|
|
|
height:newsitem.height-1
|
|
|
|
color: (newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: authorcolumn
|
|
|
|
width: 8*mm
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id:profileImage
|
|
|
|
source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url
|
|
|
|
x:1
|
|
|
|
width: 7*mm
|
|
|
|
height: 7*mm
|
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
2017-03-25 23:36:14 +01:00
|
|
|
onClicked:{print(root.currentIndex);
|
|
|
|
try{root.currentIndex=1;
|
|
|
|
friendstab.active=true;
|
|
|
|
root.contactdetailsSignal(newsitemobject.user)} catch (e){Helperjs.showMessage("Error",e,root)}
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id:user_name
|
|
|
|
color: "grey"
|
|
|
|
width:parent.width
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
2017-03-25 23:36:14 +01:00
|
|
|
text: Qt.atob(newsitemobject.user.name)//+forumname
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Column {
|
|
|
|
id:newscolumn
|
|
|
|
width: newsitem.width-8*mm
|
|
|
|
anchors.left: authorcolumn.right
|
|
|
|
|
|
|
|
Flow{
|
|
|
|
id:topFlow
|
|
|
|
spacing: mm
|
|
|
|
width:parent.width
|
|
|
|
Label {
|
|
|
|
id:messageTypeLabel
|
|
|
|
color: "grey"
|
|
|
|
text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source
|
|
|
|
} else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"}
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id:createdAtLabel
|
|
|
|
color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
horizontalAlignment: Label.AlignRight
|
|
|
|
text: dateDiff
|
|
|
|
}
|
|
|
|
Label {
|
|
|
|
id:replytoLabel
|
|
|
|
color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
horizontalAlignment: Label.AlignRight
|
|
|
|
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
|
|
|
}catch(e){" "}
|
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id:newscountLabel
|
|
|
|
visible:((newstabstatus=="Tree")&&(newsitemobject.newscount>1))?true:false
|
|
|
|
color: "grey"
|
|
|
|
height:3.5*mm
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
font.bold: true
|
|
|
|
horizontalAlignment: Label.AlignRight
|
|
|
|
text: try {(newsitemobject.newscount-1)+qsTr(" comments") }catch(e){" "}
|
|
|
|
MouseArea{
|
|
|
|
anchors.fill:parent
|
2017-03-25 23:36:14 +01:00
|
|
|
onClicked: {conversationsymbol.color="black";showConversation(index,newsitemobject)}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
color: "#404040"
|
|
|
|
linkColor: "light green"
|
|
|
|
id: itemMessage
|
|
|
|
textFormat: Text.RichText
|
2017-03-25 23:36:14 +01:00
|
|
|
text:Qt.atob(newsitemobject.statusnet_html)
|
2017-01-26 21:55:31 +01:00
|
|
|
width: newsitem.width-8*mm-2
|
|
|
|
height: implicitHeight
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
onLinkActivated:{
|
|
|
|
Qt.openUrlExternally(link)}
|
|
|
|
}
|
|
|
|
|
2017-03-25 23:36:14 +01:00
|
|
|
Flow{
|
2017-01-29 17:26:09 +01:00
|
|
|
id:friendicaActivities
|
2017-03-25 23:36:14 +01:00
|
|
|
width:parent.width
|
2017-01-26 21:55:31 +01:00
|
|
|
spacing:mm
|
|
|
|
Label{color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
text: friendica_activities.likeText
|
2017-03-25 23:36:14 +01:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: { showActivityContacts(newsitemobject.like)}
|
|
|
|
}
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
Label{color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
text: friendica_activities.dislikeText
|
2017-03-25 23:36:14 +01:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: { showActivityContacts(newsitemobject.dislike)}
|
|
|
|
}
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
Label{color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
text: friendica_activities.attendyesText
|
2017-03-25 23:36:14 +01:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: { showActivityContacts(newsitemobject.attendyes)}
|
|
|
|
}}
|
2017-01-26 21:55:31 +01:00
|
|
|
Label{color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
text: friendica_activities.attendnoText
|
2017-03-25 23:36:14 +01:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: { showActivityContacts(newsitemobject.attendno)}
|
|
|
|
}
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
Label{color: "grey"
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
text: friendica_activities.attendmaybeText
|
2017-03-25 23:36:14 +01:00
|
|
|
MouseArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: { showActivityContacts(newsitemobject.attendmaybe)}
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-03-25 23:36:14 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
Row{
|
|
|
|
CheckBox{
|
|
|
|
id:likeCheckbox
|
|
|
|
height:3*mm
|
|
|
|
width:8*mm
|
|
|
|
visible: (newsitemobject.messagetype==0)? true:false
|
|
|
|
checked:(friendica_activities.self.liked==1)?true:false
|
|
|
|
style: CheckBoxStyle {
|
|
|
|
background: Rectangle {
|
2017-03-25 23:36:14 +01:00
|
|
|
implicitWidth: 6*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
implicitHeight: 3*mm
|
|
|
|
color:"white"
|
|
|
|
}
|
|
|
|
indicator: Rectangle{
|
|
|
|
implicitWidth: 3*mm
|
|
|
|
implicitHeight:3*mm
|
|
|
|
color:control.checked?"yellow":"white"
|
2017-03-25 23:36:14 +01:00
|
|
|
x: 4*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
Text{
|
2017-01-29 17:57:55 +01:00
|
|
|
anchors.centerIn: parent
|
2017-03-25 23:36:14 +01:00
|
|
|
font.pixelSize: 2.5*mm
|
|
|
|
font.family:fontAwesome.name
|
|
|
|
color:control.checked?"black": "grey"
|
|
|
|
text:"\uf118"
|
2017-01-29 17:26:09 +01:00
|
|
|
}}
|
|
|
|
}
|
|
|
|
onClicked: {
|
|
|
|
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 }
|
|
|
|
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root); model.friendica_activities.self.liked=1}}
|
|
|
|
}
|
|
|
|
CheckBox{
|
|
|
|
id: dislikeCheckbox
|
|
|
|
height:3*mm
|
|
|
|
width:8*mm
|
|
|
|
visible: (newsitemobject.messagetype==0)? true:false
|
|
|
|
checked: (friendica_activities.self.disliked==1)?true:false
|
|
|
|
style: CheckBoxStyle {
|
|
|
|
background: Rectangle {
|
2017-03-25 23:36:14 +01:00
|
|
|
implicitWidth: 6*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
implicitHeight:3*mm
|
|
|
|
color:"white"
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
indicator: Rectangle{
|
|
|
|
implicitWidth: 3*mm
|
|
|
|
implicitHeight:3*mm
|
|
|
|
color:control.checked?"yellow":"white"
|
2017-03-25 23:36:14 +01:00
|
|
|
x:4*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
Text{
|
2017-01-29 17:57:55 +01:00
|
|
|
anchors.centerIn: parent
|
2017-03-25 23:36:14 +01:00
|
|
|
font.pixelSize: 2.5*mm
|
|
|
|
font.family:fontAwesome.name
|
|
|
|
color:control.checked?"black": "grey"
|
|
|
|
text: "\uf119"
|
2017-01-29 17:26:09 +01:00
|
|
|
}}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
onClicked: {
|
|
|
|
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0}
|
|
|
|
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root); model.friendica_activities.self.disliked=1}}
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id:favoritedCheckbox
|
|
|
|
visible:(newsitemobject.messagetype==0)
|
2017-03-25 23:36:14 +01:00
|
|
|
width: 7*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
style: CheckBoxStyle {
|
|
|
|
background: Rectangle {
|
|
|
|
implicitWidth: 6*mm
|
|
|
|
implicitHeight:3*mm
|
|
|
|
color:"transparent"
|
|
|
|
}
|
|
|
|
indicator:Rectangle{
|
|
|
|
x:3*mm
|
|
|
|
width: 3*mm
|
|
|
|
implicitHeight:3*mm
|
|
|
|
Text{
|
2017-03-25 23:36:14 +01:00
|
|
|
color: control.checked?"black":"grey"
|
|
|
|
font.pixelSize: 2.5*mm
|
|
|
|
text:"\uf005"
|
2017-01-29 17:26:09 +01:00
|
|
|
}}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
checked:(newsitemobject.favorited>0)
|
|
|
|
onClicked:{
|
|
|
|
if(favoritedCheckbox.checkedState==Qt.Checked){
|
|
|
|
Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
|
|
|
|
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
|
|
|
|
Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Rectangle{
|
2017-03-25 23:36:14 +01:00
|
|
|
width: 7*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
height: 3*mm
|
|
|
|
color:"transparent"
|
|
|
|
Text{
|
|
|
|
id:newsmenusymbol
|
|
|
|
color: "grey"
|
|
|
|
anchors.centerIn: parent
|
|
|
|
font.pixelSize: 2*mm
|
|
|
|
font.bold: true
|
|
|
|
text: "\u22EE"
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
MouseArea{
|
2017-01-26 21:55:31 +01:00
|
|
|
anchors.fill:parent
|
|
|
|
onClicked: {newsmenu.popup()}}
|
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
Rectangle{
|
2017-03-25 23:36:14 +01:00
|
|
|
width: 7*mm
|
2017-01-29 17:26:09 +01:00
|
|
|
height: 3*mm
|
2017-03-25 23:36:14 +01:00
|
|
|
visible:newstab.newstabstatus!="Conversation"
|
2017-01-29 17:26:09 +01:00
|
|
|
color:"transparent"
|
|
|
|
Text{
|
|
|
|
id:conversationsymbol
|
|
|
|
color: "grey"
|
|
|
|
anchors.centerIn: parent
|
2017-03-25 23:36:14 +01:00
|
|
|
font.pixelSize: 2.5*mm
|
|
|
|
font.family: fontAwesome.name
|
|
|
|
text: "\uf086"
|
2017-01-29 17:26:09 +01:00
|
|
|
}
|
|
|
|
MouseArea{
|
2017-01-26 21:55:31 +01:00
|
|
|
anchors.fill:parent
|
2017-03-25 23:36:14 +01:00
|
|
|
onClicked: { conversationsymbol.color="black";showConversation(index,newsitemobject)}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
}
|
|
|
|
Label{
|
2017-01-26 21:55:31 +01:00
|
|
|
id:attendLabel
|
2017-01-29 17:26:09 +01:00
|
|
|
//visible: false
|
2017-01-26 21:55:31 +01:00
|
|
|
color: "grey"
|
|
|
|
height:3.5*mm
|
|
|
|
font.pixelSize: 1.5*mm
|
|
|
|
horizontalAlignment: Label.AlignRight
|
2017-01-29 17:26:09 +01:00
|
|
|
text: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):""
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
Menu {
|
2017-01-29 17:26:09 +01:00
|
|
|
id:newsmenu
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Reply")
|
|
|
|
onTriggered: {
|
|
|
|
var directmessage=0;
|
|
|
|
if (newsitemobject.messagetype==1){ directmessage=1}
|
|
|
|
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id,"login":root.login,"directmessage":directmessage}});
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
MenuItem {
|
|
|
|
text: qsTr("DM")
|
|
|
|
onTriggered: {
|
|
|
|
root.directmessageSignal(newsitemobject.user.screen_name);
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Repost")
|
|
|
|
onTriggered: {
|
|
|
|
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
|
|
|
|
print(reply)})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Conversation")
|
2017-03-25 23:36:14 +01:00
|
|
|
onTriggered: showConversation(index,newsitemobject)
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
|
2017-01-29 17:26:09 +01:00
|
|
|
Menu{
|
|
|
|
title: qsTr("Attending")
|
|
|
|
MenuItem{
|
|
|
|
text:qsTr("yes")
|
2017-01-26 21:55:31 +01:00
|
|
|
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){
|
2017-01-29 17:26:09 +01:00
|
|
|
model.friendica_activities.self.attending="yes";attending="yes"})
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
}
|
2017-01-29 17:26:09 +01:00
|
|
|
MenuItem{text:qsTr("maybe")
|
|
|
|
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){
|
|
|
|
model.friendica_activities.self.attending="maybe";attending="maybe"})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MenuItem{text:qsTr("no")
|
|
|
|
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){
|
|
|
|
model.friendica_activities.self.attending="no";attending="no"})}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-29 17:26:09 +01:00
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Delete")
|
|
|
|
onTriggered: {
|
|
|
|
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
|
|
|
|
newsModel.remove(index)})
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|