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

@ -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);
}
}
//}
}