v0.6.2 Follow and Unfollow contacts, Systray on Linux

This commit is contained in:
LubuWest 2021-08-03 21:19:53 +02:00
commit baccd64303
37 changed files with 724 additions and 636 deletions

View file

@ -176,8 +176,7 @@ Rectangle {
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
// currentIndex: count
// onCurrentIndexChanged:{print("Index "+currentIndex)}
model: CalendarModel {id:calendarModel
from: new Date()
to: new Date(new Date().valueOf()+93312000000)

View file

@ -69,11 +69,10 @@ Rectangle{
id: eventModel
}
Component.onCompleted:{//print("daylist"+JSON.stringify(events) + dayint)
Component.onCompleted:{
var currentevents=events.filter(event=>(dayint>=event.startday)&&(dayint<=event.endday));
for (var i=0; i<currentevents.length;i++){
var liststate="";if(currentevents.length<2){liststate="large"};
//print(JSON.stringify(events[daylist[i]]));
eventModel.append({"event":currentevents[i],"eventstatus":liststate});
}
}

View file

@ -148,7 +148,6 @@ Page{
TextField {
id: password
x: root.fontFactor*osSettings.bigFontSize; y: 9*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
//font.pixelSize:3*mm
font.pointSize: osSettings.systemFontSize
selectByMouse: true
echoMode: TextInput.Password
@ -218,9 +217,7 @@ Page{
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
//else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
//else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")}
else {errormessage=""}
if (errormessage=="") {
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){
@ -231,9 +228,8 @@ Page{
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
//print("imagestore" + userconfig.imagestore + " path "+ filesystem.homePath+"/"+username.text)
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
{//filesystem.Directory=filesystem.homePath;
{
filesystem.makePath(filesystem.homePath+"/"+username.text);
}
filesystem.Directory=imagestoredir //userconfig.imagestore;
@ -271,9 +267,7 @@ Page{
anchors.right: parent.right
anchors.rightMargin: 1*mm
MButton {
//x: parent.width/2+4*mm; y: mm;
width: 5*mm;
//height: 3*root.fontFactor*osSettings.bigFontSize
visible: users.length>0
text: "-"
font.pointSize: osSettings.bigFontSize
@ -303,8 +297,6 @@ Page{
}}
MButton {
//x: parent.width/2+10*mm; y: mm; //width: 5*mm; height: 8*mm;
//height: 3*root.fontFactor*osSettings.bigFontSize
width: 5*mm;
visible: users.length>0
text: "+"
@ -321,8 +313,6 @@ Page{
}
MButton {
//x: parent.width-12*mm; y: mm; //width: 5*mm; height: 8*mm;
//height: 3*root.fontFactor*osSettings.bigFontSize
width: 5*mm;
text: "?"
font.pointSize: osSettings.bigFontSize
@ -332,7 +322,6 @@ Page{
}
MButton{
id:closeButton
//height: 3*root.fontFactor*osSettings.bigFontSize
width: 5*mm;
visible: users.length>0
text: "\uf057"

View file

@ -44,7 +44,7 @@ Page{
width: root.width-mm
font.pointSize: osSettings.systemFontSize
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.6.1 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.6.2 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+

View file

@ -42,13 +42,6 @@ Rectangle{
height:parent.height-7*mm
width:parent.width
y:7*mm
// MouseArea {
// anchors.fill:parent;
// onClicked:{
// //print(url)
// }
// }
//onLoadingChanged: print(loadProgress)
}
Button{
id:closeButton

View file

@ -69,7 +69,6 @@ Rectangle{
onTextChanged: {
Service.updateglobaloptions(root.db,"syncinterval",text);
if(osSettings.osType=="Android"){
//print("setalarm")
alarm.setAlarm(text);
} else if(osSettings.osType=="Linux" && text !=0){
root.updateSyncinterval(parseInt(text))
@ -89,10 +88,8 @@ Rectangle{
y:7*root.fontFactor*osSettings.bigFontSize
clip:true
Column{
//height: implicitHeight
width: parent.width
spacing:mm
//anchors.fill: parent
SyncComponent{adapter:"Timeline"}
SyncComponent{adapter:"Replies"}
SyncComponent{ adapter:"DirectMessages"}

View file

@ -46,8 +46,8 @@ Item{
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(root.db,"friendshiprequests",login.username,function(friendrequestsobject){
for (var i=0;i<friendrequestsobject.length;i++){//print(Qt.atob(friendrequestsobject[i].note));
Helperjs.readData(db,"friendshiprequests",login.username,function(friendrequestsobject){
for (var i=0;i<friendrequestsobject.length;i++){
if (friendrequestsobject[i].note!=null){
friendrequestsobject[i].description=Qt.atob(friendrequestsobject[i].note);}
else{friendrequestsobject[i].description=""}
@ -60,7 +60,7 @@ Item{
friendsModel.append({"contact":friendrequestsobject[i],"contactType":qsTr("Friend Requests")});
}
});
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
Helperjs.readData(db,"contacts",login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
if(friendsobject[i].description!=""){
friendsobject[i].description=Qt.atob(friendsobject[i].description);}
@ -76,7 +76,6 @@ Item{
target:xhr
function onDownloaded(type,url,filename,i){
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
friendsGridTab.currentContact=i+1;
if(friendsGridTab.currentContact==root.newContacts.length){
friendsGridTab.showFriends(root.login.username)

View file

@ -54,7 +54,7 @@ Rectangle {
function buildProfiletext(pobject,callback){
var profileobject={};
var profiletext="";
for (var key in pobject){//print(key+obj[key])
for (var key in pobject){
if(pobject[key]!=""&&pobject[key]!=null&&key!="users"&&key!="profile_id"){
var keytext="";
switch(key){

View file

@ -34,10 +34,11 @@ import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import QSystemTrayIcon 1.0
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
import "qrc:/qml/configqml"
ApplicationWindow{
id:root
@ -69,12 +70,11 @@ ApplicationWindow{
property var news:[]
property var newContacts:[]
property var contactposts:[]
//property string contactLoadType: ""
property bool imagePicking: false
function onLoginChanged(login){
if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{//rootstackView.push(rootstack)
else{
if (login.newsViewType!="" || login.newsViewType!=null){
newstab.newstabstatus=login.newsViewType;}
Newsjs.getCurrentContacts(login,db,function(contacts){
@ -97,7 +97,10 @@ ApplicationWindow{
xhr.setImagedir(login.imagestore);
xhr.getlist();
}
}
function showContact(contact){ //print(JSON.stringify(contact));
rootstackView.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact})
}
Connections {
@ -108,6 +111,7 @@ ApplicationWindow{
}
}
}
Connections {
target: root
function onHeightChanged(appHeight) {
@ -117,12 +121,6 @@ ApplicationWindow{
}
}
function showContact(contact){ //print(JSON.stringify(contact));
rootstackView.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact})
}
Connections{
target:xhr
function onDownloaded(type,url,filename,i){
@ -136,12 +134,9 @@ ApplicationWindow{
}
}
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
//Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
onClosing: {
//if (event.key === osSettings.backKey) {
if (rootstack.currentIndex==0){
newstab.active=true;
if (newstab.newstabstatus!=globaloptions.newsViewType){
@ -168,15 +163,20 @@ ApplicationWindow{
Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
if (osSettings.osType=="Android"){
Qt.quit()}
else{
systemTray.show();
systemTray.showMessage("",qsTr("Background Sync\n Rightclick or Middleclick to Quit"),"",5000)
root.hide()
}
})
})})
close.accepted=true
}
}
else if (rootstack.currentIndex==2){fotoSignal("backButton")}
else {rootstack.currentIndex=0}
//event.accepted = true
//}
else if (rootstack.currentIndex==2){fotoSignal(login.username,"backButton");print("close rootstack currentindex==2");close.accepted=false}
else {rootstack.currentIndex=0;close.accepted=false}
}
@ -239,32 +239,17 @@ ApplicationWindow{
visible:!wideScreen
}
// states: State {
// name: "fullscreen";
// PropertyChanges { target: bar; height:0 }
// PropertyChanges { target: rootstack; height:parent.height }
// }
// transitions: Transition {
// PropertyAnimation { properties: "height";
// easing.type: Easing.InOutQuad
// duration: 1000
// }
// }
StackView{id:rootstackView
width:root.width
height: root.height
initialItem: StackLayout{
id:rootstack
width:rootstackView.width
height: rootstackView.height//-7*mm
//y:wideScreen?7*mm:0
height: rootstackView.height
currentIndex:bar.currentIndex
Loader{
id: newstab
Layout.fillWidth:true
Layout.fillHeight: true
property string newstabstatus
property var conversation:[]
@ -272,27 +257,44 @@ StackView{id:rootstackView
}
Loader{
id: friendstab
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
}
Loader{
id: fotostab
property string phototabstatus:"Images"
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
}
Loader{
id: calendartab
property string calendartabstatus:"Events"
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
}
}
}
//}
}
QSystemTrayIcon {
id: systemTray
visible: false
onActivated: {
if(reason === 3){
root.show();
bar.currentIndex=0;
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
newstypeSignal(newstab.newstabstatus)
systemTray.hide()
} else {
Qt.quit()
}
}
Component.onCompleted: {
icon = iconTray
toolTip = qsTr("Click to open Friendiqa")
hide()
}
}
Component.onCompleted: {
onLoginChanged(login);
globaloptions=Service.readGO(db);
@ -306,5 +308,4 @@ StackView{id:rootstackView
var LinuxSyncQml = component.createObject(root);
}
}
//}
}

View file

@ -86,7 +86,7 @@ Item {
id: descriptionlabel
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)//contentWidth+2*mm//wrapper.width-8*mm
height: 2*root.fontFactor*osSettings.systemFontSize//2.5*mm
text: contact.description
text: Qt.atob(contact.description)!=""?contact.description:""
elide:contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: "#303030"
font.pointSize: osSettings.systemFontSize
@ -96,9 +96,6 @@ Item {
anchors.fill: parent
onClicked:{
contactComponent.ListView.view.processContactSelection(contact)
// rootstack.currentIndex=0;
// bar.currentIndex=0;
// root.contactdetailsSignal(contact)
}
}
}

View file

@ -57,7 +57,7 @@ Item {
y:2*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && friendsTabView.currentIndex==0
font.bold: account.username==login.username && friendsTabView.currentIndex==0
text: " "+qsTr("Profile")
MouseArea{
anchors.fill:parent

View file

@ -257,6 +257,42 @@ Page {
rootstackView.pop()
}
}
BlueButton{
id:followbutton
visible:(contact.isFriend==0)
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Follow")
onClicked:{
contactBusy.running=true;
Helperjs.friendicaPostRequest(login,"/api/v1/accounts/" + contact.id + "/follow",'',"POST",root,function(returnvalue){
Helperjs.updateData(db,"contacts",login.username,"isFriend",1,function(){},"id",contact.id)
root.friendsSignal(login.username);
rootstackView.pop()
// var username=login.username
//
});
}
}
BlueButton{
id:unfollowbutton
visible:(contact.isFriend==1)
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Unfollow")
onClicked:{
Helperjs.friendicaPostRequest(login,"/api/v1/accounts/" + contact.id + "/unfollow",'',"POST",root,function(returnvalue){
contactBusy.running=true;
Helperjs.updateData(db,"contacts",login.username,"isFriend",0,function(){},"id",contact.id)
root.friendsSignal(login.username);
rootstackView.pop()
});
}
}
}//Flow end
Label {
id: namelabel
@ -284,7 +320,7 @@ Page {
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+
text:"<b>"+qsTr("Description")+": </b> "+(Qt.atob(contact.description)!=""?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: {
@ -312,7 +348,7 @@ Page {
Connections{
target:root
function onContactpostsChanged(){
if (root.contactposts.length>0&&root.contactposts[0]!=null){profileimagesource=root.contactposts[0].user.profile_image_url_large}
if (root.contactposts.length>0&&root.contactposts[0]!=null){profileimagesource=root.contactposts[0].friendica_author.profile_image_url_large}
contactBusy.running=false;
contactModel.clear();
var currentTime= new Date();

View file

@ -1,67 +0,0 @@
// 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 "qrc:/js/helper.js" as Helperjs
//import QtWebView 1.1
Rectangle{
color:"transparent"
width:newscolumn.width;
height:newscolumn.width/4*3
property string url:""//htmlview.text
Text{id:htmlview
textFormat:Text.RichText
}
// WebView {id:htmlview;
// anchors.fill: parent
// }
Component.onCompleted:{
// Helperjs.friendicaWebRequest(url,parent,function(document){
// print(document);
//// var metas = document.getElementsByTagName('meta'); //get all the meta tag elements
//// //iterate through them
//// for (i=0; i<metas.length; i++) {
//// if (metas[i].getAttribute("name") == "keywords") {
//// print(metas[i].getAttribute("content"));
//// }
//// else if (metas[i].getAttribute("name") == "description") {
//// console.log(metas[i].getAttribute("content"));
//// }
//// }
// //print(html);
// htmlview.text=""
// })
}
}

View file

@ -133,7 +133,6 @@ Item {
}catch(e){" "}
}
}
//Component.onCompleted:print("Newsitemwidth "+newsitem.width+ " Indent "+newsitemobject.indent)
}
MouseArea{id: itemBody

View file

@ -55,7 +55,6 @@ StackView{
onNewimagesChanged:{
if(fotorectangle.newimages.length>0){
//print("newimages "+JSON.stringify(newimages));
var ownimagelist=[];
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<fotorectangle.newimages.length;i++){
@ -106,12 +105,12 @@ StackView{
function showFotos(login,friend){
if(friend=="backButton"){
if (photoStack.depth>1){photoStack.pop()}
if(!albumgridview.currentItem){root.currentIndex=0}
if(albumgridview.currentItem.state=='fullscreen'){
if (photoStack.depth > 1){photoStack.pop()}
else if(albumgridview.currentItem==null){rootstack.currentIndex=0}
else if(albumgridview.currentItem.state=='fullscreen'){
albumgridview.currentItem.state = 'inGrid'}
else if (albumgridview.currentItem.state == 'inGrid'){albumgridview.currentItem.state=''}
else{root.currentIndex=0}
else{rootstack.currentIndex=0}
}
else{
try {photogroupModel.clear()}catch (e){print(e)}