forked from lubuwest/Friendiqa
v0.5.3 events and indentation
This commit is contained in:
parent
575c1b0e1e
commit
18c7255b91
103 changed files with 1601 additions and 1906 deletions
|
@ -1,6 +1,6 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
|
||||
// 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
|
||||
|
@ -30,7 +30,7 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.4
|
||||
import QtQuick.Controls 2.12
|
||||
//import QtQuick.Controls.Styles 2.3
|
||||
//import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/newsqml"
|
||||
|
@ -40,25 +40,7 @@ import "qrc:/js/service.js" as Service
|
|||
|
||||
Item {
|
||||
|
||||
// Connections{
|
||||
// target:xhr
|
||||
// onError:{
|
||||
// Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
// }
|
||||
// onSuccess:{
|
||||
// if (api=="/api/statuses/friends_timeline"){
|
||||
// // downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
// //Service.processNews(api,data);
|
||||
// if(login.newsViewType=="Timeline"){
|
||||
// Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
// else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
// showNews(dbnews);
|
||||
// })}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
onHeightChanged: {newsSwipeview.height=height-6*mm}
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {
|
||||
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
|
||||
|
@ -86,6 +68,50 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
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 onFriendsMessages(friend){
|
||||
newstab.newstabstatus="Contact"
|
||||
|
@ -126,7 +152,6 @@ Item {
|
|||
height: parent.height-6*mm
|
||||
y: 5*mm
|
||||
function onDirectMessage(friend){currentIndex=2}
|
||||
|
||||
transitions: Transition {
|
||||
PropertyAnimation { properties: "height";
|
||||
easing.type: Easing.InOutQuad
|
||||
|
@ -167,7 +192,7 @@ Item {
|
|||
source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||
}
|
||||
Component.onCompleted: {root.directmessageSignal.connect(onDirectMessage);}
|
||||
Component.onCompleted: {root.directmessageSignal.connect(onDirectMessage)}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue