2018-02-19 22:36:00 +01:00
// This file is part of Friendiqa
2018-11-09 22:06:13 +01:00
// https://git.friendi.ca/lubuwest/Friendiqa
2020-05-24 21:14:23 +02:00
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
2018-02-19 22:36:00 +01:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2017-01-26 21:55:31 +01:00
import QtQuick 2.0
2020-05-24 21:14:23 +02:00
import QtQuick . Controls 2.12
2017-01-26 21:55:31 +01:00
import "qrc:/js/news.js" as Newsjs
2017-03-25 23:36:14 +01:00
import "qrc:/js/helper.js" as Helperjs
2018-04-11 21:50:43 +02:00
import "qrc:/qml/genericqml"
2017-01-26 21:55:31 +01:00
Item {
id: newsitem
2023-05-24 21:40:26 +02:00
width: newsitemobject . hasOwnProperty ( "indent" ) && newsitemobject . indent > 0 ? parent.width: newsitem . ListView . view . width
height: toprow . height + friendicaActivities . height + controlrow . height + conversationColumn . height + 1
2018-04-11 21:50:43 +02:00
property int itemindex: index
2020-01-27 21:53:51 +01:00
property var newsitemobject: model . newsitemobject
2017-01-26 21:55:31 +01:00
property string attending: ""
2020-05-24 21:14:23 +02:00
property var friendica_activities_view: getActivitiesView ( model . newsitemobject )
2017-01-26 21:55:31 +01:00
onAttendingChanged: { attendLabel . visible = true ;
2021-05-12 21:41:34 +02:00
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-29 17:26:09 +01:00
}
2018-07-01 15:09:21 +02:00
2020-01-27 21:53:51 +01:00
function pushConversation ( ) {
if ( model . newsitemobject . hasOwnProperty ( "currentconversation" ) ) {
2021-05-12 21:41:34 +02:00
rootstackView . push ( "qrc:/qml/newsqml/Conversation.qml" , { "news" : model . newsitemobject . currentconversation } ) }
else { rootstackView . push ( "qrc:/qml/newsqml/Conversation.qml" ) } ;
2023-07-27 21:52:16 +02:00
expectScreenUpdate = true ;
2020-01-27 21:53:51 +01:00
showConversation ( index , newsitemobject )
}
2021-10-28 21:56:00 +02:00
Rectangle { width: newsitem . width ; height: 1 ; anchors.bottom: newsitem . bottom ;
2023-07-27 21:52:16 +02:00
color: osSettings . backgroundDimColor
2021-10-28 21:56:00 +02:00
}
2017-01-29 17:26:09 +01:00
2017-01-26 21:55:31 +01:00
Rectangle {
2021-05-12 21:41:34 +02:00
width: newsitem . width
height: newsitem . height - 1
2023-07-27 21:52:16 +02:00
color: osSettings . backgroundColor
2017-01-26 21:55:31 +01:00
2021-05-12 21:41:34 +02:00
Column {
2022-03-01 21:59:21 +01:00
id:toprow
2021-05-12 21:41:34 +02:00
width: newsitemobject . hasOwnProperty ( "indent" ) ? newsitem . width - ( newsitem . width / 20 * ( newsitemobject . indent + 1 ) ) : newsitem . width //-8*mm
x: newsitemobject . hasOwnProperty ( "indent" ) ? newsitem . width / 20 * ( newsitemobject . indent ) : 0
2021-05-18 21:01:32 +02:00
height: newsitemobject . nsfw ? 5 * mm: Math . min ( implicitHeight , 3 / 4 * root . height )
2021-05-12 21:41:34 +02:00
clip: true
Item { id:itemHeader
height: Math . max ( profileImage . height + mm , topFlow . implicitHeight + mm )
width: parent . width
MouseArea {
anchors.fill: parent
onClicked: {
showContact ( newsitemobject . user ) }
2020-01-27 21:53:51 +01:00
}
2021-05-12 21:41:34 +02:00
Image {
id:profileImage
source: ( ( newsitemobject . user . profile_image != "" ) && ( typeof ( newsitemobject . user . profile_image ) == "string" ) ) ? "file://" + newsitemobject.user.profile_image : newsitemobject . user . profile_image_url
x: 1
y: 1
width: 2 * root . fontFactor * osSettings . bigFontSize
height: 2 * root . fontFactor * osSettings . bigFontSize
//radius:mm
onStatusChanged: if ( profileImage . status == Image . Error ) { source = "qrc:/images/defaultcontact.jpg" }
2017-01-26 21:55:31 +01:00
}
2021-05-12 21:41:34 +02:00
Flow {
id:topFlow
spacing: 0.5 * mm
width: parent . width - 8 * mm
anchors.left: profileImage . right
anchors.margins: mm
Label {
id:user_name
width: parent . width
font.bold: true
font.pointSize: osSettings . systemFontSize
wrapMode: Text . WrapAtWordBoundaryOrAnywhere
text: newsitemobject . user . name + " (@" + newsitemobject . user . screen_name + ")" + newsitemobject . forumname
}
Label {
id:messageTypeLabel
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
text: if ( newsitemobject . messagetype == 1 ) { qsTr ( "Direct Message" ) } else if ( newsitemobject . messagetype == 2 ) { " Notification" } else { qsTr ( "Source: " ) + newsitemobject . source }
font.pointSize: 0.6 * osSettings . systemFontSize
}
Label {
id:createdAtLabel
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
font.pointSize: 0.6 * osSettings . systemFontSize
horizontalAlignment: Label . AlignRight
text: " \u00B7 " + getDateDiffString ( newsitemobject . dateDiff ) + " " + qsTr ( "ago" )
}
Label {
id:replytoLabel
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
font.pointSize: 0.6 * osSettings . systemFontSize
font.family: "Noto Sans"
horizontalAlignment: Label . AlignRight
2022-03-13 21:22:08 +01:00
text: ( newsitemobject . reply_user != false && typeof ( newsitemobject . reply_user ) != "undefined" ) ? " \u00B7 " + qsTr ( "In reply to " ) + newsitemobject.reply_user.screen_name: " "
2021-05-12 21:41:34 +02:00
}
2020-11-25 21:40:17 +01:00
}
2017-01-26 21:55:31 +01:00
}
2021-05-12 21:41:34 +02:00
MouseArea { id: itemBody
2020-11-25 21:40:17 +01:00
width: toprow . width - 2
2021-05-12 21:41:34 +02:00
height: itemMessage . height
2021-10-28 21:56:00 +02:00
onClicked: { pushConversation ( ) }
2021-05-12 21:41:34 +02:00
Text {
2023-07-27 21:52:16 +02:00
color: osSettings . primaryTextColor
linkColor: osSettings . accentColor
2021-05-12 21:41:34 +02:00
id: itemMessage
textFormat: Text . RichText
font.family: "Noto Sans"
font.pointSize: osSettings . systemFontSize
text: newsitemobject . statusnet_html
width: toprow . width - 2
height: implicitHeight
wrapMode: Text . Wrap
clip: true
2022-03-01 21:59:21 +01:00
onLinkActivated: {
if ( link . startsWith ( root . login . server + "\/search\?tag=" ) ) {
newstab . newstabstatus = "Search" ;
root . searchSignal ( link . substring ( root . login . server . length + 12 , link . length ) )
2021-05-12 21:41:34 +02:00
}
2022-03-01 21:59:21 +01:00
else { Qt . openUrlExternally ( link ) }
}
Component.onCompleted: {
2021-05-12 21:41:34 +02:00
if ( newsitemobject . imageAttachmentList . length > 0 ) {
if ( newsitemobject . imageAttachmentList [ 0 ] . mimetype . substring ( 0 , 5 ) == "image" ) {
2020-11-25 21:40:17 +01:00
var component = Qt . createComponent ( "qrc:/qml/newsqml/NewsImage.qml" ) ;
2021-05-12 21:41:34 +02:00
var imageQml = component . createObject ( toprow , { "source" : newsitemobject . imageAttachmentList [ 0 ] . url } ) ;
2020-11-25 21:40:17 +01:00
}
2019-06-25 20:59:10 +02:00
}
2020-01-27 21:53:51 +01:00
2021-05-12 21:41:34 +02:00
if ( newsitemobject . videoAttachmentList . length > 0 ) {
var component = Qt . createComponent ( "qrc:/qml/newsqml/NewsVideo.qml" ) ;
//var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
var videoQml = component . createObject ( toprow , { "attachment" : newsitemobject . videoAttachmentList [ 0 ] } ) ;
}
2020-01-27 21:53:51 +01:00
2021-05-12 21:41:34 +02:00
if ( newsitemobject . hasOwnProperty ( "lastcomment" ) ) {
var moreComponent = Qt . createComponent ( "qrc:/qml/newsqml/MoreComments.qml" ) ;
var conversationQml = moreComponent . createObject ( conversationColumn , { "comments" : newsitemobject . newscount - 1 } ) ;
var commentComponent = Qt . createComponent ( "qrc:/qml/newsqml/Newsitem.qml" ) ;
var conversationQml = commentComponent . createObject ( conversationColumn , { "newsitemobject" : newsitemobject . lastcomment } ) ;
}
2020-11-25 21:40:17 +01:00
}
2021-05-12 21:41:34 +02:00
} }
}
2020-11-25 21:40:17 +01:00
BlueButton {
2021-05-12 21:41:34 +02:00
width: newsitem . width - 2
2020-11-25 21:40:17 +01:00
height: 5 * mm
2022-03-01 21:59:21 +01:00
anchors.bottom: toprow . bottom
visible: toprow . implicitHeight > 3 / 4 * root . height || newsitemobject . nsfw
2020-11-25 21:40:17 +01:00
text: "\uf078"
2023-07-27 21:52:16 +02:00
fontColor: osSettings . secondaryTextColor
2020-11-25 21:40:17 +01:00
border.color: "transparent"
2023-07-27 21:52:16 +02:00
color: osSettings . backgroundColor
2022-03-01 21:59:21 +01:00
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
2023-07-27 21:52:16 +02:00
// GradientStop { position: 0.5; color: osSettings.backgroundDimColor}
2022-03-01 21:59:21 +01:00
// }
2020-11-25 21:40:17 +01:00
radius: 0
onClicked: {
if ( text == "\uf078" ) {
2021-05-12 21:41:34 +02:00
toprow . height = toprow . implicitHeight + 6 * mm ; text = "\uf077"
2020-11-25 21:40:17 +01:00
} else {
2021-05-12 21:41:34 +02:00
toprow . height = Math . min ( toprow . implicitHeight , 3 / 4 * root . height ) ;
2020-11-25 21:40:17 +01:00
text = "\uf078" ;
newsView . positionViewAtIndex ( index , ListView . Beginning ) ;
}
}
}
2021-05-12 21:41:34 +02:00
// Bottom row for activities
Flow {
id:friendicaActivities
anchors.top: toprow . bottom
width: parent . width
spacing: mm
2017-05-11 22:15:34 +02:00
2023-07-27 21:52:16 +02:00
Label { color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
height: 3.5 * mm
font.pointSize: 0.75 * osSettings . systemFontSize
2022-03-01 21:59:21 +01:00
text: newsitemobject . hasOwnProperty ( "isLastComment" ) ? "" : friendica_activities_view . likeText
2021-05-12 21:41:34 +02:00
MouseArea {
anchors.fill: parent
onClicked: { showActivityContacts ( newsitemobject . friendica_activities . like ) }
}
2020-11-25 21:40:17 +01:00
}
2023-07-27 21:52:16 +02:00
Label { color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
height: 3.5 * mm
font.pointSize: 0.75 * osSettings . systemFontSize
2022-03-01 21:59:21 +01:00
text: newsitemobject . hasOwnProperty ( "isLastComment" ) ? "" : friendica_activities_view . dislikeText
2021-05-12 21:41:34 +02:00
MouseArea {
anchors.fill: parent
onClicked: { showActivityContacts ( newsitemobject . friendica_activities . dislike ) }
}
2020-11-25 21:40:17 +01:00
}
2023-07-27 21:52:16 +02:00
Label { color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
height: 3.5 * mm
font.pointSize: 0.75 * osSettings . systemFontSize
2022-03-01 21:59:21 +01:00
text: newsitemobject . hasOwnProperty ( "isLastComment" ) ? "" : friendica_activities_view . attendyesText
2021-05-12 21:41:34 +02:00
MouseArea {
anchors.fill: parent
onClicked: { showActivityContacts ( newsitemobject . friendica_activities . attendyes ) }
} }
2023-07-27 21:52:16 +02:00
Label { color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
height: 3.5 * mm
font.pointSize: 0.75 * osSettings . systemFontSize
2022-03-01 21:59:21 +01:00
text: newsitemobject . hasOwnProperty ( "isLastComment" ) ? "" : friendica_activities_view . attendnoText
2021-05-12 21:41:34 +02:00
MouseArea {
anchors.fill: parent
onClicked: { showActivityContacts ( newsitemobject . friendica_activities . attendno ) }
}
2020-01-27 21:53:51 +01:00
}
2023-07-27 21:52:16 +02:00
Label { color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
height: 3.5 * mm
font.pointSize: 0.75 * osSettings . systemFontSize
2022-03-01 21:59:21 +01:00
text: newsitemobject . hasOwnProperty ( "isLastComment" ) ? "" : friendica_activities_view . attendmaybeText
2021-05-12 21:41:34 +02:00
MouseArea {
anchors.fill: parent
onClicked: { showActivityContacts ( newsitemobject . friendica_activities . attendmaybe ) }
}
}
Label {
id:attendLabel
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
height: 3.5 * mm
font.pointSize: 0.75 * osSettings . systemFontSize
horizontalAlignment: Label . AlignRight
text: ( newsitemobject . friendica_activities_view . self . attending ) ? ( qsTr ( "Attending: " ) + qsTr ( newsitemobject . friendica_activities_view . self . attending ) ) : ""
2020-01-27 21:53:51 +01:00
}
}
2020-11-25 21:40:17 +01:00
2021-05-12 21:41:34 +02:00
//Bottom row for buttons
Row { id:controlrow
anchors.top: friendicaActivities . bottom
2023-02-09 21:39:43 +01:00
height: 1.5 * root . fontFactor * osSettings . bigFontSize
2021-05-12 21:41:34 +02:00
CheckBox {
id:likeCheckbox
2022-03-01 21:59:21 +01:00
width: newsitem . width / 5
2021-05-12 21:41:34 +02:00
height: parent . height
visible: ( ( newsitemobject . messagetype == 0 ) || ( newsitemobject . messagetype == 3 ) ) ? true: false
checked: ( model . newsitemobject . friendica_activities_view . self . liked == 1 ) ? true: false
indicator: Rectangle {
2023-02-09 21:39:43 +01:00
height: parent . height
2022-03-01 21:59:21 +01:00
implicitWidth: newsitem . width / 5
2021-05-12 21:41:34 +02:00
implicitHeight: root . fontFactor * osSettings . bigFontSize
2021-10-28 21:56:00 +02:00
color: "transparent"
2021-05-12 21:41:34 +02:00
Text {
anchors.centerIn: parent
2023-02-09 21:39:43 +01:00
font.pointSize: osSettings . bigFontSize
2021-05-12 21:41:34 +02:00
font.family: fontAwesome . name
2023-07-27 21:52:16 +02:00
color: likeCheckbox . checked ? osSettings.primaryTextColor: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
text: likeCheckbox . checked ? "\uf118" + "!" : "\uf118"
}
2017-11-07 21:57:40 +01:00
}
2021-05-12 21:41:34 +02:00
onClicked: {
if ( likeCheckbox . checked == true ) { Newsjs . like ( root . login , root . db , 1 , "like" , newsitemobject . id , root ) ; dislikeCheckbox . checked = false ;
newsitemobject . friendica_activities_view . self . liked = 1 ;
newsitem . ListView . view . model . set ( index , { "newsitemobject" : newsitemobject } ) ;
}
else { Newsjs . like ( root . login , root . db , 0 , "like" , newsitemobject . id , root ) ;
newsitemobject . friendica_activities_view . self . liked = 0 ;
newsitem . ListView . view . model . set ( index , { "newsitemobject" : newsitemobject } ) ;
} }
2020-01-27 21:53:51 +01:00
}
2021-05-12 21:41:34 +02:00
CheckBox {
id: dislikeCheckbox
2022-03-01 21:59:21 +01:00
width: newsitem . width / 5
2021-05-12 21:41:34 +02:00
height: parent . height
visible: ( ( newsitemobject . messagetype == 0 ) || ( newsitemobject . messagetype == 3 ) ) ? true: false
checked: ( newsitemobject . friendica_activities_view . self . disliked == 1 ) ? true: false
indicator: Rectangle {
2023-02-09 21:39:43 +01:00
height: parent . height
2022-03-01 21:59:21 +01:00
implicitWidth: newsitem . width / 5
2021-05-12 21:41:34 +02:00
implicitHeight: root . fontFactor * osSettings . bigFontSize
2021-10-28 21:56:00 +02:00
color: "transparent"
2021-05-12 21:41:34 +02:00
Text {
anchors.centerIn: parent
2023-02-09 21:39:43 +01:00
font.pointSize: osSettings . bigFontSize
2021-05-12 21:41:34 +02:00
font.family: fontAwesome . name
2023-07-27 21:52:16 +02:00
color: dislikeCheckbox . checked ? osSettings.primaryTextColor: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
text: dislikeCheckbox . checked ? "\uf119" + "!" : "\uf119"
}
2020-05-24 21:14:23 +02:00
}
2021-05-12 21:41:34 +02:00
onClicked: {
if ( dislikeCheckbox . checked == true ) { Newsjs . like ( root . login , root . db , 1 , "dislike" , newsitemobject . id , root ) ; likeCheckbox . checked = false ;
newsitemobject . friendica_activities_view . self . disliked = 1 ;
newsitem . ListView . view . model . set ( index , { "newsitemobject" : newsitemobject } ) ;
}
else { Newsjs . like ( root . login , root . db , 0 , "dislike" , newsitemobject . id , root ) ;
newsitemobject . friendica_activities_view . self . disliked = 0 ;
newsitem . ListView . view . model . set ( index , { "newsitemobject" : newsitemobject } ) ;
} }
}
2022-03-13 21:22:08 +01:00
CheckBox {
id:favoritedCheckbox
visible: ( ( newsitemobject . messagetype == 0 ) || ( newsitemobject . messagetype == 3 ) )
width: newsitem . width / 5
height: parent . height
indicator: Rectangle {
2023-02-09 21:39:43 +01:00
height: parent . height
2022-03-13 21:22:08 +01:00
implicitWidth: newsitem . width / 5
implicitHeight: root . fontFactor * osSettings . bigFontSize
color: "transparent"
Text {
anchors.centerIn: parent
2023-02-09 21:39:43 +01:00
font.pointSize: osSettings . bigFontSize
2022-03-13 21:22:08 +01:00
font.family: fontAwesome . name
2023-07-27 21:52:16 +02:00
color: favoritedCheckbox . checked ? osSettings.primaryTextColor: osSettings . secondaryTextColor
2022-03-13 21:22:08 +01:00
text: "\uf005"
}
}
checked: ( newsitemobject . favorited > 0 )
onClicked: {
if ( favoritedCheckbox . checkState == Qt . Checked ) {
Newsjs . favorite ( login , true , newsitemobject . id , root ) ; model . newsitemobject . favorited = 1 }
else if ( favoritedCheckbox . checkState == Qt . Unchecked ) {
Newsjs . favorite ( login , false , newsitemobject . id , root ) ; model . newsitemobject . favorited = 0 }
}
}
2022-03-01 21:59:21 +01:00
Rectangle {
width: newsitem . width / 5
2021-05-12 21:41:34 +02:00
height: parent . height
2022-03-01 21:59:21 +01:00
visible: ( newsitemobject . messagetype !== 2 )
color: "transparent"
Text {
id:replysymbol
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2022-03-01 21:59:21 +01:00
anchors.centerIn: parent
2023-02-09 21:39:43 +01:00
font.pointSize: osSettings . bigFontSize
2022-03-01 21:59:21 +01:00
font.family: fontAwesome . name
text: "\uf112"
2017-01-26 21:55:31 +01:00
}
2022-03-01 21:59:21 +01:00
MouseArea {
anchors.fill: parent
onClicked: {
2023-07-27 21:52:16 +02:00
openMessageSend ( "reply" , newsitemobject )
2022-03-01 21:59:21 +01:00
}
2023-07-27 21:52:16 +02:00
// var directmessage=0;
// if (newsitemobject.messagetype==1){ directmessage=1}
// var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
// var conversation;
// if (newsitem.ListView.view==null){conversation=true}
// else if (newsitem.ListView.view.viewtype=="conversation"){
// conversation=true
// newsitem.ListView.view.currentIndex=itemindex
// }
// else{
// conversation=false;
// newsitem.ListView.view.currentIndex=itemindex
// };
// var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
// }
2020-05-24 21:14:23 +02:00
}
2021-05-12 21:41:34 +02:00
}
Rectangle {
2022-03-01 21:59:21 +01:00
width: newsitem . width / 5
2021-05-12 21:41:34 +02:00
height: parent . height
visible: ( newsitemobject . messagetype !== 2 )
color: "transparent"
2020-01-27 21:53:51 +01:00
Text {
2021-05-12 21:41:34 +02:00
id:newsmenusymbol
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2020-01-27 21:53:51 +01:00
anchors.centerIn: parent
2023-02-09 21:39:43 +01:00
font.pointSize: osSettings . bigFontSize
2020-01-27 21:53:51 +01:00
font.family: fontAwesome . name
2021-05-12 21:41:34 +02:00
text: "\uf142"
2020-01-27 21:53:51 +01:00
}
2021-05-12 21:41:34 +02:00
MouseArea {
anchors.fill: parent
onClicked: { newsmenu . popup ( ) } }
2017-11-07 21:57:40 +01:00
}
2017-01-26 21:55:31 +01:00
}
2021-05-12 21:41:34 +02:00
Menu {
id:newsmenu
2021-10-28 21:56:00 +02:00
width: 10 * root . fontFactor * osSettings . systemFontSize
2019-06-25 20:59:10 +02:00
delegate: MenuItem {
contentItem: Text {
2021-05-12 21:41:34 +02:00
font.pointSize: osSettings . systemFontSize
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2019-06-25 20:59:10 +02:00
text: parent . text
}
}
2022-03-01 21:59:21 +01:00
onAboutToShow: { if ( newsitemobject . hasOwnProperty ( "external_url" ) ) {
insertAction ( 4 , externalAction ) }
2017-01-29 17:26:09 +01:00
}
2021-05-12 21:41:34 +02:00
Action {
text: qsTr ( "Repost" )
onTriggered: {
Newsjs . retweetNews ( root . login , db , newsitemobject . id , root , function ( reply ) {
Helperjs . showMessage ( "Repost" , qsTr ( "Success!" ) , root )
} )
}
2017-01-26 21:55:31 +01:00
}
2023-02-09 21:39:43 +01:00
Action {
text: qsTr ( "Block contact" )
onTriggered: {
var component = Qt . createComponent ( "qrc:/qml/newsqml/BlockUser.qml" ) ;
var userblockdialog = component . createObject ( root , { "newsitem" : newsitemobject } ) ;
userblockdialog . open ( )
}
}
Action {
text: qsTr ( "Report contact" )
onTriggered: {
var component = Qt . createComponent ( "qrc:/qml/newsqml/ReportUser.qml" ) ;
var userreportdialog = component . createObject ( root , { "newsitem" : newsitemobject } ) ;
userreportdialog . open ( )
}
}
2021-05-12 21:41:34 +02:00
Action {
text: qsTr ( "Conversation" )
onTriggered: {
pushConversation ( ) ;
}
2017-01-29 17:26:09 +01:00
}
2022-03-01 21:59:21 +01:00
Action {
text: qsTr ( "DM" )
onTriggered: {
root . directmessageSignal ( newsitemobject . user . screen_name ) ;
}
}
Action {
text: qsTr ( "Bookmark" )
onTriggered: {
if ( model . newsitemobject . favorited == 0 ) {
Newsjs . favorite ( login , true , newsitemobject . id , root ) ; model . newsitemobject . favorited = 1 }
else if ( model . newsitemobject . favorited == 1 ) {
Newsjs . favorite ( login , false , newsitemobject . id , root ) ; model . newsitemobject . favorited = 0 }
}
}
2023-02-09 21:39:43 +01:00
Action {
text: qsTr ( "Calendar Entry" )
onTriggered: {
rootstack . currentIndex = 3 ;
bar . currentIndex = 3 ;
eventcreateSignal ( newsitemobject ) ;
}
}
2021-05-12 21:41:34 +02:00
Menu {
title: qsTr ( "Attending" )
2021-10-28 21:56:00 +02:00
width: 10 * root . fontFactor * osSettings . systemFontSize
2021-05-12 21:41:34 +02:00
delegate: MenuItem {
contentItem: Text {
font.pointSize: osSettings . systemFontSize
2023-07-27 21:52:16 +02:00
color: osSettings . secondaryTextColor
2021-05-12 21:41:34 +02:00
text: parent . text
}
}
Action {
text: qsTr ( "yes" )
onTriggered: { Newsjs . attend ( root . login , db , "yes" , newsitemobject . id , root , function ( ) {
model . newsitemobject . friendica_activities_view . self . attending = "yes" ; attending = "yes" } )
}
}
Action { text: qsTr ( "maybe" )
onTriggered: { Newsjs . attend ( root . login , db , "maybe" , newsitemobject . id , root , function ( ) {
model . newsitemobject . friendica_activities_view . self . attending = "maybe" ; attending = "maybe" } )
}
}
Action { text: qsTr ( "no" )
onTriggered: { Newsjs . attend ( root . login , db , "no" , newsitemobject . id , root , function ( ) {
model . newsitemobject . friendica_activities_view . self . attending = "no" ; attending = "no" } ) }
}
2020-11-25 21:40:17 +01:00
}
2021-05-12 21:41:34 +02:00
Action {
text: qsTr ( "Delete" )
onTriggered: {
Newsjs . deleteNews ( root . login , root . db , newsitemobject . id , newsitemobject . messagetype , root , function ( reply ) {
2023-02-09 21:39:43 +01:00
var msg = { 'deleteId' : index , 'model' : newsitem . ListView . view . model } ;
2021-05-12 21:41:34 +02:00
newsWorker . sendMessage ( msg ) ;
} )
}
}
}
Column {
id:conversationColumn
anchors.top: controlrow . bottom
width: newsitem . width
}
2020-01-27 21:53:51 +01:00
}
2022-03-01 21:59:21 +01:00
Action { id:externalAction
text: qsTr ( "External" )
onTriggered: { Qt . openUrlExternally ( newsitemobject . external_url ) }
}
2020-01-27 21:53:51 +01:00
}