version v0.6
This commit is contained in:
parent
bdc28e632e
commit
8482bde3ed
86 changed files with 7064 additions and 3208 deletions
|
@ -33,154 +33,290 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.12
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
|
||||
Page {
|
||||
id:contactList
|
||||
color: "white"
|
||||
property var contact:({})
|
||||
property string profileimagesource:contact.profile_image
|
||||
ListView {
|
||||
id: contactView
|
||||
x:mm
|
||||
y:9*mm
|
||||
width: contactList.width-4*mm
|
||||
height:contactList.height-10*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
header: contactHeader
|
||||
model: contactModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
||||
//function backRequested(){pageStack.pop()}
|
||||
|
||||
function getDateDiffString (seconds){
|
||||
var timestring="";
|
||||
if (seconds<60) {timestring= Math.round(seconds) + " " +qsTr("seconds");}
|
||||
else if (seconds<90){timestring= Math.round(seconds/60) + " " +qsTr("minute") ;}
|
||||
else if (seconds<3600){timestring= Math.round(seconds/60) + " " +qsTr("minutes");}
|
||||
else if (seconds<5400){timestring= Math.round(seconds/3600) + " " +qsTr("hour");}
|
||||
else if (seconds<86400){timestring= Math.round(seconds/3600) + " " +qsTr("hours");}
|
||||
else if (seconds<129600){timestring= Math.round(seconds/86400) + " " +qsTr("day");}
|
||||
else if (seconds<3888000){timestring= Math.round(seconds/86400) + " " +qsTr("days");}
|
||||
else if (seconds<5832000){timestring= Math.round(seconds/3888000) + " " +qsTr("month");}
|
||||
else if (seconds<69984000){timestring= Math.round(seconds/3888000) + " " +qsTr("months");}
|
||||
else {timestring= Math.round(seconds/46656000) + " " + qsTr("years");}
|
||||
|
||||
return timestring;
|
||||
}
|
||||
|
||||
function getActivitiesView(newsitemobject){
|
||||
var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={};
|
||||
try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){
|
||||
if (newsitemobject.friendica_activities.like.length>0){
|
||||
if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")}
|
||||
else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.dislike.length>0){
|
||||
if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")}
|
||||
else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.attendyes.length>0){
|
||||
if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")}
|
||||
else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.attendno.length>0){
|
||||
if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")}
|
||||
else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.attendmaybe.length>0){
|
||||
if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")}
|
||||
else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")}
|
||||
}
|
||||
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
|
||||
}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
|
||||
return {likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText}
|
||||
}
|
||||
|
||||
function showConversation(conversationIndex,newsitemobject){
|
||||
if(newsitemobject.messagetype==0 || newsitemobject.messagetype==3){
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/conversation/show");
|
||||
xhr.setParam("id",newsitemobject.id)
|
||||
xhr.get();
|
||||
}
|
||||
else{
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/direct_messages/conversation");
|
||||
xhr.setParam("uri",newsitemobject.statusnet_conversation_id)
|
||||
xhr.get();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {
|
||||
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
|
||||
root.onNewContactsChanged(root.newContacts);
|
||||
Newsjs.storeNews(login,db,root.news,root)
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: contactView
|
||||
x:mm
|
||||
y:4*root.fontFactor*osSettings.bigFontSize
|
||||
width: contactList.width-2*mm
|
||||
height:contactList.height-7*root.fontFactor*osSettings.bigFontSize
|
||||
clip: true
|
||||
spacing: 0
|
||||
property string viewtype: "conversation"
|
||||
header: contactHeader
|
||||
model: contactModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: contactBusy
|
||||
anchors.centerIn:parent
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: true
|
||||
}
|
||||
id: contactBusy
|
||||
anchors.centerIn:parent
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: true
|
||||
}
|
||||
|
||||
Component { id: contactHeader
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
color:"white"
|
||||
width:contactView.width
|
||||
height: profileImage.height+namelabel.height+detailtext.height+7*mm
|
||||
//height: wrapper.height
|
||||
property var createdAtDate: new Date(contact.created_at)
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
Component { id: contactHeader
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
color:"white"
|
||||
width:contactView.width
|
||||
height: contactView.width<35*root.fontFactor*osSettings.systemFontSize?(profileImage.height+namelabel.height+detailtext.height+7*mm):Math.max(profileImage.height,(buttonflow.height+namelabel.height+detailtext.height))+7*mm
|
||||
//height: wrapper.height
|
||||
property var createdAtDate: new Date(contact.created_at)
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
|
||||
Image {
|
||||
id: profileImage
|
||||
x:mm
|
||||
y:mm
|
||||
width: contactView.width/2
|
||||
height:width
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
Connections{
|
||||
target:contactList
|
||||
onProfileimagesourceChanged:profileImage.source=profileimagesource
|
||||
}
|
||||
}
|
||||
Column{id:buttoncolumn
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: mm
|
||||
y: mm
|
||||
spacing:4
|
||||
Image {
|
||||
id: profileImage
|
||||
x:mm
|
||||
y:mm
|
||||
width: Math.min(15*root.fontFactor*osSettings.bigFontSize,contactView.width/2) //contactView.width/2
|
||||
height:width
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
Connections{
|
||||
target:contactList
|
||||
onProfileimagesourceChanged:profileImage.source=profileimagesource
|
||||
}
|
||||
}
|
||||
Flow{id:buttonflow
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: mm
|
||||
width: contactView.width - (profileImage.width+3*mm)
|
||||
height: (contact.hasOwnProperty("acct"))?21*mm:15*mm//profileImage.height
|
||||
y: mm
|
||||
spacing:4
|
||||
|
||||
MButton{
|
||||
id:photobutton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text: "\uf03e" // "Photos"
|
||||
//font.pixelSize: 3*mm
|
||||
visible:(contact.network=="dfrn")
|
||||
onClicked:{
|
||||
rootstack.currentIndex=2;
|
||||
bar.currentIndex=2;
|
||||
fotostab.phototabstatus="Contact";
|
||||
BlueButton{
|
||||
id:photobutton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text: "\uf03e" // "Photos"
|
||||
visible:(contact.network=="dfrn")
|
||||
onClicked:{
|
||||
rootstack.currentIndex=2;
|
||||
bar.currentIndex=2;
|
||||
fotostab.phototabstatus="Contact";
|
||||
|
||||
//fotostab.active=true;
|
||||
fotoSignal(root.login,contact) ;
|
||||
newsStack.pop();
|
||||
}
|
||||
}
|
||||
//fotostab.active=true;
|
||||
fotoSignal(root.login,contact) ;
|
||||
rootstackView.pop();
|
||||
}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:dmbutton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
visible: (contact.following=="true")
|
||||
text: "\uf040" //"DM"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked:{
|
||||
rootstack.currentIndex=0;
|
||||
newsSwipeview.currentIndex=2;
|
||||
directmessageSignal(contact)
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:dmbutton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
visible: (contact.following=="true")
|
||||
text: "\uf040" //"DM"
|
||||
onClicked:{
|
||||
rootstack.currentIndex=0;
|
||||
newsSwipeview.currentIndex=2;
|
||||
directmessageSignal(contact)
|
||||
}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:eventbutton
|
||||
visible:(contact.network=="dfrn")
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text:"\uf073"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked:{
|
||||
rootstack.currentIndex=3;
|
||||
bar.currentIndex=3;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
eventSignal(contact);
|
||||
newsStack.pop()
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:eventbutton
|
||||
visible:(contact.network=="dfrn")
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text:"\uf073"
|
||||
onClicked:{
|
||||
rootstack.currentIndex=3;
|
||||
bar.currentIndex=3;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
eventSignal(contact);
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:approvebutton
|
||||
visible:(contact.hasOwnProperty("acct"))
|
||||
height: 6*mm
|
||||
//width: implicitContentWidth+2*mm//8*mm
|
||||
text:qsTr("Approve")
|
||||
onClicked:{
|
||||
|
||||
}//Column end
|
||||
Label {
|
||||
id: namelabel
|
||||
x:mm
|
||||
width: contactView.width-2*mm
|
||||
height: implicitHeight
|
||||
text:contact.name+" (@"+contact.screen_name+")"
|
||||
wrapMode: Text.Wrap//elide:Text.ElideRight
|
||||
color: "#303030"
|
||||
font.pixelSize: 4*mm
|
||||
anchors.top: profileImage.bottom
|
||||
anchors.topMargin: mm
|
||||
}
|
||||
Text{
|
||||
id:detailtext
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
x:mm
|
||||
width: contactView.width-2*mm
|
||||
height: implicitHeight
|
||||
font.pixelSize: 2.5*mm
|
||||
textFormat:Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
text:"<b>"+qsTr("Description")+": </b> "+contact.description+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
|
||||
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
|
||||
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||
onLinkActivated: {
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/authorize",'',"POST",root,function(returnvalue){
|
||||
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
|
||||
})
|
||||
root.friendsSignal();
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:rejectbutton
|
||||
visible:(contact.hasOwnProperty("acct"))
|
||||
height: 6*mm
|
||||
//width: implicitContentWidth+2*mm//8*mm
|
||||
text:qsTr("Reject")
|
||||
onClicked:{
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/reject",'',"POST",root,function(returnvalue){
|
||||
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
|
||||
})
|
||||
root.friendsSignal();
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:ignorebutton
|
||||
visible:(contact.hasOwnProperty("acct"))
|
||||
height: 6*mm
|
||||
//width: implicitContentWidth+2*mm//8*mm
|
||||
text:qsTr("Ignore")
|
||||
onClicked:{
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/ignore",'',"POST",root,function(returnvalue){
|
||||
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
|
||||
});
|
||||
root.friendsSignal();
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
}//Flow end
|
||||
Label {
|
||||
id: namelabel
|
||||
//x:mm
|
||||
width: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.width-2*mm:contactView.width-17*root.fontFactor*osSettings.bigFontSize
|
||||
height: implicitHeight
|
||||
text:contact.name+" (@"+contact.screen_name+")"
|
||||
wrapMode: Text.Wrap//elide:Text.ElideRight
|
||||
color: "#303030"
|
||||
font.pointSize: 1.2*osSettings.bigFontSize
|
||||
font.family: "Noto Sans"
|
||||
anchors.top: contactView.width<35*root.fontFactor*osSettings.systemFontSize?profileImage.bottom:buttonflow.bottom
|
||||
anchors.margins: mm
|
||||
anchors.left: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.left:profileImage.right
|
||||
}
|
||||
Text{
|
||||
id:detailtext
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.left: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.left:profileImage.right
|
||||
anchors.margins: 2*mm
|
||||
//x:mm
|
||||
width: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.width-2*mm:contactView.width-17*root.fontFactor*osSettings.bigFontSize
|
||||
height: implicitHeight
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family: "Noto Sans"
|
||||
textFormat:Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
text:"<b>"+qsTr("Description")+": </b> "+contact.description+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
|
||||
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
|
||||
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||
onLinkActivated: {
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}//Component end
|
||||
|
||||
}//Component end
|
||||
Connections{
|
||||
target:newstab
|
||||
target:xhr
|
||||
function onError(data,url,api,code){
|
||||
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
||||
contactBusy.running=false;
|
||||
}
|
||||
function onSuccess(data,api){
|
||||
Service.processNews(api,data)
|
||||
replySignal("")
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:root
|
||||
function onContactpostsChanged(){
|
||||
if (newstab.contactposts.length>0){profileimagesource=newstab.contactposts[0].user.profile_image_url_large}
|
||||
if (root.contactposts.length>0&&root.contactposts[0]!=null){profileimagesource=root.contactposts[0].user.profile_image_url_large}
|
||||
contactBusy.running=false;
|
||||
contactModel.clear();
|
||||
var currentTime= new Date();
|
||||
var msg = {'currentTime': currentTime, 'model': contactModel,'news':newstab.contactposts, 'options':globaloptions};
|
||||
var msg = {'currentTime': currentTime, 'model': contactModel,'news':root.contactposts, 'options':globaloptions};
|
||||
contactWorker.sendMessage(msg)
|
||||
}
|
||||
}
|
||||
|
@ -193,25 +329,26 @@ Rectangle {
|
|||
}
|
||||
|
||||
MButton {
|
||||
id: closeButton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked: {
|
||||
newsStack.pop()
|
||||
}
|
||||
id: closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*root.fontFactor*osSettings.bigFontSize
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize;
|
||||
text: "\uf057"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked: {
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/user_timeline");
|
||||
xhr.setParam("user_id",contact.id)
|
||||
xhr.get();
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
if(contact.isFriend==1 || contact.hasOwnProperty("acct")){
|
||||
xhr.setApi("/api/statuses/user_timeline");}
|
||||
else{xhr.setApi("/api/users/show");}
|
||||
xhr.setParam("user_id",contact.id)
|
||||
xhr.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,19 +36,66 @@ import "qrc:/js/helper.js" as Helperjs
|
|||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/qml/newsqml"
|
||||
|
||||
Rectangle {
|
||||
Page {
|
||||
id:conversationList
|
||||
property var news:[]
|
||||
color: "white"
|
||||
// color: "white"
|
||||
//function backRequested(){pageStack.pop()}
|
||||
// width:root.width
|
||||
// height: root.height-7*mm
|
||||
|
||||
function getDateDiffString (seconds){
|
||||
var timestring="";
|
||||
if (seconds<60) {timestring= Math.round(seconds) + " " +qsTr("seconds");}
|
||||
else if (seconds<90){timestring= Math.round(seconds/60) + " " +qsTr("minute") ;}
|
||||
else if (seconds<3600){timestring= Math.round(seconds/60) + " " +qsTr("minutes");}
|
||||
else if (seconds<5400){timestring= Math.round(seconds/3600) + " " +qsTr("hour");}
|
||||
else if (seconds<86400){timestring= Math.round(seconds/3600) + " " +qsTr("hours");}
|
||||
else if (seconds<129600){timestring= Math.round(seconds/86400) + " " +qsTr("day");}
|
||||
else if (seconds<3888000){timestring= Math.round(seconds/86400) + " " +qsTr("days");}
|
||||
else if (seconds<5832000){timestring= Math.round(seconds/3888000) + " " +qsTr("month");}
|
||||
else if (seconds<69984000){timestring= Math.round(seconds/3888000) + " " +qsTr("months");}
|
||||
else {timestring= Math.round(seconds/46656000) + " " + qsTr("years");}
|
||||
|
||||
return timestring;
|
||||
}
|
||||
|
||||
function getActivitiesView(newsitemobject){
|
||||
var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={};
|
||||
try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){
|
||||
if (newsitemobject.friendica_activities.like.length>0){
|
||||
if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")}
|
||||
else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.dislike.length>0){
|
||||
if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")}
|
||||
else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.attendyes.length>0){
|
||||
if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")}
|
||||
else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.attendno.length>0){
|
||||
if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")}
|
||||
else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")}
|
||||
}
|
||||
if (newsitemobject.friendica_activities.attendmaybe.length>0){
|
||||
if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")}
|
||||
else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")}
|
||||
}
|
||||
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
|
||||
}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
|
||||
return {likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText}
|
||||
}
|
||||
|
||||
|
||||
ListView {
|
||||
id: conversationView
|
||||
property string viewtype: "conversation"
|
||||
x:3*mm
|
||||
y:8*mm
|
||||
width: conversationList.width-4*mm
|
||||
height:conversationList.height-10*mm
|
||||
//x:3*mm
|
||||
//y:8*mm
|
||||
width: conversationList.width//-4*mm
|
||||
height:conversationList.height//-20*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: MessageSend{conversation:true}
|
||||
|
@ -58,7 +105,7 @@ Rectangle {
|
|||
BusyIndicator{
|
||||
id: conversationBusy
|
||||
anchors.horizontalCenter: conversationView.horizontalCenter
|
||||
anchors.top:conversationList.top
|
||||
anchors.top:conversationView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
|
@ -69,7 +116,7 @@ Rectangle {
|
|||
target:newstab
|
||||
onConversationChanged:{
|
||||
if(newstab.conversation.length==0){
|
||||
newsStack.pop()
|
||||
rootstackView.pop()
|
||||
} else { conversationBusy.running=false;
|
||||
conversationModel.clear();
|
||||
var currentTime= new Date();
|
||||
|
@ -88,16 +135,16 @@ Rectangle {
|
|||
|
||||
MButton {
|
||||
id: closeButton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize;
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
||||
newstab.conversation=[];
|
||||
if (rootstackView.depth>1){ rootstackView.pop()}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ Rectangle {
|
|||
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Text{
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
anchors.left: contactImage.right
|
||||
anchors.margins: 1*mm
|
||||
text:contact.name
|
||||
|
@ -86,9 +86,8 @@ Rectangle {
|
|||
}
|
||||
}}
|
||||
|
||||
BlueButton {
|
||||
MButton {
|
||||
id: closeButton
|
||||
//width:10*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
|
|
|
@ -46,6 +46,6 @@ Rectangle {
|
|||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{search(hashtagText.text.replace("#",""))}
|
||||
onClicked:{root.searchSignal(hashtagText.text.replace("#",""))}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,9 @@ import "qrc:/qml/genericqml"
|
|||
Rectangle{
|
||||
color:"#EEEEEE"
|
||||
width:parent.width
|
||||
height: (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
|
||||
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
|
||||
id:messageSend
|
||||
visible:(newsSwipeview.stacktype!="Notifications")?true:false
|
||||
visible:conversation || (newsSwipeview.stacktype!="Notifications")||(newstab.newstabstatus!="Search")?true:false
|
||||
property string parentId: ""
|
||||
property bool textfocus: false
|
||||
//property var parentObject:({})
|
||||
|
@ -61,14 +61,12 @@ Rectangle{
|
|||
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
||||
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
||||
|
||||
|
||||
function directmessagePrepare(friend){
|
||||
messageSend.state="active";
|
||||
reply_to_user=friend.screen_name;
|
||||
receiverLabel.text=friend.screen_name;
|
||||
}
|
||||
|
||||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1 && attachImageURLs.length==0)){
|
||||
attachImage(urls);
|
||||
|
@ -87,15 +85,13 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function attachImage(url){
|
||||
imageAttachment.source=url.toString();
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
newsBusy.running=true;
|
||||
try{newsBusy.running=true;}catch(e){conversationBusy.running=true}
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/update");
|
||||
|
@ -116,7 +112,7 @@ Rectangle{
|
|||
};
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
}
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
newsBusy.running=true;
|
||||
|
@ -139,7 +135,7 @@ Rectangle{
|
|||
reply_to_user=newsitemobject.user.screen_name;
|
||||
parentId=newsitemobject.id
|
||||
} else {
|
||||
messageSend.state="";
|
||||
messageSend.state=null;
|
||||
reply_to_user="";
|
||||
parentId="";
|
||||
bodyField.text="";
|
||||
|
@ -152,6 +148,9 @@ Rectangle{
|
|||
Newsjs.listFriends(login,db,function(contacts){
|
||||
contactModel.clear();
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
if(contacts[i].description!="" &&contacts[i].description!=null){
|
||||
contacts[i].description=Qt.atob(contacts[i].description)
|
||||
}
|
||||
contactModel.append({"contact":contacts[i]})
|
||||
}
|
||||
contactSelector.visible=true
|
||||
|
@ -171,17 +170,36 @@ Rectangle{
|
|||
// anchors.fill: parent
|
||||
// contentHeight: messageColumn.height
|
||||
// boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
DropArea{
|
||||
anchors.fill: parent
|
||||
onDropped: {
|
||||
if (messageSend.state==""){messageSend.state="active"}
|
||||
if (drop.keys.includes('text/uri-list')){
|
||||
attachImageURLs.push(drop.text);
|
||||
attachImage(drop.text)}
|
||||
else if (drop.keys.includes('text/html')){
|
||||
bodyField.append(drop.html)}
|
||||
else if (drop.keys.includes('text/plain')){
|
||||
bodyField.append(drop.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
y:0.5*mm
|
||||
id:messageColumn
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 10*mm//implicitHeight
|
||||
height: 11*mm+stackTypeDescription.height//implicitHeight
|
||||
Label{id:stackTypeDescription
|
||||
width: parent.width
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):""
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
}
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
width: messageColumn.width//-8*mm
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""
|
||||
visible:false
|
||||
|
@ -193,7 +211,7 @@ Rectangle{
|
|||
id: titleField
|
||||
x: 0.5*mm
|
||||
width: parent.width-mm
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
placeholderText: qsTr("Title (optional)")
|
||||
visible: false//(parentId === "") && (bodyField.length>1)
|
||||
onVisibleChanged: if ((visible==true)&&(conversation==true)){
|
||||
|
@ -211,21 +229,22 @@ Rectangle{
|
|||
TextArea {
|
||||
id: bodyField
|
||||
property string contactprefix:""
|
||||
property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):""
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family: "Noto Sans"
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
placeholderText: conversation?"": qsTr("What's on your mind?")
|
||||
placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder)
|
||||
textFormat: TextEdit.RichText //TextEdit.PlainText
|
||||
onLineCountChanged: (conversation==true)?conversationView.contentY=conversationView.contentY+3*mm:newsView.contentY=newsView.contentY+3*mm
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
onActiveFocusChanged:{
|
||||
onActiveFocusChanged:{//print(placeholder)
|
||||
if (activeFocus==true){
|
||||
if (conversation==true){
|
||||
setParent(conversationModel.get(0).newsitemobject);
|
||||
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
|
||||
messageSend.state="conversation";
|
||||
conversationView.contentY=conversationView.contentY+20*mm
|
||||
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
|
||||
} else if (textfocus==false){
|
||||
messageSend.state="active";
|
||||
newsView.positionViewAtBeginning();
|
||||
|
@ -347,18 +366,18 @@ Rectangle{
|
|||
height: 12*mm
|
||||
x: 0.5*mm
|
||||
MButton{id:permButton
|
||||
visible: (newsSwipeview.stacktype!=="DirectMessages")
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
visible: !conversation && (newsSwipeview.stacktype!=="DirectMessages")
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
|
||||
onClicked: { if (permissionDialog.visible==false){permissionDialog.visible=true} else{permissionDialog.visible=false}}
|
||||
}
|
||||
MButton {
|
||||
id: attachButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: "\uf03e"
|
||||
visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
|
||||
onClicked: {
|
||||
if (attachImageURLs.length>0){//Server currently accepts only one attachment
|
||||
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
|
||||
|
@ -376,23 +395,23 @@ Rectangle{
|
|||
MButton{
|
||||
id:smileyButton
|
||||
text: "\uf118"
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:hastagButton
|
||||
text: "\uf292"
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: cancelButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
if (textfocus==true){messageSend.destroy()}
|
||||
|
@ -409,21 +428,21 @@ Rectangle{
|
|||
}
|
||||
MButton {
|
||||
id: sendButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: "\uf1d9"
|
||||
onClicked: {
|
||||
var title=titleField.text.replace("\"","\'");
|
||||
var body=bodyField.getFormattedText(0,bodyField.length);
|
||||
var dmbody=bodyField.getText(0,bodyField.length);
|
||||
if (newsSwipeview.stacktype!=="DirectMessages"){
|
||||
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
|
||||
statusUpdate(title,body,parentId,attachImageURLs)}
|
||||
else {
|
||||
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
|
||||
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
|
||||
}
|
||||
if (conversation==true){
|
||||
newstab.newstabstatus=root.globaloptions.newsViewType; newsStack.pop(null)
|
||||
newstab.newstabstatus=root.globaloptions.newsViewType; rootstackView.pop(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +451,7 @@ Rectangle{
|
|||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted:{
|
||||
newsStack.replySignal.connect(setParent);
|
||||
root.replySignal.connect(setParent);
|
||||
root.directmessageSignal.connect(directmessagePrepare);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
|
@ -464,7 +483,7 @@ Rectangle{
|
|||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
target: titleField; visible:(!conversation&&newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -482,6 +501,9 @@ Rectangle{
|
|||
PropertyChanges {
|
||||
target: bodyField; placeholderText:"";focus:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: stackTypeDescription; visible:false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ Rectangle{
|
|||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.family:fontAwesome.name
|
||||
//font.pixelSize: 3*mm
|
||||
text: qsTr("Show all comments")+" (" +comments + ")" //"\uf0dc"
|
||||
}
|
||||
MouseArea{
|
||||
|
|
|
@ -32,19 +32,26 @@
|
|||
import QtQuick 2.9
|
||||
AnimatedImage {id:gif;
|
||||
width:toprow.width;
|
||||
property string mimetype:""
|
||||
//property string mimetype:""
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
onStatusChanged: playing = (status == AnimatedImage.Ready);
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{
|
||||
if (mimetype!="image/gif"){
|
||||
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
|
||||
'Rectangle{id:recfullscreen;color:"white";width:root.width;height:root.height;'+
|
||||
'MouseArea {anchors.fill:parent;onClicked:{recfullscreen.destroy()}}'+
|
||||
'AnimatedImage {id:giffullscreen;source: "'+gif.source+
|
||||
'";anchors.centerIn:parent; width:root.width;height:root.height;fillMode: Image.PreserveAspectFit; onStatusChanged: playing = (status == AnimatedImage.Ready);'+
|
||||
'}}',root,"Attachmentlarge")
|
||||
}
|
||||
onStatusChanged: playing = (status == AnimatedImage.Ready)
|
||||
Rectangle{
|
||||
visible: (model.newsitemobject.imageAttachmentList.length>1)&&(gif.status==Image.Ready)
|
||||
opacity: 0.5
|
||||
color: "black"
|
||||
width:imageCountText.contentWidth+mm
|
||||
height: imageCountText.contentHeight+mm
|
||||
x: (gif.width-gif.paintedWidth)/2+gif.paintedWidth-width
|
||||
anchors.bottom: parent.bottom
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
id: imageCountText
|
||||
text: "+ " + (model.newsitemobject.imageAttachmentList.length-1).toString()
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{
|
||||
rootstackView.push("qrc:/qml/newsqml/NewsPhotolist.qml",{"photolistarray": model.newsitemobject.imageAttachmentList})}
|
||||
}
|
||||
}
|
||||
|
|
134
source-linux/qml/newsqml/NewsPhotolist.qml
Normal file
134
source-linux/qml/newsqml/NewsPhotolist.qml
Normal file
|
@ -0,0 +1,134 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.12
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Page{
|
||||
id:photolistview
|
||||
width:root.width;
|
||||
height:root.height//-7*mm
|
||||
property var photolistarray: []
|
||||
|
||||
Rectangle{
|
||||
anchors.fill: newsphotolistView
|
||||
color: "black"
|
||||
}
|
||||
ListView{
|
||||
id: newsphotolistView
|
||||
anchors.fill: parent
|
||||
orientation: Qt.Horizontal
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
|
||||
model:photolistModel
|
||||
delegate: photoWrapper
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: photolistModel
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: closeButton
|
||||
z:2
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked: {if (rootstackView.depth>1){ rootstackView.pop()}
|
||||
}
|
||||
}
|
||||
Component {
|
||||
id: photoWrapper
|
||||
|
||||
AnimatedImage {
|
||||
id: realImage;
|
||||
width: photolistview.width; height: photolistview.height
|
||||
antialiasing: true;
|
||||
asynchronous: true
|
||||
autoTransform:true
|
||||
cache: false
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
onStatusChanged: playing = (status == AnimatedImage.Ready);
|
||||
source: url
|
||||
BusyIndicator{
|
||||
running: realImage.status==Image.Loading
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
// PinchArea {
|
||||
// id:imagePinch
|
||||
// pinch.target: realImage
|
||||
// anchors.fill: realImage
|
||||
// pinch.minimumScale: 0.1
|
||||
// pinch.maximumScale: 10
|
||||
// enabled: false
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
BlueButton{
|
||||
width: 5*mm
|
||||
height:photolistview.height
|
||||
anchors.left: newsphotolistView.left
|
||||
visible: newsphotolistView.currentIndex!=0
|
||||
text:"\uf053"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
color:"transparent"
|
||||
radius:0
|
||||
onClicked: {newsphotolistView.currentIndex=newsphotolistView.currentIndex-1}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
width: 5*mm
|
||||
height:photolistview.height
|
||||
anchors.right: newsphotolistView.right
|
||||
visible: newsphotolistView.currentIndex!=photolistarray.length-1
|
||||
text:"\uf054"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
color:"transparent"
|
||||
radius:0
|
||||
onClicked: {newsphotolistView.currentIndex=newsphotolistView.currentIndex+1}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (photolistarray.length>0){
|
||||
photolistarray.forEach(function(photo){
|
||||
photolistModel.append(photo)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,292 +35,315 @@ import "qrc:/js/news.js" as Newsjs
|
|||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
StackView{
|
||||
Rectangle{
|
||||
id: newsStack
|
||||
anchors.fill: parent
|
||||
//anchors.fill: parent
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
property string updateMethodNews: "refresh"
|
||||
property var allchats: ({})
|
||||
signal replySignal(var newsobject)
|
||||
property int lastnewsid:0
|
||||
property string newstabstatus: ""
|
||||
|
||||
function newstypeHandling(newstype){
|
||||
newsBusy.running=true;
|
||||
replySignal("");
|
||||
//messagesend.state="";
|
||||
newsModel.clear();
|
||||
switch(newstype){
|
||||
case "timeline":
|
||||
newstab.newstabstatus="Timeline";
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
break;
|
||||
case "conversation":
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
break;
|
||||
case "favorites":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Favorites";
|
||||
Service.updateView("Favorites");
|
||||
break;
|
||||
case "replies":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Replies";
|
||||
Service.updateView("Replies");
|
||||
break;
|
||||
case "publictimeline":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
Service.updateView("Public Timeline");
|
||||
break;
|
||||
case "groupnews":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
Service.showGroups();
|
||||
break;
|
||||
case "search":
|
||||
newsView.anchors.topMargin=7*mm;
|
||||
newsBusy.running=false;
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
|
||||
var searchItem = component.createObject(newsStack,{y:mm,width:root.width,height: 5*mm});
|
||||
break;
|
||||
case "refresh":
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Directmessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
}
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
//visible: false
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
z:2
|
||||
running: false
|
||||
}
|
||||
|
||||
function newstypeHandling(newstype){
|
||||
newsBusy.running=true;
|
||||
replySignal("");
|
||||
//messagesend.state="";
|
||||
newsModel.clear();
|
||||
switch(newstype){
|
||||
case "timeline":
|
||||
newstab.newstabstatus="Timeline";
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
break;
|
||||
case "conversation":
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
break;
|
||||
case "favorites":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Favorites";
|
||||
Service.updateView("Favorites");
|
||||
break;
|
||||
case "replies":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Replies";
|
||||
Service.updateView("Replies");
|
||||
break;
|
||||
case "publictimeline":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
Service.updateView("Public Timeline");
|
||||
break;
|
||||
case "groupnews":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Groupnews";
|
||||
Service.showGroups();
|
||||
break;
|
||||
case "search":
|
||||
newsView.anchors.topMargin=7*mm;
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=false;
|
||||
var leftoffset=osSettings.osType=="Android"?3*osSettings.bigFontSize:0
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
|
||||
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-leftoffset,height: 5*mm});
|
||||
break;
|
||||
case "refresh":
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//print("Refresh "+newsSwipeview.stacktype+newstab.newstabstatus)
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Directmessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showNews(newsToShow){
|
||||
try{if (newsStack.depth>1){newsStack.pop()}}catch(e){}
|
||||
newsBusy.running=false;
|
||||
var currentTime= new Date();
|
||||
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
|
||||
//print("appendnews "+JSON.stringify(newsToShow))
|
||||
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
//newsStack.appendNews=false
|
||||
}
|
||||
function showNews(newsToShow){
|
||||
try{if (rootstackView.depth>1){rootstackView.pop()}}catch(e){}
|
||||
newsBusy.running=false;
|
||||
var currentTime= new Date();
|
||||
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
|
||||
//print("appendnews "+JSON.stringify(newsToShow))
|
||||
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
//newsStack.appendNews=false
|
||||
}
|
||||
|
||||
function showContact(contact){ //print(JSON.stringify(contact));
|
||||
//newstab.newstabstatus="Contact";
|
||||
newsStack.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact});
|
||||
}
|
||||
|
||||
function search(term){//print("Search "+term)
|
||||
if (term!=""){
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
newsStack.updateMethodNews="refresh";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/search");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("q",term)
|
||||
xhr.get();}
|
||||
newsView.anchors.topMargin=mm
|
||||
}
|
||||
|
||||
function getOldNews(){
|
||||
function search(term){//print("Search "+term)
|
||||
if (term!=""){
|
||||
//newstab.newstabstatus="Search";
|
||||
newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
newsStack.updateMethodNews="refresh";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/search");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("q",term)
|
||||
xhr.get();}
|
||||
newsView.anchors.topMargin=mm
|
||||
}
|
||||
|
||||
function getOldNews(){print("newstab.newstabstatus" +newstab.newstabstatus)
|
||||
var currentTime= new Date();
|
||||
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
//if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
|
||||
if(newstabstatus=="Timeline"){
|
||||
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
else if(newstab.newstabstatus=="Conversations"){
|
||||
//else if(newstab.newstabstatus=="Conversations"){
|
||||
else if(newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
else if (newstab.newstabstatus=="Notifications"){}
|
||||
//else if (newstab.newstabstatus=="Notifications"){}
|
||||
else if (newstabstatus=="Notifications"){}
|
||||
else{
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
//newsStack.appendNews=true;
|
||||
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
|
||||
xhr.get()
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target:xhr
|
||||
function onError(data,url,api,code){
|
||||
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
||||
newsBusy.running=false;
|
||||
}
|
||||
function onSuccess(data,api){
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
Service.processNews(api,data)
|
||||
replySignal("")
|
||||
}
|
||||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {"replytimer triggered";
|
||||
newsBusy.running=true;
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
else{
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
replySignal("")
|
||||
//Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initialItem: Rectangle {
|
||||
id:newslistRectangle
|
||||
y:1
|
||||
color: "white"
|
||||
//anchors.fill:parent
|
||||
|
||||
Component { id:footerComponent
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:newsView.width
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
if (newsModel.count==0){
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
}
|
||||
else {getOldNews();}
|
||||
}
|
||||
}
|
||||
}
|
||||
target:xhr
|
||||
function onError(data,url,api,code){
|
||||
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
||||
newsBusy.running=false;
|
||||
}
|
||||
function onSuccess(data,api){
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
Service.processNews(api,data)
|
||||
replySignal("")
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
property real oldContentY:0
|
||||
property bool viewdragged: false
|
||||
property bool viewdraggedpositive: false
|
||||
property string viewtype: "news"
|
||||
anchors.fill: parent
|
||||
anchors.margins: mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
header: MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()}
|
||||
footer: footerComponent
|
||||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
onDragStarted: oldContentY=contentY
|
||||
onDragEnded: {
|
||||
if(verticalOvershoot<-5*mm){
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {"replytimer triggered";
|
||||
newsBusy.running=true;
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
else{
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
replySignal("")
|
||||
//Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component { id:footerComponent
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:newsView.width
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
if (newsModel.count==0){
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
}
|
||||
else {print("Footer newstab.newstabstatus "+newstab.newstabstatus);getOldNews();}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
property real oldContentY:0
|
||||
property bool viewdragged: false
|
||||
property bool viewdraggedpositive: false
|
||||
property string viewtype: "news"
|
||||
width: parent.width
|
||||
height: parent.height-3*mm
|
||||
//anchors.fill: parent
|
||||
anchors.margins: 0.5*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
header:
|
||||
MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()}
|
||||
|
||||
footer: footerComponent
|
||||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
onDragStarted: oldContentY=contentY
|
||||
onDragEnded: {
|
||||
if(verticalOvershoot<-5*mm){
|
||||
viewdragged=true
|
||||
}
|
||||
else if (verticalOvershoot>5*mm){
|
||||
}
|
||||
else if (verticalOvershoot>5*mm){
|
||||
viewdraggedpositive=true
|
||||
}
|
||||
else{
|
||||
}
|
||||
else{
|
||||
if((contentY-oldContentY)>15*mm){
|
||||
swipeIndicator.visible=false;
|
||||
newsSwipeview.height=rootStackItem.height;
|
||||
newsSwipeview.y=0;
|
||||
rootStackItem.state="fullscreen"
|
||||
//swipeIndicator.visible=false;
|
||||
//newsSwipeview.height=rootstack.height;
|
||||
//newsSwipeview.y=0;
|
||||
//rootStackItem.state="fullscreen"
|
||||
}
|
||||
else if ((contentY-oldContentY)<-15*mm){
|
||||
swipeIndicator.visible=true;
|
||||
newsSwipeview.height=rootStackItem.height-12*mm;
|
||||
newsSwipeview.y=5*mm;
|
||||
rootStackItem.state=""
|
||||
//swipeIndicator.visible=true;
|
||||
//newsSwipeview.height=rootstack.height-12*mm;
|
||||
//newsSwipeview.y=5*mm;
|
||||
//rootStackItem.state=""
|
||||
}
|
||||
}
|
||||
}
|
||||
onViewdraggedChanged: {
|
||||
if (viewdragged){
|
||||
var onlynew=true;
|
||||
newsBusy.running=true;
|
||||
viewdragged=false
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
}
|
||||
}
|
||||
onViewdraggedChanged: {
|
||||
if (viewdragged){
|
||||
var onlynew=true;
|
||||
newsBusy.running=true;
|
||||
viewdragged=false
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
|
||||
if (currentlastnews>lastnewsid){
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
}
|
||||
} else {
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
|
||||
if (currentlastnews>lastnewsid){
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
}
|
||||
});
|
||||
}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
}
|
||||
} else {
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
|
@ -331,87 +354,82 @@ StackView{
|
|||
Service.updateView("Replies")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
onViewdraggedpositiveChanged: {
|
||||
if (viewdraggedpositive){
|
||||
}
|
||||
}
|
||||
onViewdraggedpositiveChanged: {
|
||||
if (viewdraggedpositive){print("listview dragged newstab.newstabstatus "+newstab.newstabstatus)
|
||||
getOldNews();
|
||||
viewdraggedpositive=false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
WorkerScript {
|
||||
id: newsWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: false
|
||||
}
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
property alias text: noticeText.text
|
||||
color:"white"
|
||||
border.color:"grey"
|
||||
z:1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom:parent.bottom
|
||||
anchors.bottomMargin: 2*mm
|
||||
width: noticeText.width+2*mm
|
||||
height: noticeText.height+2*mm
|
||||
visible: (downloadNotice.text!="")
|
||||
|
||||
Text{
|
||||
id:noticeText
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.pixelSize: 2*mm
|
||||
text:""
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.newstypeSignal.connect(newstypeHandling);
|
||||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.contactdetailsSignal.connect(showContact);
|
||||
root.newsSignal.connect(showNews);
|
||||
|
||||
try{newsModel.clear()} catch(e){}
|
||||
swipeIndicator.visible=true;
|
||||
newsSwipeview.height=rootStackItem.height-12*mm;
|
||||
newsSwipeview.y=5*mm;
|
||||
rootStackItem.state=""
|
||||
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if((newstab.newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews);
|
||||
})
|
||||
}
|
||||
else{
|
||||
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar { }
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
WorkerScript {
|
||||
id: newsWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
property alias text: noticeText.text
|
||||
color:"white"
|
||||
border.color:"grey"
|
||||
z:1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom:parent.bottom
|
||||
anchors.bottomMargin: 2*mm
|
||||
width: noticeText.width+2*mm
|
||||
height: noticeText.height+2*mm
|
||||
visible: (downloadNotice.text!="")
|
||||
|
||||
Text{
|
||||
id:noticeText
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
text:""
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.newstypeSignal.connect(newstypeHandling);
|
||||
root.contactdetailsSignal.connect(showContact);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.searchSignal.connect(search);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
swipeIndicator.visible=true;
|
||||
//newsSwipeview.height=rootstack.height//-12*mm;
|
||||
//newsSwipeview.y=5*mm;
|
||||
//rootStackItem.state=""
|
||||
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
|
||||
newstabstatus=newstab.newstabstatus;
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
|
||||
//if((newstab.newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews);
|
||||
})
|
||||
}
|
||||
else{
|
||||
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -31,20 +31,23 @@
|
|||
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.12
|
||||
//import QtQuick.Controls.Styles 2.3
|
||||
//import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/newsqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
Item {
|
||||
Rectangle{
|
||||
id:newstabitem
|
||||
width:rootstack.width//-5*mm
|
||||
height: rootstack.height-8*mm//rootstack.height-100*mm
|
||||
|
||||
onHeightChanged: {newsSwipeview.height=height-6*mm}
|
||||
//anchors.fill: parent
|
||||
//onHeightChanged: {newsSwipeview.height=height-5*mm}
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {
|
||||
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
|
||||
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
|
||||
root.onNewContactsChanged(root.newContacts);
|
||||
Newsjs.storeNews(login,db,root.news,root)
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +59,7 @@ Item {
|
|||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/conversation/show");
|
||||
xhr.setParam("id",newsitemobject.id)
|
||||
xhr.setParam("count","200")
|
||||
xhr.get();
|
||||
}
|
||||
else{
|
||||
|
@ -113,51 +117,101 @@ Item {
|
|||
}
|
||||
|
||||
|
||||
function onFriendsMessages(friend){
|
||||
newstab.newstabstatus="Contact"
|
||||
Newsjs.newsfromdb(db,root.login.username, 0,function(dbnews){
|
||||
if (dbnews.length==0){
|
||||
Newsjs.newsfromdb(db,login.username,0,function(forumnews){
|
||||
showNews(forumnews)
|
||||
},friend.url)
|
||||
}
|
||||
else showNews(dbnews)
|
||||
},friend.id)
|
||||
|
||||
// CalendarTab{
|
||||
// visible: wideScreen&&rootstackView.depth<2
|
||||
// width: newstabitem.width/3
|
||||
// x: newsSwipeview.width
|
||||
// //anchors.left: newsSwipeview.right
|
||||
// //anchors.fill: null
|
||||
// }
|
||||
// Rectangle{
|
||||
// color: "#F8F8F8"
|
||||
// height: parent.height
|
||||
// width: 0.5*mm
|
||||
// anchors.left: newsSwipeview.right
|
||||
// }
|
||||
BlueButton{
|
||||
x:mm
|
||||
y:mm
|
||||
z:2
|
||||
visible: !wideScreen
|
||||
fontColor: "grey"
|
||||
border.color: "transparent"
|
||||
text: "\uf0c9"
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
onClicked:{
|
||||
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
|
||||
}
|
||||
|
||||
Label{
|
||||
text:"\uf0c9 "
|
||||
font.pixelSize: 5* mm
|
||||
anchors.left: parent.left
|
||||
anchors.margins: mm
|
||||
color: "#B0BEC5"
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
leftDrawer.open()
|
||||
}
|
||||
}
|
||||
LeftDrawerLinux{
|
||||
id:leftDrawer
|
||||
property var newstabstatus: newstab.newstabstatus
|
||||
visible: wideScreen&&rootstackView.depth<2
|
||||
width: visible?root.fontFactor*osSettings.systemFontSize*15:0
|
||||
height: root.height-bar.height
|
||||
}
|
||||
Label{
|
||||
text:qsTr(newsSwipeview.stacktype)
|
||||
font.pixelSize: 3* mm
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.margins: 2*mm
|
||||
|
||||
LeftDrawerAndroid{
|
||||
id: leftDrawerAndroid
|
||||
}
|
||||
// BlueButton{
|
||||
// z:2
|
||||
// anchors.left: newsSwipeview.left
|
||||
// anchors.verticalCenter: newsSwipeview.verticalCenter//anchors.bottom: newsSwipeview.bottom
|
||||
// anchors.margins: mm
|
||||
// visible: wideScreen && newsSwipeview.currentIndex!=0
|
||||
// text:"\uf053"
|
||||
// fontColor:"grey"
|
||||
// border.color: "transparent"
|
||||
// color:"transparent"
|
||||
// radius:0
|
||||
// onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex-1}
|
||||
// }
|
||||
|
||||
// BlueButton{
|
||||
// z:2
|
||||
// anchors.right: newsSwipeview.right
|
||||
// anchors.verticalCenter: newsSwipeview.verticalCenter//anchors.bottom: newsSwipeview.bottom
|
||||
// anchors.margins: mm
|
||||
// visible: wideScreen && newsSwipeview.currentIndex!=3
|
||||
// text:"\uf054"
|
||||
// fontColor:"grey"
|
||||
// border.color: "transparent"
|
||||
// color:"transparent"
|
||||
// radius:0
|
||||
// onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex+1}
|
||||
// }
|
||||
|
||||
SwipeView{
|
||||
id: newsSwipeview
|
||||
property string stacktype:"Home"
|
||||
currentIndex: 0
|
||||
width: parent.width
|
||||
height: parent.height-6*mm
|
||||
y: 5*mm
|
||||
width: wideScreen&&rootstackView.depth<2?newstabitem.width-leftDrawer.width-mm:newstabitem.width-mm//newstabitem.width/3*2:newstabitem.width
|
||||
height: newstabitem.height-4*mm
|
||||
x: leftDrawer.width
|
||||
function onDirectMessage(friend){currentIndex=2}
|
||||
transitions: Transition {
|
||||
PropertyAnimation { properties: "height";
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 1000
|
||||
}
|
||||
}
|
||||
// transitions: Transition {
|
||||
// PropertyAnimation { properties: "height";
|
||||
// easing.type: Easing.InOutQuad
|
||||
// duration: 1000
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// Label{
|
||||
// text:"\uf0c9 "
|
||||
// font.pixelSize: 5* mm
|
||||
// anchors.left: parent.left
|
||||
// anchors.margins: mm
|
||||
// color: "#B0BEC5"
|
||||
// MouseArea{
|
||||
// anchors.fill: parent
|
||||
// onClicked:{
|
||||
// leftDrawer.open()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
switch(currentIndex){
|
||||
|
@ -168,6 +222,7 @@ Item {
|
|||
default: stacktype="Home";
|
||||
}
|
||||
}
|
||||
|
||||
//anchors.fill: parent
|
||||
Loader{
|
||||
id: friendstimeline
|
||||
|
@ -192,16 +247,17 @@ Item {
|
|||
source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||
}
|
||||
Component.onCompleted: {root.directmessageSignal.connect(onDirectMessage)}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
id: swipeIndicator
|
||||
z:5
|
||||
height: root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
count: newsSwipeview.count
|
||||
currentIndex: newsSwipeview.currentIndex
|
||||
|
||||
anchors.bottom: newsSwipeview.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ Rectangle{
|
|||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{
|
||||
if(attachment.mimetype=="video/youtube"){
|
||||
root.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
|
||||
rootstackView.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
|
||||
} else {
|
||||
root.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype});
|
||||
rootstackView.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,12 +33,13 @@ import QtMultimedia 5.8
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
Rectangle{
|
||||
|
||||
Page{
|
||||
id:newsvideofullscreen
|
||||
color:"black"
|
||||
//color:"black"
|
||||
//border.color: "light grey"
|
||||
width:root.width;
|
||||
height:root.height
|
||||
height:root.height-3*root.fontFactor*osSettings.bigFontSize
|
||||
property alias source:video.source
|
||||
Text{
|
||||
id:noticeText
|
||||
|
@ -46,7 +47,7 @@ Rectangle{
|
|||
color:"light grey"
|
||||
width:parent.width/2
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
x:parent.width/2-parent.height/4
|
||||
y:parent.height/5
|
||||
visible: video.playbackState!=MediaPlayer.PlayingState
|
||||
|
@ -55,7 +56,7 @@ Rectangle{
|
|||
Video {id:video;
|
||||
anchors.fill:parent
|
||||
property string mimetype:""
|
||||
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString;}
|
||||
onErrorChanged:{noticeText.font.pointSize=osSettings.bigFontSize;noticeText.text=errorString;}
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
autoLoad: true
|
||||
autoPlay: true
|
||||
|
@ -63,7 +64,7 @@ Rectangle{
|
|||
MouseArea {
|
||||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
root.pop()
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +77,7 @@ Rectangle{
|
|||
z:2
|
||||
visible:video.playbackState!=MediaPlayer.StoppedState
|
||||
value: video.position/video.duration
|
||||
|
||||
MouseArea {
|
||||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
|
|
|
@ -32,14 +32,16 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.8
|
||||
import QtQuick.Controls 2.12
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import QtWebView 1.1
|
||||
|
||||
Rectangle{
|
||||
|
||||
Page {
|
||||
id:newsYplayer
|
||||
color:"black"
|
||||
//color:"black"
|
||||
width:root.width;
|
||||
height:root.height
|
||||
height:root.height-7*mm
|
||||
property string url:""
|
||||
property string ytcode:""
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import "qrc:/qml/genericqml"
|
|||
|
||||
Item {
|
||||
id: newsitem
|
||||
width: newsView.width //parent.width
|
||||
width: newsitemobject.hasOwnProperty("indent")&&newsitemobject.indent>0?parent.width:newsitem.ListView.view.width//parent.width//newsView.width //
|
||||
height:toprow.height+friendicaActivities.height+controlrow.height+conversationColumn.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
||||
property int itemindex: index
|
||||
property var newsitemobject:model.newsitemobject
|
||||
|
@ -45,7 +45,7 @@ Item {
|
|||
property var friendica_activities_view: getActivitiesView(model.newsitemobject)
|
||||
|
||||
onAttendingChanged: {attendLabel.visible=true;
|
||||
attendLabel.text= qsTr("attending")+": "+ qsTr(attending)}
|
||||
attendLabel.text= qsTr("attending")+": "+ qsTr(attending)}
|
||||
|
||||
signal replyto(string parent_id)
|
||||
|
||||
|
@ -54,425 +54,416 @@ Item {
|
|||
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function pushConversation(){
|
||||
if (model.newsitemobject.hasOwnProperty("currentconversation")){
|
||||
newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
|
||||
else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")};
|
||||
rootstackView.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
|
||||
//newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
|
||||
//else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")};
|
||||
else{rootstackView.push("qrc:/qml/newsqml/Conversation.qml")};
|
||||
showConversation(index,newsitemobject)
|
||||
}
|
||||
|
||||
|
||||
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
|
||||
|
||||
Rectangle{
|
||||
width:newsitem.width
|
||||
height:newsitem.height-1
|
||||
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||
width:newsitem.width
|
||||
height:newsitem.height-1
|
||||
color: "white"
|
||||
|
||||
Column {
|
||||
id:toprow //newscolumn
|
||||
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
|
||||
Item{
|
||||
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
|
||||
width: parent.width
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
showContact(newsitemobject.user)}
|
||||
}
|
||||
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: 7*mm
|
||||
height: 7*mm
|
||||
//radius:mm
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Flow{
|
||||
id:topFlow
|
||||
spacing: mm
|
||||
width:parent.width-8*mm
|
||||
anchors.left: profileImage.right
|
||||
anchors.margins: mm
|
||||
Label {
|
||||
id:user_name
|
||||
//color: "grey"
|
||||
width:parent.width
|
||||
font.bold: true
|
||||
font.pixelSize: 2.5*mm
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
text: newsitemobject.user.name+" (@"+newsitemobject.user.screen_name+")"+newsitemobject.forumname
|
||||
Column {
|
||||
id:toprow //newscolumn
|
||||
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
|
||||
height: newsitemobject.nsfw?5*mm:Math.min(itemHeader.height+itemBody.height,3/4*root.height)
|
||||
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)}
|
||||
}
|
||||
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"}
|
||||
}
|
||||
Flow{
|
||||
id:topFlow
|
||||
spacing: 0.5*mm
|
||||
width:parent.width-8*mm
|
||||
anchors.left: profileImage.right
|
||||
anchors.margins: mm
|
||||
Label {
|
||||
id:user_name
|
||||
//color: "grey"
|
||||
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
|
||||
color: "grey"
|
||||
text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source}
|
||||
font.pixelSize: 1.5*mm
|
||||
}
|
||||
Label {
|
||||
id:createdAtLabel
|
||||
color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
|
||||
}
|
||||
Label {
|
||||
id:replytoLabel
|
||||
color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
font.family: "Noto Sans"
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
||||
}catch(e){" "}
|
||||
Label {
|
||||
id:messageTypeLabel
|
||||
color: "grey"
|
||||
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
|
||||
color: "grey"
|
||||
font.pointSize: 0.6*osSettings.systemFontSize
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: " \u00B7 "+getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
|
||||
}
|
||||
Label {
|
||||
id:replytoLabel
|
||||
color: "grey"
|
||||
font.pointSize: 0.6*osSettings.systemFontSize
|
||||
font.family: "Noto Sans"
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: try {" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
||||
}catch(e){" "}
|
||||
}
|
||||
}
|
||||
//Component.onCompleted:print("Newsitemwidth "+newsitem.width+ " Indent "+newsitemobject.indent)
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
width: toprow.width-2
|
||||
height: itemMessage.height
|
||||
onPressAndHold: {
|
||||
pushConversation();
|
||||
}
|
||||
Text {
|
||||
color: "#404040"
|
||||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
font.family: "Noto Sans"
|
||||
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||
MouseArea{id: itemBody
|
||||
width: toprow.width-2
|
||||
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||
//height: implicitHeight
|
||||
wrapMode: Text.Wrap
|
||||
clip:true
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
if (newsitemobject.messagetype==0){
|
||||
var hashtags=[];
|
||||
hashtags=Newsjs.findTags(newsitemobject.text);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
||||
for (var tags in hashtags){
|
||||
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
||||
}}
|
||||
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
var imageQml = component.createObject(toprow,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
}
|
||||
else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
|
||||
var linkQml = component.createObject(toprow,{"url":newsitemobject.attachmentList[attachments].url});
|
||||
}
|
||||
else {
|
||||
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.attachmentList[attachments]});
|
||||
height: itemMessage.height
|
||||
onPressAndHold: {pushConversation()}
|
||||
Text {
|
||||
color: "#404040"
|
||||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
font.family: "Noto Sans"
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
text: newsitemobject.statusnet_html
|
||||
width: toprow.width-2
|
||||
//height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||
height: implicitHeight
|
||||
wrapMode: Text.Wrap
|
||||
clip:true
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
if (newsitemobject.messagetype==0){
|
||||
var hashtags=[];
|
||||
hashtags=Newsjs.findTags(newsitemobject.text);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
||||
for (var tags in hashtags){
|
||||
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newsitemobject.hasOwnProperty("lastcomment")){
|
||||
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
|
||||
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
|
||||
if (newsitemobject.imageAttachmentList.length>0){
|
||||
if(newsitemobject.imageAttachmentList[0].mimetype.substring(0,5)=="image"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
var imageQml = component.createObject(toprow,{"source":newsitemobject.imageAttachmentList[0].url});
|
||||
}
|
||||
}
|
||||
|
||||
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
|
||||
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
|
||||
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]});
|
||||
}
|
||||
|
||||
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});
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
}}
|
||||
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
width: newsitem.width-8*mm-2
|
||||
width: newsitem.width-2
|
||||
height:5*mm
|
||||
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
|
||||
visible: itemMessage.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
|
||||
anchors.bottom: toprow.bottom//itemMessage.bottom
|
||||
visible: toprow.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
|
||||
text:"\uf078"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
color:"white"
|
||||
// gradient: Gradient {
|
||||
// GradientStop { position: 0.0; color: "transparent" }
|
||||
// GradientStop { position: 0.5; color: "white" }
|
||||
// }
|
||||
// gradient: Gradient {
|
||||
// GradientStop { position: 0.0; color: "transparent" }
|
||||
// GradientStop { position: 0.5; color: "white" }
|
||||
// }
|
||||
radius:0
|
||||
onClicked: {
|
||||
if (text=="\uf078"){
|
||||
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
|
||||
toprow.height=toprow.implicitHeight+6*mm;text="\uf077"
|
||||
} else {
|
||||
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
|
||||
toprow.height=Math.min(toprow.implicitHeight,3/4*root.height);
|
||||
text="\uf078";
|
||||
newsView.positionViewAtIndex(index,ListView.Beginning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom row for activities
|
||||
Flow{
|
||||
id:friendicaActivities
|
||||
anchors.top:toprow.bottom
|
||||
width:parent.width
|
||||
spacing:mm
|
||||
// Bottom row for activities
|
||||
Flow{
|
||||
id:friendicaActivities
|
||||
anchors.top:toprow.bottom
|
||||
width:parent.width
|
||||
spacing:mm
|
||||
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.likeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.dislikeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.attendyesText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
|
||||
}}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.attendnoText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities_view.attendmaybeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)}
|
||||
}
|
||||
}
|
||||
Label{
|
||||
id:attendLabel
|
||||
color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: (newsitemobject.friendica_activities_view.self.attending)?(qsTr("Attending: ")+ qsTr(newsitemobject.friendica_activities_view.self.attending)):""
|
||||
}
|
||||
}
|
||||
|
||||
//Bottom row for buttons
|
||||
Row{id:controlrow
|
||||
anchors.top:friendicaActivities.bottom
|
||||
height: 4*mm
|
||||
CheckBox{
|
||||
id:likeCheckbox
|
||||
width:newsitem.width/5 //10*mm
|
||||
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{
|
||||
implicitWidth: newsitem.width/5 //10*mm
|
||||
implicitHeight:4*mm
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.family:fontAwesome.name
|
||||
color:likeCheckbox.checked?"black": "grey"
|
||||
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pointSize: 0.75*osSettings.systemFontSize
|
||||
text: friendica_activities_view.likeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
||||
}
|
||||
}
|
||||
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});
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pointSize: 0.75*osSettings.systemFontSize
|
||||
text: friendica_activities_view.dislikeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
||||
}
|
||||
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});
|
||||
}}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pointSize: 0.75*osSettings.systemFontSize
|
||||
text: friendica_activities_view.attendyesText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
|
||||
}}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pointSize: 0.75*osSettings.systemFontSize
|
||||
text: friendica_activities_view.attendnoText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
font.pointSize: 0.75*osSettings.systemFontSize
|
||||
text: friendica_activities_view.attendmaybeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)}
|
||||
}
|
||||
}
|
||||
Label{
|
||||
id:attendLabel
|
||||
color: "grey"
|
||||
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)):""
|
||||
}
|
||||
}
|
||||
CheckBox{
|
||||
id: dislikeCheckbox
|
||||
width:newsitem.width/5 //10*mm
|
||||
height: parent.height
|
||||
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
|
||||
checked: (newsitemobject.friendica_activities_view.self.disliked==1)?true:false
|
||||
indicator: Rectangle{
|
||||
implicitWidth: newsitem.width/5 //10*mm
|
||||
implicitHeight:4*mm
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.family:fontAwesome.name
|
||||
color:dislikeCheckbox.checked?"black": "grey"
|
||||
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119"
|
||||
|
||||
//Bottom row for buttons
|
||||
Row{id:controlrow
|
||||
anchors.top:friendicaActivities.bottom
|
||||
height: root.fontFactor*osSettings.bigFontSize
|
||||
CheckBox{
|
||||
id:likeCheckbox
|
||||
width:newsitem.width/5 //10*mm
|
||||
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{
|
||||
implicitWidth: newsitem.width/5 //10*mm
|
||||
implicitHeight:root.fontFactor*osSettings.bigFontSize
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family:fontAwesome.name
|
||||
color:likeCheckbox.checked?"black": "grey"
|
||||
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
|
||||
}
|
||||
}
|
||||
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});
|
||||
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});
|
||||
}}
|
||||
}
|
||||
CheckBox{
|
||||
id: dislikeCheckbox
|
||||
width:newsitem.width/5 //10*mm
|
||||
height: parent.height
|
||||
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
|
||||
checked: (newsitemobject.friendica_activities_view.self.disliked==1)?true:false
|
||||
indicator: Rectangle{
|
||||
implicitWidth: newsitem.width/5 //10*mm
|
||||
implicitHeight:root.fontFactor*osSettings.bigFontSize
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family:fontAwesome.name
|
||||
color:dislikeCheckbox.checked?"black": "grey"
|
||||
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119"
|
||||
}
|
||||
}
|
||||
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});
|
||||
}}
|
||||
}
|
||||
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});
|
||||
}}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id:favoritedCheckbox
|
||||
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
|
||||
width: newsitem.width/5 // 10*mm
|
||||
height: parent.height
|
||||
indicator:Rectangle{
|
||||
implicitWidth: newsitem.width/5 //10*mm
|
||||
implicitHeight:4*mm
|
||||
CheckBox {
|
||||
id:favoritedCheckbox
|
||||
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
|
||||
width: newsitem.width/5 // 10*mm
|
||||
height: parent.height
|
||||
indicator:Rectangle{
|
||||
implicitWidth: newsitem.width/5 //10*mm
|
||||
implicitHeight:root.fontFactor*osSettings.bigFontSize
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family:fontAwesome.name
|
||||
color: favoritedCheckbox.checked?"black":"grey"
|
||||
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}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: newsitem.width/5 //10*mm
|
||||
height: parent.height
|
||||
visible:(newsitemobject.messagetype!==2)
|
||||
color:"transparent"
|
||||
Text{
|
||||
id:newsmenusymbol
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family:fontAwesome.name
|
||||
color: favoritedCheckbox.checked?"black":"grey"
|
||||
text:"\uf005"
|
||||
text: "\uf142"
|
||||
}
|
||||
}
|
||||
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}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: newsitem.width/5 //10*mm
|
||||
height: parent.height
|
||||
visible:(newsitemobject.messagetype!==2)
|
||||
color:"transparent"
|
||||
Text{
|
||||
id:newsmenusymbol
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.family:fontAwesome.name
|
||||
text: "\uf142"
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked: {newsmenu.popup()}}
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id:newsmenu
|
||||
width: 30*mm
|
||||
delegate: MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3*mm
|
||||
text: parent.text
|
||||
}
|
||||
}
|
||||
Action{
|
||||
text: qsTr("Reply")
|
||||
onTriggered: {
|
||||
var directmessage=0;
|
||||
if (newsitemobject.messagetype==1){ directmessage=1}
|
||||
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
|
||||
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
|
||||
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
|
||||
}
|
||||
}
|
||||
Action {
|
||||
text: qsTr("DM")
|
||||
onTriggered: {
|
||||
root.directmessageSignal(newsitemobject.user.screen_name);
|
||||
}
|
||||
}
|
||||
Action {
|
||||
text: qsTr("Repost")
|
||||
onTriggered: {
|
||||
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
|
||||
Helperjs.showMessage("Repost",qsTr("Success!"),root)
|
||||
})
|
||||
}
|
||||
}
|
||||
Action {
|
||||
text: qsTr("Conversation")
|
||||
onTriggered: {
|
||||
pushConversation();
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked: {newsmenu.popup()}}
|
||||
}
|
||||
}
|
||||
|
||||
Menu{
|
||||
title: qsTr("Attending")
|
||||
width: 20*mm
|
||||
Menu {
|
||||
id:newsmenu
|
||||
width: 18*osSettings.FontSize
|
||||
delegate: MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
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"})
|
||||
text: qsTr("Reply")
|
||||
onTriggered: {
|
||||
var directmessage=0;
|
||||
if (newsitemobject.messagetype==1){ directmessage=1}
|
||||
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
|
||||
var conversation;
|
||||
if (newsitem.ListView.view.viewtype=="conversation"){conversation=true}
|
||||
else{conversation=false};
|
||||
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
|
||||
}
|
||||
}
|
||||
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("DM")
|
||||
onTriggered: {
|
||||
root.directmessageSignal(newsitemobject.user.screen_name);
|
||||
}
|
||||
}
|
||||
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"})}
|
||||
Action {
|
||||
text: qsTr("Repost")
|
||||
onTriggered: {
|
||||
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
|
||||
Helperjs.showMessage("Repost",qsTr("Success!"),root)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Delete")
|
||||
onTriggered: {
|
||||
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
|
||||
var msg = {'deleteId': index, 'model': newsModel};
|
||||
newsWorker.sendMessage(msg);
|
||||
})
|
||||
Action {
|
||||
text: qsTr("Conversation")
|
||||
onTriggered: {
|
||||
pushConversation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Show height")
|
||||
onTriggered: {
|
||||
Helperjs.showMessage("Height",itemMessage.height + "toprow: "+ toprow.height,root)
|
||||
Menu{
|
||||
title: qsTr("Attending")
|
||||
width: 10*osSettings.systemFontSize
|
||||
delegate: MenuItem{
|
||||
contentItem: Text{
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
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"})}
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
text: qsTr("Delete")
|
||||
onTriggered: {
|
||||
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
|
||||
var msg = {'deleteId': index, 'model': newsModel};
|
||||
newsWorker.sendMessage(msg);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//MenuItem{
|
||||
// text:qsTr("Show on website")
|
||||
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
|
||||
//}
|
||||
}
|
||||
Column{
|
||||
id:conversationColumn
|
||||
anchors.top:controlrow.bottom
|
||||
width: newsitem.width
|
||||
}
|
||||
|
||||
|
||||
//MenuItem{
|
||||
// text:qsTr("Show on website")
|
||||
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
|
||||
//}
|
||||
}
|
||||
Column{
|
||||
id:conversationColumn
|
||||
anchors.top:controlrow.bottom
|
||||
//anchors.right: parent.right
|
||||
width: newsitem.width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,10 +42,8 @@ Rectangle{
|
|||
width: messageColumn.width-5*mm
|
||||
height:root.height/2
|
||||
|
||||
Button{
|
||||
MButton{
|
||||
id:closeButton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
|
@ -62,20 +60,20 @@ Rectangle{
|
|||
position:TabBar.Header
|
||||
TabButton {
|
||||
text:qsTr("Unicode")
|
||||
font.pixelSize: 2*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Standard")
|
||||
font.pixelSize: 2*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Addon")
|
||||
font.pixelSize: 2*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
|
||||
TabButton {
|
||||
text: qsTr("Adult")
|
||||
font.pixelSize: 2*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +84,7 @@ Rectangle{
|
|||
anchors.top: closeButton.bottom
|
||||
anchors.topMargin: 1*mm
|
||||
width: smileyDialog.width-2*mm
|
||||
height: smileyDialog.height-7*mm
|
||||
height: smileyDialog.height-4*root.fontFactor*osSettings.bigFontSize
|
||||
Rectangle{
|
||||
id: htmlGridTab
|
||||
GridView {
|
||||
|
@ -177,10 +175,6 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Component{
|
||||
id:smileyItem
|
||||
|
@ -207,7 +201,7 @@ Rectangle{
|
|||
width:4.5*mm
|
||||
height: 4.5*mm
|
||||
textFormat:Text.RichText
|
||||
font.pixelSize: 4*mm
|
||||
font.pointSize: 1.2*osSettings.systemFontSize
|
||||
text: emoji
|
||||
|
||||
MouseArea{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue