v0.6.4 contact search

This commit is contained in:
LubuWest 2022-03-01 21:59:21 +01:00
commit 5032c78de1
57 changed files with 2218 additions and 2252 deletions

View file

@ -106,7 +106,7 @@ Rectangle {
id:leftDrawer
property var newstabstatus: newstab.newstabstatus
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
width: visible?root.fontFactor*osSettings.systemFontSize*15:0
height: root.height-bar.height
}
@ -126,6 +126,7 @@ Rectangle {
calBusy.running=true;
updatenews.setDatabase();
updatenews.login();
updatenews.setSyncAll(false);
updatenews.events();
// Service.getEvents(db,login, calendartab,function(){
// showEvents("")

View file

@ -281,7 +281,7 @@ Page{
font.pointSize: osSettings.bigFontSize
onClicked:{
accountBusy.running=true;//servername.displayText
var userconfig={server: servername.displayText, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir, maxnews:"",interval: ""};
var userconfig={server: servername.displayText, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir,interval: ""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
@ -305,6 +305,7 @@ Page{
filesystem.Directory=imagestoredir //userconfig.imagestore;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
userconfig.accountId=credentials.id
Service.storeConfig(db,userconfig);
Service.readConfig(db,function(userconfig){
Helperjs.readData(db,"config","",function(storedUsers){

View file

@ -35,9 +35,6 @@ import QtQuick.Controls.Material 2.12
import "qrc:/qml/genericqml"
Page{
//color:"white"
// width:infoBoxText.contentWidth
// height:infoBoxText.contentHeight
Text{id:infoBoxText
anchors.top:closeButton.bottom
anchors.topMargin: mm
@ -46,7 +43,7 @@ Page{
font.pointSize: osSettings.systemFontSize
color:Material.primaryTextColor
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.6.3 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.6.4 </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

@ -1,57 +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 QtQuick.Controls 2.12
import QtWebView 1.1
import "qrc:/qml/genericqml"
Rectangle{
color:"white"
property alias url:htmlview.url
WebView {id:htmlview;
height:parent.height-7*mm
width:parent.width
y:7*mm
}
Button{
id:closeButton
height: 3*root.fontFactor*osSettings.bigFontSize
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{root.pop()}
}
}

View file

@ -1,177 +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.0
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
Item {
id: contactLargeComponent
x:mm
y:mm
property var contact:({})
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>")
Rectangle {
id: wrapper
width:root.width-2*mm //friendsTabView.width;
height:root.height-20*mm// friendsTabView.height-15*mm
border.color: "grey"
color:"white"
radius: 0.5*mm
Image {
id: photoImage
x:mm
y:mm
width: 15*mm
height:15*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Label {
id: namelabel
x: mm
width: root.width-6*mm //friendsTabView.width-4*mm
height: 3*mm
text:contact.name+" (@"+contact.screen_name+")"
elide:Text.ElideRight
anchors.topMargin: 0
anchors.left: photoImage.left
color: "#303030"
font.pixelSize: 4*mm
anchors.top: photoImage.bottom
}
Rectangle{
id: detailsrectangle
anchors.top: namelabel.bottom
anchors.topMargin: 2*mm
ScrollView{
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
//frameVisible: true
id:namelabelflickable
width: root.width-10*mm
height:root.height-50*mm
x: mm
clip:true
Text{
id:namelabeltext
width: namelabelflickable.width
height: implicitHeight
font.pixelSize: 3*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: {
Qt.openUrlExternally(link)}
}
}
Row{
anchors.top: namelabelflickable.bottom
anchors.topMargin: 2*mm
x: mm
spacing:4
MButton{
id:photobutton
height: 6*mm
width: 8*mm
text: "\uf03e" // "Photos"
visible:(contact.network=="dfrn")
onClicked:{
fotostab.phototabstatus="Contact";
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(contact) ;
contactLargeComponent.destroy();
}
}
MButton{
id:messagebutton
height: 6*mm
width: 8*mm
text: "\uf0e6" //"Messages"
onClicked:{
root.currentIndex=0;
//newstab.active=true;
root.messageSignal(contact) ;
contactLargeComponent.destroy();
}
}
MButton{
id:dmbutton
visible: (contact.following=="true")
height: 6*mm
width: 8*mm
text: "\uf040" //"DM"
onClicked:{
root.currentIndex=0;
root.directmessageSignal(contact.screen_name);
contactLargeComponent.destroy();
}
}
MButton{
id:eventbutton
visible:(contact.network=="dfrn")
height: 6*mm
width: 8*mm
text:"\uf073" //Events
onClicked:{
root.currentIndex=3;
calendartab.active=true;
calendartab.calendartabstatus="Friend"
root.eventSignal(contact);
contactLargeComponent.destroy();
}
}
MButton{
id: closeButton
height: 6*mm
width: 8*mm
text: "\uf057" //"close"
onClicked:{contactLargeComponent.destroy();
}
}
}
}
}
}

View file

@ -31,11 +31,12 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
//import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
@ -44,14 +45,16 @@ Item{
Layout.fillWidth:true
Layout.fillHeight: true
function showContacts(contact){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
try {contactsModel.clear()} catch(e){};
Newsjs.listFriends(login,db,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
if(Helperjs.getCount(db,login,"contacts","screen_name",contactsobject[j].screen_name)>1){
contactsobject[j].screen_name=contactsobject[j].screen_name+"+"+contactsobject[j].cid
}
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
},searchText.text,-1);
}
MButton {
id: cleanButton
@ -61,17 +64,40 @@ Item{
anchors.right: parent.right
onClicked: {
Service.cleanContacts(root.login,root.db,function(){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
showContacts()
// try {contactsModel.clear()} catch(e){print(e)};
// Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
// for (var j=0;j<contactsobject.length;j++){
// contactsobject[j].description=Qt.atob(contactsobject[j].description);
// contactsobject[j].name=Qt.atob(contactsobject[j].name);
// contactsModel.append({"contact":contactsobject[j]});
// }
// },"isFriend",0,"screen_name ASC");
})
}
}
Rectangle {
id:searchComponent
x: mm; y:mm
color: Material.backgroundColor
radius:0.5*mm
width: 10*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
TextField {
id: searchText
color: Material.primaryTextColor
focus: true
font.pointSize: osSettings.systemFontSize
wrapMode: Text.Wrap
anchors.fill:parent
selectByMouse: true
cursorVisible: false
placeholderText: "\uf0b0"
onTextChanged: {showContacts(root.login.username)}
}
}
ListView {
id: contactsView
x:mm

View file

@ -0,0 +1,169 @@
// 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.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Page{
id: contactsSearchPage
function search(term){
contactSearchBusy.running=true;
try {contactsSearchModel.clear()} catch(e){};
xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/v1/accounts/search");
xhr.setParam("q",term);
xhr.setParam("limit",99)
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);}
contactSearchBusy.running=false;
}
function onSuccess(data,api){
if (api=="/api/v1/accounts/search" && data!=""){
try{var searchlist = JSON.parse(data);}catch(e){print("Error "+e)}
contactSearchBusy.running=false;
if (Array.isArray(searchlist)){
searchlist.sort(function(a,b){
if (a.group > b.group) {
return -1;
}
if (a.group < b.group) {
return 1;
}
return 0
})
for (let i=0;i<searchlist.length;i++){
if (searchlist[i].id!="0"){
if (searchlist[i].note!=null){
searchlist[i].description=searchlist[i].note;}
else{searchlist[i].description=""}
searchlist[i].name=(searchlist[i].display_name);
searchlist[i].screen_name=searchlist[i].username;
searchlist[i].location="";
searchlist[i].profile_image=""
searchlist[i].profile_image_url=searchlist[i].avatar;
searchlist[i].curIndex=contactsSearchModel.count;
let contactType="";
if (searchlist[i].group){contactType=qsTr("Forum")}
//else if (contactlist[i].bot){contactType=qsTr("Bot")}
else{contactType=qsTr("Person")}
contactsSearchModel.append({"contact":searchlist[i],"contactType":contactType});
}
}
}
}
}
}
MButton {
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"
onClicked: {
rootstackView.pop()
}
}
Search{
y:0.5*root.fontFactor*osSettings.bigFontSize;
x:1.5*root.fontFactor*osSettings.systemFontSize;
width:root.width-(7*root.fontFactor*osSettings.systemFontSize+mm);
height: 2.5*root.fontFactor*osSettings.systemFontSize;
color:Material.dialogColor
selfdestroying:false
}
BusyIndicator{
id: contactSearchBusy
anchors.centerIn:parent
width:10*mm
height: 10*mm
running: false
}
Component {
id: sectionHeading
Rectangle {
width: contactsSearchView.width
height: childrenRect.height
color: Material.backgroundColor
required property string section
Text {
color: Material.secondaryTextColor
text: parent.section
font.bold: true
font.pointSize: osSettings.bigFontSize
}
}
}
ListView {
id: contactsSearchView
x:mm
y:4*root.fontFactor*osSettings.bigFontSize;
width:root.width-2*mm
height: root.height-7*root.fontFactor*osSettings.bigFontSize;
spacing: 2
clip: true
function processContactSelection(contactobject){contactobject.searchContact=true;showContact(contactobject)}
model: contactsSearchModel
delegate: ContactComponent { }
section.property: "contactType"
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
}
ListModel{id: contactsSearchModel}
// Component.onCompleted: {
// friendsTabView.contactsSignal.connect(showContacts);
// showContacts()
// }
}

View file

@ -46,7 +46,7 @@ Item{
property int currentContact: 0
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
try {friendsModel.clear()} catch(e){};
Helperjs.readData(db,"friendshiprequests",login.username,function(friendrequestsobject){
for (var i=0;i<friendrequestsobject.length;i++){
if (friendrequestsobject[i].note!=null){
@ -61,18 +61,18 @@ Item{
friendsModel.append({"contact":friendrequestsobject[i],"contactType":qsTr("Friend Requests")});
}
});
Helperjs.readData(db,"contacts",login.username,function(friendsobject){
Newsjs.listFriends(login,db,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
if(friendsobject[i].description!=""){
friendsobject[i].description=Qt.atob(friendsobject[i].description);}
friendsobject[i].name=Qt.atob(friendsobject[i].name);
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
}
friendsModel.append({"contact":friendsobject[i],"contactType":qsTr("Friends")});
}
},"isFriend",1,"screen_name ASC");
},(searchText.text==""?searchText.preeditText:searchText.text));
}
Connections{
target:xhr
function onDownloaded(type,url,filename,i){
@ -84,6 +84,7 @@ Item{
}
}
}
MButton {
id: updateFriendsButton
text: "\uf021"
@ -95,6 +96,7 @@ Item{
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){});
updatenews.setDatabase();
updatenews.login();
updatenews.setSyncAll(false);
updatenews.friendrequests();
//root.contactLoadType="friends";
Newsjs.requestFriends(root.login,db,root,function(nc){
@ -115,12 +117,34 @@ Item{
value: friendsGridTab.currentContact/root.newContacts.length
}
Rectangle {
id:searchComponent
x: mm; y:mm
color: Material.backgroundColor
radius:0.5*mm
width: 10*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
TextField {
id: searchText
color: Material.primaryTextColor
focus: true
font.pointSize: osSettings.systemFontSize
wrapMode: Text.Wrap
anchors.fill:parent
selectByMouse: true
cursorVisible: false
placeholderText: "\uf0b0"
onTextChanged: if (text.length>0){showFriends(root.login.username)}
onPreeditTextChanged: {if (preeditText.length>0){showFriends(root.login.username)}}
}
}
Component {
id: sectionHeading
Rectangle {
width: friendsView.width
height: childrenRect.height
color: Material.dialogColor //color: "lightsteelblue"
color: Material.backgroundColor
required property string section
Text {
color: Material.secondaryTextColor
@ -131,6 +155,28 @@ Item{
}
}
//GridView {
Component { id:headerComponent
Rectangle{
color: Material.dialogColor
width:friendsView.width
height:6*mm
Text{
color: Material.primaryTextColor
font.pointSize: osSettings.bigFontSize
anchors.centerIn: parent
text:"\uf234"
}
MouseArea{
anchors.fill:parent
onClicked:{
rootstackView.push("qrc:/qml/contactqml/ContactsSearchPage.qml")
}
}
}
}
ListView{
id: friendsView
x:mm
@ -145,6 +191,7 @@ Item{
// }
model: friendsModel
delegate: ContactComponent { }
header:headerComponent
section.property: "contactType"
section.criteria: ViewSection.FullString
section.delegate: sectionHeading

View file

@ -65,38 +65,38 @@ Rectangle {
TabBar {
id: friendsbar
width: osSettings.osType=="Android"?parent.width-2*osSettings.bigFontSize:parent.width
height: 9*mm
x: osSettings.osType=="Android"?2*osSettings.bigFontSize:0
width: osSettings.osType=="Android"?parent.width-2*root.fontFactor*osSettings.bigFontSize:parent.width
height: 2*root.fontFactor*osSettings.bigFontSize
x: osSettings.osType=="Android"?2*root.fontFactor*osSettings.bigFontSize:0
visible: !wideScreen
position:TabBar.Header
currentIndex: 1
TabButton {
text: qsTr("Me")
font.pointSize: osSettings.systemFontSize
height: 7*mm
height: 1.7*root.fontFactor*osSettings.bigFontSize//7*mm
}
TabButton {
text: qsTr("Friends")
font.pointSize: osSettings.systemFontSize
height: 7*mm
height: 1.7*root.fontFactor*osSettings.bigFontSize//7*mm
}
TabButton {
text: qsTr("Contacts")
font.pointSize: osSettings.systemFontSize
height: 7*mm
height: 1.7*root.fontFactor*osSettings.bigFontSize//7*mm
}
TabButton {
text: qsTr("Groups")
font.pointSize: osSettings.systemFontSize
height: 7*mm
height: 1.7*root.fontFactor*osSettings.bigFontSize//7*mm
}
}
LeftDrawerLinux{
id:leftDrawer
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
width: visible?root.fontFactor*osSettings.systemFontSize*15:0
height: root.height-bar.height
}

View file

@ -56,16 +56,8 @@ Item {
height: parent.height-mm
radius: 0.5*mm
border.color: "grey"
color:Material.backgroundColor//"white"
color:Material.backgroundColor
// Image {
// id: photoImage
// x:1
// y:1
// width: 10*mm
// height:10*mm
// source:"qrc:/images/defaultcontact.jpg"
// }
Rectangle{
id:namelabelRect
x: 1
@ -147,112 +139,7 @@ Item {
delegate: ContactComponent { }// groupMember
function processContactSelection(contactobject){showContactdetails(contactobject)}
}
ListModel{id: groupModel}
// Component {
// id:groupMember
// Rectangle{
// width:parent.width
// height:6*mm
// Rectangle{id:memberrectangle
// border.color: "#EEEEEE"
// border.width: 1
// width:parent.width-12*mm
// height:6*mm
// Image {
// id: memberImage
// x:1
// y:1
// width: 5*mm
// height:5*mm
// source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
// onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
// }
// Text{
// font.pixelSize: 3*mm
// anchors.left: memberImage.right
// anchors.margins: 1*mm
// width:parent.width-1
// text:groupmember.name
// }
// MouseArea{
// anchors.fill: parent
// onClicked:{
//// root.currentIndex=1;
//// friendstab.active=true;
//// root.contactdetailsSignal(groupmember)
// root.currentIndex=0;
// root.contactdetailsSignal(groupmember)
// }
// }
// // BlueButton{
// // anchors.left: memberrectangle.right
// // anchors.margins: 1*mm
// // text: "\uf056"
// // onClicked:{
// // groupModel.remove(index)
// // }
// // }
// }
// }
// }
// Row{
// anchors.top: groupListView.bottom
// anchors.topMargin: mm
// spacing: mm
// }
// BlueButton{
// id: addMembers
// text:"\uf234"
// onClicked: {
// Newsjs.listFriends(root.login,root.db,function(userdata){
// var newlistcontacts=[];
// for (var n in userdata){
// if (groupmembers.indexOf(userdata[n].id)==-1){
// newlistcontacts.push(userdata[n])
// }
// }
// var component = Qt.createComponent("qrc:/qml/contactqml/Contactlist.qml");
// var contactlistobject = component.createObject(groupListView,{"possibleUsers":newlistcontacts});
// })
// }
// }
// BlueButton{
// id: updateButton
// text: "\uf0ee"
// onClicked:{
// var groupobject={};
// var groupmembers=[];
// for (var i=0;i<groupModel.count;i++){groupmembers.push(groupModel.get(i).groupmember)}
// try{ groupobject.id=group.gid} catch(e){};
// try{ groupobject.new=group.new} catch(e){};
// if (namelabel.text==""){
// Helperjs.showMessage(qsTr("Error"),qsTr("No name given"),root)}
// else {
// groupobject.name=namelabel.text;
// groupobject.user=groupmembers;
// updateGroup(login,db,groupobject)
// groupComponent.state="";
// }
// }
// }
// BlueButton{
// id: deleteButton
// text: "\uf056"
// onClicked:{
// Newsjs.deleteGroup(root.login,root.db,root,group,function(){
// groupComponent.state="";
// groupsModel.remove(index)})
// }
// }
}
Component.onCompleted:{if(group.new){groupComponent.state="large"}}
}
@ -262,12 +149,7 @@ Item {
name: "large"
PropertyChanges { target: groupComponent; height: groupsView.height - 6*root.fontFactor*osSettings.bigFontSize }
PropertyChanges { target: namelabel; font.pointSize: 1.2*osSettings.bigFontSize; readOnly:false}
//PropertyChanges { target: namelabelRect; height: 2*osSettings.bigFontSize}
PropertyChanges { target: closeButton; visible: true}
//PropertyChanges { target: groupComponent; z: 2 }
//PropertyChanges { target: wrapper; width:groupsView.width-2*mm;height:groupsView.height -2*mm-1}
//PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
//PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; visible:true }
PropertyChanges { target: infobutton; visible: false}
}

View file

@ -76,17 +76,17 @@ Item{
}
}
}
MButton {
id: updateGroupsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
anchors.rightMargin: mm
onClicked: {
Newsjs.requestGroups(root.login,root.db,root,function(){
groupsGridTab.showGroups(root.login.username)})}
}
// MButton {//requestGroups() not working with Friendica 02/2022
// id: updateGroupsButton
// text: "\uf021"
// anchors.top: parent.top
// anchors.topMargin: mm
// anchors.right: parent.right
// anchors.rightMargin: mm
// onClicked: {
// Newsjs.requestGroups(root.login,root.db,root,function(){
// groupsGridTab.showGroups(root.login.username)})}
// }
// BlueButton {
// id: newGroupButton
// text: "\uf234"
@ -103,7 +103,7 @@ Item{
x:mm
y:updateGroupsButton.height+4*mm
width:groupsGridTab.width-2*mm
height:groupsGridTab.height-updateGroupsButton.height-2*mm
height:groupsGridTab.height-2*mm//-updateGroupsButton.height
clip: true
// cellHeight: 16*mm
// cellWidth: 17*mm

View file

@ -74,7 +74,7 @@ ApplicationWindow{
property bool imagePicking: false
Material.theme: Material.System // globaloptions.view_darkmode==1?Material.Dark:Material.Light
Material.theme: Material.System
color: Material.backgroundColor
function onLoginChanged(login){
@ -104,7 +104,7 @@ ApplicationWindow{
}
}
function showContact(contact){ //print(JSON.stringify(contact));
function showContact(contact){
rootstackView.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact})
}
@ -143,14 +143,14 @@ ApplicationWindow{
onClosing: {
if (rootstack.currentIndex==0){
newstab.active=true;print("newstabstatus "+newstab.newstabstatus + " newsViewType " +globaloptions.newsViewType)
newstab.active=true;
if (newstab.newstabstatus!=globaloptions.newsViewType){
newstab.newstabstatus=globaloptions.newsViewType;
if(globaloptions.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,0,function(dbnews){
newsSignal(dbnews)
})}
else{
Newsjs.chatsfromdb(db,login.username,0,function(dbnews){
Newsjs.chatsfromdb(db,login.username,0,[],function(dbnews){
newsSignal(dbnews)
})}
close.accepted=false;
@ -164,13 +164,14 @@ ApplicationWindow{
root.pop();
close.accepted=false
}
else{print("Closing");
Service.cleanNews(root.db,function(){print("cleannews");
Service.cleanHashtags(root.db,function(){print("cleanhashtags");
Service.cleanContacts(root.login,root.db,function(){print("cleancontacts");
if (osSettings.osType=="Android"){
Qt.quit()}
else{print("show systray")
else{
Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
if (osSettings.osType=="Android" || !iconTrayAvailable){
Qt.quit()
}
else{
systemTray.show();
systemTray.showMessage("",qsTr("Background Sync\n Rightclick or Middleclick to Quit"),"",5000)
root.hide()
@ -180,7 +181,7 @@ ApplicationWindow{
close.accepted=true
}
}
else if (rootstack.currentIndex==2){fotoSignal(login.username,"backButton");print("close rootstack currentindex==2");close.accepted=false}
else if (rootstack.currentIndex==2){fotoSignal(login.username,"backButton");close.accepted=false}
else {rootstack.currentIndex=0;close.accepted=false}
}
@ -191,24 +192,16 @@ ApplicationWindow{
}
header: ToolBar{
position: wideScreen?ToolBar.Header:ToolBar.Footer
background: Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor//"#EEEEEE"//"#F8F8F8"
color: Material.backgroundDimColor
}
RowLayout{
anchors.fill: parent
ToolButton{
visible: !wideScreen
text: "\uf0c9"
onClicked:{
leftDrawer.visible?leftDrawer.close():leftDrawer.open()}
}
TabBar {
id: bar
Layout.fillWidth: true
//width: wideScreen?contentWidth:parent.width-10*mm
//x: 7*mm
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
TabButton {
text: "\uf03a"
@ -216,6 +209,7 @@ ApplicationWindow{
anchors.fill: parent
color: Material.backgroundDimColor
}
onDoubleClicked: {newstypeSignal("refresh")}
}
TabButton {
text: "\uf0c0"
@ -242,10 +236,6 @@ ApplicationWindow{
}
}
LeftDrawerAndroid{
id: leftDrawer
visible:!wideScreen
}
StackView{id:rootstackView
width:root.width
@ -295,7 +285,7 @@ StackView{id:rootstackView
Qt.quit()
}
}
Component.onCompleted: {print("systray completed")
Component.onCompleted: {
icon = iconTray
toolTip = qsTr("Click to open Friendiqa")
//&hide()
@ -309,7 +299,6 @@ StackView{id:rootstackView
if(globaloptions.view_darkmode==1){Material.theme=Material.Dark}
else if (globaloptions.view_darkmode==2){Material.theme=Material.Light}
else {Material.theme=Material.System}
if(!filesystem.Visibility){
systemTray.icon = iconTray;
// systemTray.toolTip = qsTr("Click to open Friendiqa");
@ -322,7 +311,7 @@ StackView{id:rootstackView
var IntentReceiverQml = component.createObject(root);
}
else if (osSettings.osType=="Linux"){
newstypeSignal("refresh")
if (login!=""){newstypeSignal("refresh")}
var component = Qt.createComponent("qrc:/qml/genericqml/LinuxSync.qml");
var LinuxSyncQml = component.createObject(root);
}

View file

@ -36,60 +36,60 @@ import "qrc:/qml/genericqml"
Item {
id: contactComponent
height: 4.5*root.fontFactor*osSettings.systemFontSize//8*mm
width: contactComponent.ListView.view.width//parent.width
height: 5*root.fontFactor*osSettings.systemFontSize
width: contactComponent.ListView.view.width
property var createdAtDate: new Date(contact.created_at)
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Rectangle {
id: wrapper
width:parent.width
height: parent.height//8*mm
height: parent.height
radius: 0.5*mm
border.color: Material.backgroundDimColor// "grey"
color: Material.backgroundColor//"white"
border.color: Material.backgroundDimColor
color: Material.backgroundColor
Image {
id: photoImage
x:0.5*mm
y:0.5*mm
width: 4*root.fontFactor*osSettings.systemFontSize//7*mm
height:4*root.fontFactor*osSettings.systemFontSize//7*mm
width: 4*root.fontFactor*osSettings.systemFontSize
height:4*root.fontFactor*osSettings.systemFontSize
source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}}
}
Flow{
width: wrapper.width-4*root.fontFactor*osSettings.systemFontSize//8*mm
width: wrapper.width-4*root.fontFactor*osSettings.systemFontSize
height: wrapper.height-mm
anchors.left: photoImage.right
anchors.margins: 1*mm
//spacing: mm
anchors.margins: 0.5*mm
clip: true
Label {
id: namelabel
width: Math.min(wrapper.width-(photoImage.width+mm),contentWidth)//wrapper.width-4
height: 1.1*root.fontFactor*osSettings.bigFontSize//3*mm
width: Math.min(wrapper.width-(photoImage.width+mm),contentWidth)
height: 1.1*root.fontFactor*osSettings.bigFontSize
text: contact.name
elide: contentWidth>wrapper.width-4*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: Material.secondaryTextColor//"#303030"
color: Material.secondaryTextColor
font.pointSize: osSettings.bigFontSize
}
Label {
id: screennamelabel
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)//contentWidth+2*mm//wrapper.width-8*mm
height: 1.1*root.fontFactor*osSettings.bigFontSize//3*mm
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)
height: 1.1*root.fontFactor*osSettings.bigFontSize
text: "(@"+contact.screen_name+")"
elide: contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: Material.secondaryTextColor//"#303030"
color: Material.secondaryTextColor
font.pointSize: osSettings.bigFontSize
}
Label {
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
width: wrapper.width-5*root.fontFactor*osSettings.systemFontSize
height: wrapper.height-mm-1.1*root.fontFactor*osSettings.bigFontSize
maximumLineCount:2
text: Qt.atob(contact.description)!=""?contact.description:""
elide:contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: Material.secondaryTextColor//"#303030"
elide:Text.ElideRight
color: Material.secondaryTextColor
font.pointSize: osSettings.systemFontSize
}
}

View file

@ -53,5 +53,5 @@ Rectangle{
anchors.right: leftDrawer.right
color: Material.dialogColor//"#EEEEEE"
}
Component.onCompleted: {opened();}
//Component.onCompleted: {opened();}
}

View file

@ -8,6 +8,7 @@ Item {
onTriggered: {
updatenews.setDatabase();
updatenews.login();
updatenews.setSyncAll(true)
updatenews.startsync();
}
}

View file

@ -38,67 +38,68 @@ import "qrc:/qml/genericqml"
Rectangle{
id:permissionDialog
color: Material.backgroundColor
// x: mm
// x: mm
width: parent.width-5*mm
height:root.height/3
function updatePerms(){
for (var i=0;i<groupModel.count;i++)
{if (groupModel.get(i).groupstatus=="positive"){
group_allow.push(groupModel.get(i).group.gid)
}
if (groupModel.get(i).groupstatus=="negative"){
group_deny.push(groupModel.get(i).group.gid)
}
}
group_allow.push(groupModel.get(i).group.gid)
}
if (groupModel.get(i).groupstatus=="negative"){
group_deny.push(groupModel.get(i).group.gid)
}
}
for (var j=0;j<contactModel.count;j++){
if (contactModel.get(j).contactstatus=="positive"){
contact_allow.push(contactModel.get(j).contact.cid)
}
if (contactModel.get(j).contactstatus=="negative"){
contact_deny.push(contactModel.get(j).contact.cid)
}
if ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))
{permButton.text="\uf09c"}
else{permButton.text="\uf023"}
}}
if (contactModel.get(j).contactstatus=="positive"){
contact_allow.push(contactModel.get(j).contact.cid)
}
if (contactModel.get(j).contactstatus=="negative"){
contact_deny.push(contactModel.get(j).contact.cid)
}
if ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))
{permButton.text="\uf09c"}
else{permButton.text="\uf023"}
}
}
Text{
x:0.5*mm
y:0.5*mm
color: Material.primaryTextColor
text: qsTr("Friends")
Text{ //cid not working in Friendica 02/2022
x:0.5*mm
y:0.5*mm
color: Material.primaryTextColor
text: qsTr("Friends")
}
ListView {
id: contactView
x:0.5*mm
y:5.5*mm
width: permissionDialog.width/2-2*mm
height: permissionDialog.height-14*mm
clip: true
spacing: 1
model: contactModel
delegate: contactItem
}
id: contactView
x:0.5*mm
y:5.5*mm
width: permissionDialog.width/2-2*mm
height: permissionDialog.height-14*mm
clip: true
spacing: 1
model: contactModel
delegate: contactItem
}
ListModel{id: contactModel}
Component{
id:contactItem
Rectangle{
id:contactitemRect
color: Material.backgroundColor
width:contactView.width
height: 5*mm
radius: 0.5*mm
property string contactstatus
onContactstatusChanged:{
if(contactstatus=="positive"){contactitemRect.color="light green"}
else if (contactstatus=="negative"){contactitemRect.color= "red"}
else{contactitemRect.color= Material.backgroundColor}}
border.color:Material.frameColor
Text{
color: Material.primaryTextColor
text:contact.screen_name
}
ListModel{id: contactModel}
Component{
id:contactItem
Rectangle{
id:contactitemRect
color: Material.backgroundColor
width:contactView.width
height: 5*mm
radius: 0.5*mm
property string contactstatus
onContactstatusChanged:{
if(contactstatus=="positive"){contactitemRect.color="light green"}
else if (contactstatus=="negative"){contactitemRect.color= "red"}
else{contactitemRect.color= Material.backgroundColor}}
border.color:Material.frameColor
Text{
color: Material.primaryTextColor
text:contact.screen_name
}
MouseArea{
anchors.fill: parent
onClicked:{
@ -113,55 +114,55 @@ Rectangle{
else{contactModel.set(index,{"contactstatus":"neutral"});
contactstatus="neutral";
}
}}
Component.onCompleted:{
if (contactModel.get(index).contactstatus=="positive"){
contactstatus="positive"
}
else if (contactModel.get(index).contactstatus=="negative"){
contactstatus="negative"
}
else {contactstatus="neutral"} }
}
}
Text{
color: Material.primaryTextColor
x:contactView.width+2*mm
y:0.5*mm
text: qsTr("Groups")
}}
Component.onCompleted:{
if (contactModel.get(index).contactstatus=="positive"){
contactstatus="positive"
}
else if (contactModel.get(index).contactstatus=="negative"){
contactstatus="negative"
}
else {contactstatus="neutral"} }
}
}
Text{
color: Material.primaryTextColor
x:contactView.width+2*mm
y:0.5*mm
text: qsTr("Groups")
}
ListView {
id: groupView
x:contactView.width+2*mm
y:5.5*mm
width: permissionDialog.width/2-2*mm
height: permissionDialog.height-14*mm
clip: true
spacing: 1
model: groupModel
delegate: groupItem
}
id: groupView
x:contactView.width+2*mm
y:5.5*mm
width: permissionDialog.width/2-2*mm
height: permissionDialog.height-14*mm
clip: true
spacing: 1
model: groupModel
delegate: groupItem
}
ListModel{id: groupModel}
Component{
id:groupItem
Rectangle{
id:groupitemRect
width:groupView.width
radius: 0.5*mm
height: 5*mm
property string groupstatus:"neutral"
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= Material.backgroundColor}}
color: Material.backgroundColor
border.color: Material.frameColor
Text{
color: Material.primaryTextColor
text:group.groupname
}
MouseArea{
ListModel{id: groupModel}
Component{
id:groupItem
Rectangle{
id:groupitemRect
width:groupView.width
radius: 0.5*mm
height: 5*mm
property string groupstatus:"neutral"
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= Material.backgroundColor}}
color: Material.backgroundColor
border.color: Material.frameColor
Text{
color: Material.primaryTextColor
text:group.groupname
}
MouseArea{
anchors.fill: parent
onClicked:{
if(groupModel.get(index).groupstatus=="neutral"){
@ -170,55 +171,56 @@ Rectangle{
else if (groupModel.get(index).groupstatus=="positive"){
groupModel.set(index,{"groupstatus":"negative"});
groupstatus="negative"}
else{groupModel.set(index,{"groupstatus":"neutral"})
groupstatus="neutral"}
else{groupModel.set(index,{"groupstatus":"neutral"})
groupstatus="neutral"}
}}
Component.onCompleted:{ if (groupModel.get(index).groupstatus=="positive"){
groupstatus="positive"
}
else if (groupModel.get(index).groupstatus=="negative"){
groupstatus="negative"
}
else {groupstatus="neutral"} }
}
}
MButton{
x:0.5*mm
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:"\uf0c7"
onClicked:{
Component.onCompleted:{ if (groupModel.get(index).groupstatus=="positive"){
groupstatus="positive"
}
else if (groupModel.get(index).groupstatus=="negative"){
groupstatus="negative"
}
else {groupstatus="neutral"} }
}
}
MButton{
x:0.5*mm
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:"\uf0c7"
onClicked:{
updatePerms();
var perms=[];
perms.push(contact_allow,contact_deny,group_allow,group_deny);
Service.savePermissions(db,perms)
}
}
MButton{
x:contactView.width+2*mm
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:"\u2713"
onClicked:{updatePerms();
permissionDialog.visible=false;
}
}
}
MButton{
x:contactView.width+2*mm
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:"\u2713"
onClicked:{
updatePerms();
permissionDialog.visible=false;
}
}
Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive"}
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
}},"isFriend",1,"name");
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive"}
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
}},"isFriend",1,"name");
Helperjs.readData(db,"groups",login.username,function(owngroups){
Helperjs.readData(db,"groups",login.username,function(owngroups){
for (var number in owngroups){
var groupstatus= "neutral";
if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"}
else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"}
groupModel.append({"group":owngroups[number],"groupstatus":groupstatus})
}});
}
var groupstatus= "neutral";
if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"}
else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"}
groupModel.append({"group":owngroups[number],"groupstatus":groupstatus})
}});
}
}

View file

@ -38,6 +38,7 @@ Rectangle {
id:searchComponent
color: Material.backgroundColor
radius:0.5*mm
property bool selfdestroying:false
/* anchors.left: parent.left
anchors.leftMargin:mm
anchors.top:parent.top
@ -54,7 +55,10 @@ Rectangle {
anchors.fill: parent
selectByMouse: true
cursorVisible: false
onEditingFinished:{ if (displayText!=""){search(displayText)};searchComponent.destroy()}
onAccepted:{
if (displayText!=""){search(displayText)};
if(selfdestroying){searchComponent.destroy()}
}
}
Component.onCompleted: searchText.forceActiveFocus()
}

View file

@ -44,8 +44,6 @@ Page {
property var contact:({})
property string profileimagesource:contact.profile_image
//function backRequested(){pageStack.pop()}
function getDateDiffString (seconds){
var timestring="";
if (seconds<60) {timestring= Math.round(seconds) + " " +qsTr("seconds");}
@ -141,14 +139,12 @@ Page {
Component { id: contactHeader
Rectangle{
border.color: Material.backgroundDimColor//"#EEEEEE"
border.color: Material.backgroundDimColor
border.width: 1
color: Material.backgroundColor//"white"
color: Material.backgroundColor
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
@ -160,7 +156,7 @@ Page {
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
Connections{
target:contactList
onProfileimagesourceChanged:profileImage.source=profileimagesource
function onProfileimagesourceChanged(){profileImage.source=profileimagesource}
}
}
Flow{id:buttonflow
@ -175,7 +171,7 @@ Page {
id:photobutton
height: 6*mm
width: 8*mm
text: "\uf03e" // "Photos"
text: "\uf03e"
visible:(contact.network=="dfrn")
onClicked:{
rootstack.currentIndex=2;
@ -193,7 +189,7 @@ Page {
height: 6*mm
width: 8*mm
visible: (contact.following=="true")
text: "\uf040" //"DM"
text: "\uf040"
onClicked:{
rootstack.currentIndex=0;
newsSwipeview.currentIndex=2;
@ -217,9 +213,8 @@ Page {
}
MButton{
id:approvebutton
visible:(contact.hasOwnProperty("acct"))
visible:(contact.hasOwnProperty("acct")&&!contact.searchContact)
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Approve")
onClicked:{
@ -232,9 +227,8 @@ Page {
}
MButton{
id:rejectbutton
visible:(contact.hasOwnProperty("acct"))
visible:(contact.hasOwnProperty("acct")&&!contact.searchContact)
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){
@ -246,9 +240,8 @@ Page {
}
MButton{
id:ignorebutton
visible:(contact.hasOwnProperty("acct"))
visible:(contact.hasOwnProperty("acct")&&!contact.searchContact)
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){
@ -260,9 +253,8 @@ Page {
}
MButton{
id:followbutton
visible:(contact.isFriend==0)
visible:(contact.isFriend==0 || !contact.hasOwnProperty("isFriend"))
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Follow")
onClicked:{
contactBusy.running=true;
@ -281,7 +273,6 @@ Page {
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){
@ -297,12 +288,11 @@ Page {
}//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: Material.primaryTextColor//"#303030"
wrapMode: Text.Wrap
color: Material.primaryTextColor
font.pointSize: 1.2*osSettings.bigFontSize
font.family: "Noto Sans"
anchors.top: contactView.width<35*root.fontFactor*osSettings.systemFontSize?profileImage.bottom:buttonflow.bottom
@ -314,7 +304,6 @@ Page {
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
@ -324,15 +313,11 @@ Page {
color: Material.primaryTextColor
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())
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
onLinkActivated: {
Qt.openUrlExternally(link)}
}
//}
}
}//Component end
Connections{
@ -342,8 +327,9 @@ Page {
contactBusy.running=false;
}
function onSuccess(data,api){
Service.processNews(api,data)
//replySignal("")
if (api=="/api/statuses/user_timeline"){
Service.processNews(api,data)
}
}
}
@ -373,7 +359,6 @@ Page {
anchors.rightMargin: 1*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057"
//font.pixelSize: 3*mm
onClicked: {
rootstackView.pop()
}
@ -382,9 +367,10 @@ Page {
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");}
// if(contact.isFriend==1 || contact.hasOwnProperty("acct")){
// xhr.setApi("/api/statuses/user_timeline");}
// else{xhr.setApi("/api/users/show");}
xhr.setApi("/api/statuses/user_timeline")
xhr.setParam("user_id",contact.id)
xhr.get();
}

View file

@ -34,7 +34,6 @@
import QtQuick 2.4
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
//import QtQuick.Dialogs 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/smiley.js" as Smileyjs
import "qrc:/js/news.js" as Newsjs
@ -42,19 +41,17 @@ import "qrc:/qml/genericqml"
Rectangle{
color:Material.dialogColor//"#EEEEEE"
color:Material.dialogColor
width:parent.width
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+2*mm:0
id:messageSend
visible:conversation || (newsSwipeview.stacktype!="Notifications")||(newstab.newstabstatus!="Search")?true:false
property string parentId: ""
property bool textfocus: false
//property var parentObject:({})
property bool conversation: false
property string reply_to_user:""
property alias bodyMessage: bodyField.text
property var attachImageURLs: [];
//property int directmessage: 0;
property var contacts: []
property var groups: []
property var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
@ -130,13 +127,12 @@ Rectangle{
}
function setParent(newsitemobject){
//print("Newsobject "+newsitemobject.id+ " "+JSON.stringify(newsitemobject.user));
if (newsitemobject!=""){
messageSend.state="conversation"
messageSend.reply_to_user=newsitemobject.user.screen_name;
messageSend.parentId=newsitemobject.id
} else {
//messageSend.state=null;
messageSend.state=null;
messageSend.reply_to_user="";
messageSend.parentId="";
bodyField.text="";
@ -145,7 +141,7 @@ Rectangle{
}
}
function contactmenu(letter){//print("letter "+letter)
function contactmenu(letter){
Newsjs.listFriends(login,db,function(contacts){
contactModel.clear();
for (var i=0;i<contacts.length;i++){
@ -158,7 +154,7 @@ Rectangle{
},letter);
}
function hashtagmenu(){//print("letter "+letter)
function hashtagmenu(){
Newsjs.listHashtags(login,db,function(tags){
tagModel.clear();
for (var i=0;i<tags.length;i++){
@ -191,7 +187,7 @@ Rectangle{
id:messageColumn
spacing: 0.5*mm
width: parent.width
height: 11*mm+stackTypeDescription.height//implicitHeight
height: 2.6*root.fontFactor*osSettings.bigFontSize+stackTypeDescription.height
Label{id:stackTypeDescription
width: parent.width
horizontalAlignment:Text.AlignHCenter
@ -200,7 +196,7 @@ Rectangle{
}
TextArea{
id:receiverLabel
width: messageColumn.width//-8*mm
width: messageColumn.width
font.pointSize: osSettings.bigFontSize
placeholderText:qsTr("to:")
text: ""
@ -222,11 +218,12 @@ Rectangle{
}
Rectangle{
color: Material.backgroundColor//"white"
color: Material.backgroundColor
radius: 0.5*mm
visible:(newsSwipeview.stacktype!="Notifications")
x:mm
width: parent.width-2*mm
height:Math.max(bodyField.contentHeight+4*mm,10*mm)
height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
TextArea {
id: bodyField
@ -238,14 +235,27 @@ Rectangle{
wrapMode: Text.Wrap
selectByMouse: true
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
textFormat: TextEdit.RichText
onLineCountChanged: {
if (messageSend.ListView.view==null){
if (newsitem.ListView.view==null){}
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize}
}
if(conversation==true){
conversationView.contentY=conversationView.contentY+root.fontFactor*osSettings.systemFontSize
}
else{
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize
}
}
onLinkActivated:{Qt.openUrlExternally(link)}
onActiveFocusChanged:{//print(placeholder)
onActiveFocusChanged:{
if (activeFocus==true){
print("contenty "+messageSend.ListView.view.contentY)
if (messageSend.ListView.view.contentY==null){messageSend.parent.ListView.view.y=0}else{messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm};
if (conversation==true){
if (messageSend.ListView.view==null){
if (newsitem.ListView.view==null){}
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+newsitem.height/2}
}
else if (conversation==true){
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
messageSend.state="conversation";
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
@ -253,15 +263,15 @@ Rectangle{
messageSend.state="active";
newsView.positionViewAtBeginning();
}
else{
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm
};
}
}
onTextChanged:{
if (text!=""){
var plaintext=getText(0,cursorPosition)
//print(plaintext+plaintext.lastIndexOf("@",cursorPosition)+getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition) +" preedit: "+ preeditText+cursorPosition);
var regex1 = /@[a-z]+/;var regex2 = /![a-z]+/;var regex3 = /\s/;
//print(text.substring(cursorPosition-2,cursorPosition));
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
var regex1 = /@[a-z]+/;var regex2 = /\![a-z]+/;var regex3 = /\s/;
if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="@";
@ -280,8 +290,8 @@ Rectangle{
id:contactSelector
visible: false
z:3
x:8*mm
width: parent.width-9*mm
x:2*root.fontFactor*osSettings.bigFontSize//8*mm
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
height: messageSend.height/2
model:contactModel
function processContactSelection(contact){
@ -307,8 +317,8 @@ Rectangle{
id: tagSelector
visible: false
z:3
x:8*mm
width: parent.width-9*mm
x:2*root.fontFactor*osSettings.bigFontSize//8*mm
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
height: messageSend.height/2
model:tagModel
clip: true
@ -367,15 +377,15 @@ Rectangle{
id:buttonRow
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
spacing: mm
height: 12*mm
height: 2.5*root.fontFactor*osSettings.bigFontSize//12*mm
x: 0.5*mm
MButton{id:permButton
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:permButton //Permissions not working in Friendica 02/2022
// 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: 2*root.fontFactor*osSettings.bigFontSize
@ -440,8 +450,8 @@ Rectangle{
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
statusUpdate(title,body,parentId,attachImageURLs)}
else {
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)}
}

View file

@ -55,7 +55,7 @@ AnimatedImage {id:gif;
MouseArea {anchors.fill:parent;
onClicked:{
rootstackView.push("qrc:/qml/newsqml/NewsPhotolist.qml",{"photolistarray": model.newsitemobject.imageAttachmentList})
roottoolbar.visible=false
//roottoolbar.visible=false
}
}
}

View file

@ -69,7 +69,7 @@ Page{
text: "\uf057"
onClicked: {
if (rootstackView.depth>1){
roottoolbar.visible=true;
//roottoolbar.visible=true;
rootstackView.pop()}
}
}

View file

@ -49,7 +49,6 @@ Rectangle{
BusyIndicator{
id: newsBusy
//visible: false
anchors.horizontalCenter: parent.horizontalCenter
anchors.top:parent.top
anchors.topMargin: 2*mm
@ -60,10 +59,8 @@ Rectangle{
}
function newstypeHandling(newstype){
newsBusy.running=true;
try{newsBusy.running=true}catch(e){print(e)};
replySignal("");
//messagesend.state="";
//newsModel.clear();
switch(newstype){
case "timeline":
newstab.newstabstatus="Timeline";
@ -75,7 +72,7 @@ Rectangle{
case "conversation":
newsStack.updateMethodNews="conversation";
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
Newsjs.chatsfromdb(root.db,root.login,0,[],function(news,lastid){
lastnewsid=lastid;
showNews(news)});
break;
@ -105,7 +102,7 @@ Rectangle{
newsBusy.running=false;
var leftoffset=(osSettings.osType=="Android")?2*root.fontFactor*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+mm),height: 1.5*root.fontFactor*osSettings.systemFontSize});
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-(leftoffset+mm),height: 1.5*root.fontFactor*osSettings.systemFontSize,selfdestroying:true});
break;
case "refresh":
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
@ -147,20 +144,19 @@ Rectangle{
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
if(newsToShow.length>0){
var currentTime= new Date()
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
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);
}
}
function search(term){
if (term!=""){
//newstab.newstabstatus="Search";
newstabstatus="Search";
newsBusy.running=true;
newsStack.updateMethodNews="refresh";
@ -179,10 +175,12 @@ Rectangle{
try{var oldnewsitemobject=newsModel.get(newsModel.count-1).newsitemobject;
if(oldnewsitemobject.hasOwnProperty("lastcomment")){
var lastnews_id=oldnewsitemobject.lastcomment.created_at;
//var lastconv_id=oldnewsitemobject.lastcomment.statusnet_conversation_id
}else{
var lastnews_id=oldnewsitemobject.created_at;
//var lastconv_id=oldnewsitemobject.statusnet_conversation_id
}
} catch(e){print(e);var lastnews_id=99999999999999 }
} catch(e){print(e);var lastnews_id=99999999999999}
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
@ -192,14 +190,19 @@ Rectangle{
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline" ){
if(newsSwipeview.stacktype!="Home"|| newstab.newstabstatus=="Timeline" || 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" || newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var currentconversations=[];
for (let c=0;c<newsModel.count;c++){
currentconversations.push(parseInt(newsModel.get(c).newsitemobject.statusnet_conversation_id))
}
Newsjs.chatsfromdb(root.db,root.login, messagetype,currentconversations,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
@ -252,7 +255,6 @@ Rectangle{
Service.updateView("Replies")
}
replySignal("")
//Service.updateView(newstab.newstabstatus)
}
}
}
@ -301,7 +303,6 @@ Rectangle{
property string viewtype: "news"
width: parent.width
height: parent.height-3*mm
//anchors.fill: parent
anchors.margins: 0.5*mm
clip: true
spacing: 0
@ -355,11 +356,11 @@ Rectangle{
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
Newsjs.chatsfromdb(db,root.login,0,[],function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
} else {
} else {print("newstab.newstabstatus "+newstab.newstabstatus)
Service.updateView(newstab.newstabstatus)
}
});
@ -424,7 +425,7 @@ Rectangle{
root.searchSignal.connect(search);
try{newsModel.clear()} catch(e){}
swipeIndicator.visible=true;
//newsSwipeview.height=rootstack.height//-12*mm;
//newsSwipeview.height=rootstack.height
//newsSwipeview.y=5*mm;
//rootStackItem.state=""
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
@ -438,9 +439,8 @@ Rectangle{
default:messagetype=0;
}
//if((newstab.newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews);
})
@ -451,5 +451,4 @@ Rectangle{
showNews(dbnews)
})}
}
//}
}

View file

@ -33,7 +33,6 @@ import QtQuick 2.9
Rectangle{
color:"black"
//border.color: "light grey"
width:toprow.width/2;
height:toprow.width/3//video.hasVideo?newscolumn.width/4*3:10*mm
property var attachment:({})
@ -49,11 +48,7 @@ Rectangle{
MouseArea {anchors.fill:parent;
onClicked:{
if(attachment.mimetype=="video/youtube"){
rootstackView.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
} else {
rootstackView.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype});
}
}
}
}

View file

@ -1,77 +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.8
import QtQuick.Controls 2.12
import "qrc:/js/helper.js" as Helperjs
import QtWebView 1.1
Page {
id:newsYplayer
//color:"black"
width:root.width;
height:root.height-7*mm
property string url:""
property string ytcode:""
WebView {
id: webView
anchors.fill: parent
z:1
opacity: 0
url: root.osSettings.osType=="Android"?"https://youtube.com/watch?v="+ytcode:"qrc:/js/yplayer.html?" + ytcode
Behavior on opacity { NumberAnimation { duration: 200 } }
onLoadingChanged: {
switch (loadRequest.status)
{
case WebView.LoadSucceededStatus:
opacity = 1
return
case WebView.LoadStartedStatus:
case WebView.LoadStoppedStatus:
break
case WebView.LoadFailedStatus:
print("Failed to load the requested video" + url)
break
}
opacity = 0
}
onTitleChanged: {
if (title==2){root.pop()}
}
}
}

View file

@ -58,23 +58,21 @@ Item {
function pushConversation(){
if (model.newsitemobject.hasOwnProperty("currentconversation")){
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: Material.backgroundDimColor//"light grey"
color: Material.backgroundDimColor
}
Rectangle{
width:newsitem.width
height:newsitem.height-1
color: Material.background//"white"
color: Material.background
Column {
id:toprow //newscolumn
id:toprow
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(implicitHeight,3/4*root.height)
@ -105,7 +103,6 @@ Item {
anchors.margins: mm
Label {
id:user_name
//color: "grey"
width:parent.width
font.bold: true
font.pointSize: osSettings.systemFontSize
@ -115,25 +112,24 @@ Item {
Label {
id:messageTypeLabel
color: Material.secondaryTextColor//"grey"
color: Material.secondaryTextColor
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: Material.secondaryTextColor//"grey"
color: Material.secondaryTextColor
font.pointSize: 0.6*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight
text: " \u00B7 "+getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
}
Label {
id:replytoLabel
color: Material.secondaryTextColor//"grey"
color: Material.secondaryTextColor
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){" "}
text: (newsitemobject.in_reply_to_status_id!="null"&&newsitemobject.in_reply_to_status_id!=null)?" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name:" "
}
}
}
@ -141,32 +137,27 @@ Item {
MouseArea{id: itemBody
width: toprow.width-2
height: itemMessage.height
//onPressAndHold: {pushConversation()}
onClicked: {pushConversation()}
Text {
color: Material.primaryTextColor//"#404040"
linkColor: Material.accentColor//"light green"
color: Material.primaryTextColor
linkColor: Material.accentColor
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()});
}
onLinkActivated:{
if(link.startsWith(root.login.server+"\/search\?tag=")){
newstab.newstabstatus="Search";
root.searchSignal(link.substring(root.login.server.length+12,link.length))
}
else{Qt.openUrlExternally(link)}
}
Component.onCompleted:{
if (newsitemobject.imageAttachmentList.length>0){
if(newsitemobject.imageAttachmentList[0].mimetype.substring(0,5)=="image"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
@ -195,16 +186,16 @@ Item {
BlueButton{
width: newsitem.width-2
height:5*mm
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
anchors.bottom: toprow.bottom
visible: toprow.implicitHeight>3/4*root.height || newsitemobject.nsfw
text:"\uf078"
fontColor: Material.secondaryTextColor//"grey"
fontColor: Material.secondaryTextColor
border.color: "transparent"
color: Material.backgroundColor//"white"
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: "white" }
// }
color: Material.backgroundColor
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: Material.backgroundDimColor}
// }
radius:0
onClicked: {
if (text=="\uf078"){
@ -224,45 +215,45 @@ Item {
width:parent.width
spacing:mm
Label{color: Material.secondaryTextColor//"grey"
Label{color: Material.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.likeText
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.likeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
}
}
Label{color: Material.secondaryTextColor//"grey"
Label{color: Material.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.dislikeText
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.dislikeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
}
}
Label{color: Material.secondaryTextColor//"grey"
Label{color: Material.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.attendyesText
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.attendyesText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
}}
Label{color: Material.secondaryTextColor//"grey"
Label{color: Material.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.attendnoText
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.attendnoText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
}
}
Label{color: Material.secondaryTextColor//"grey"
Label{color: Material.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.attendmaybeText
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.attendmaybeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)}
@ -270,7 +261,7 @@ Item {
}
Label{
id:attendLabel
color: Material.secondaryTextColor//"grey"
color: Material.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight
@ -284,12 +275,12 @@ Item {
height: root.fontFactor*osSettings.bigFontSize
CheckBox{
id:likeCheckbox
width:newsitem.width/5 //10*mm
width:newsitem.width/5
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
implicitWidth: newsitem.width/5
implicitHeight:root.fontFactor*osSettings.bigFontSize
color:"transparent"
Text{
@ -312,12 +303,12 @@ Item {
}
CheckBox{
id: dislikeCheckbox
width:newsitem.width/5 //10*mm
width:newsitem.width/5
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
implicitWidth: newsitem.width/5
implicitHeight:root.fontFactor*osSettings.bigFontSize
color:"transparent"
Text{
@ -339,39 +330,72 @@ Item {
}}
}
CheckBox {
id:favoritedCheckbox
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
width: newsitem.width/5 // 10*mm
// CheckBox {
// id:favoritedCheckbox
// visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
// width: newsitem.width/5
// height: parent.height
// indicator:Rectangle{
// implicitWidth: newsitem.width/5
// implicitHeight:root.fontFactor*osSettings.bigFontSize
// color:"transparent"
// Text{
// anchors.centerIn: parent
// font.pointSize: osSettings.systemFontSize
// font.family:fontAwesome.name
// color: favoritedCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor
// 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
height: parent.height
indicator:Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:root.fontFactor*osSettings.bigFontSize
color:"transparent"
Text{
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
color: favoritedCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor
text:"\uf005"
}
visible:(newsitemobject.messagetype!==2)
color:"transparent"
Text{
id:replysymbol
color: Material.secondaryTextColor
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
text: "\uf112"
}
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}
MouseArea{
anchors.fill:parent
onClicked: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var conversation;
if (newsitem.ListView.view==null){conversation=true}
else if (newsitem.ListView.view.viewtype=="conversation"){
conversation=true
newsitem.ListView.view.currentIndex=itemindex
}
else{
conversation=false;
newsitem.ListView.view.currentIndex=itemindex
};
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
}
}
}
Rectangle{
width: newsitem.width/5 //10*mm
width: newsitem.width/5
height: parent.height
visible:(newsitemobject.messagetype!==2)
color:"transparent"
Text{
id:newsmenusymbol
color: Material.secondaryTextColor//"grey"
color: Material.secondaryTextColor
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
@ -393,30 +417,8 @@ Item {
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;
if (newsitem.ListView.view==null){conversation=true}
else if (newsitem.ListView.view.viewtype=="conversation"){
conversation=true
newsitem.ListView.view.currentIndex=itemindex
}
else{
conversation=false;
newsitem.ListView.view.currentIndex=itemindex
};
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
}
}
Action {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
}
onAboutToShow:{if(newsitemobject.hasOwnProperty("external_url")){
insertAction(4,externalAction)}
}
Action {
text: qsTr("Repost")
@ -432,7 +434,21 @@ Item {
pushConversation();
}
}
Action {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
}
}
Action {
text: qsTr("Bookmark")
onTriggered: {
if(model.newsitemobject.favorited==0){
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
else if(model.newsitemobject.favorited==1){
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
}
}
Menu{
title: qsTr("Attending")
width: 10*root.fontFactor*osSettings.systemFontSize
@ -469,11 +485,6 @@ Item {
})
}
}
//MenuItem{
// text:qsTr("Show on website")
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
//}
}
Column{
id:conversationColumn
@ -481,4 +492,8 @@ Item {
width: newsitem.width
}
}
Action{id:externalAction
text: qsTr("External")
onTriggered: {Qt.openUrlExternally(newsitemobject.external_url)}
}
}

View file

@ -207,7 +207,7 @@ Rectangle{
width:4.5*mm
height: 4.5*mm
textFormat:Text.RichText
font.pointSize: 1.2*osSettings.systemFontSize
font.pointSize: osSettings.osType=="Linux"?1.7*osSettings.systemFontSize:1.2*osSettings.systemFontSize
text: emoji
MouseArea{

View file

@ -88,7 +88,7 @@ Page{
Connections{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
//onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
onSuccess:{
if (imageId==""){
imageNo=imageNo+1;

View file

@ -41,298 +41,293 @@ import "qrc:/qml/genericqml"
StackView{
id: photoStack
//anchors.fill:parent
initialItem:Rectangle {
id:fotorectangle
anchors.fill:parent
// y:1
// width:root.width-mm
// height:root.height-5*mm
color: Material.backgroundColor//'#fff'
property var newimages:[]
property int currentimageno: 0
property bool remoteContact: false
id:fotorectangle
anchors.fill:parent
color: Material.backgroundColor
property var newimages:[]
property int currentimageno: 0
property bool remoteContact: false
onNewimagesChanged:{
if(fotorectangle.newimages.length>0){
var ownimagelist=[];
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<fotorectangle.newimages.length;i++){
if(albums.indexOf(fotorectangle.newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(fotorectangle.newimages[i].album)}
onNewimagesChanged:{
if(fotorectangle.newimages.length>0){
var ownimagelist=[];
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<fotorectangle.newimages.length;i++){
if(albums.indexOf(fotorectangle.newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(fotorectangle.newimages[i].album)}
//ownimagelist.push(root.login.server+"/api/friendica/photo?scale='0'&photo_id="+fotorectangle.newimages[i].id);
}
Imagejs.dataRequest(login,fotorectangle.newimages[0],db,xhr,fotorectangle);
})
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
// xhr.setImagedir(login.imagestore);
// xhr.setFilelist(ownimagelist);
// xhr.setDownloadtype("picturelist");
// xhr.getlist();
newImagesProgress.visible=true
}
}
onCurrentimagenoChanged:{
if(fotorectangle.currentimageno==fotorectangle.newimages.length){
newImagesProgress.visible=false;showFotos(root.login,"");
fotorectangle.newimages=[];fotorectangle.currentimageno=0
}else{
// download next image
Imagejs.dataRequest(login,fotorectangle.newimages[currentimageno],db,xhr,fotorectangle)
}
}
Connections{
target:xhr
function onDownloadedjson(type,url,filename,i,jsonObject){
if(type=="picturelist"){
fotorectangle.currentimageno=fotorectangle.currentimageno+1
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
}
}
function onDownloaded(type,url,filename,i){
if(type=="picture"){fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
function onError(data,url,api,code){//print("Url "+url+" api " +api + " data "+data)
if(data=="picturelist"){
var requestid=url.substring(url.lastIndexOf("=")+1);
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle);
fotorectangle.currentimageno=fotorectangle.currentimageno+1
} else if (data=="picture"){
Helperjs.deleteData(root.db,"imageData",root.login.username,function(){
fotorectangle.currentimageno=fotorectangle.currentimageno+1
},"link",url)
}else{
fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
}
// Connections{
// target:filesystem
// onError:{print("Error deleting");
// }
// onSuccess:print("Success deleting");
// }
function showFotos(login,friend){
if(friend=="backButton"){
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{rootstack.currentIndex=0}
}
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);
})
phototabstatusButton.text=friend.screen_name+qsTr("\'s images")
}
else {
Helperjs.readField("album", db, "imageData",login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
//ownimagelist.push(root.login.server+"/api/friendica/photo?scale='0'&photo_id="+fotorectangle.newimages[i].id);
}
Imagejs.dataRequest(login,fotorectangle.newimages[0],db,xhr,fotorectangle);
})
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
// xhr.setImagedir(login.imagestore);
// xhr.setFilelist(ownimagelist);
// xhr.setDownloadtype("picturelist");
// xhr.getlist();
newImagesProgress.visible=true
}
}
}
function deletepics(method, type,id){
onCurrentimagenoChanged:{
if(fotorectangle.currentimageno==fotorectangle.newimages.length){
newImagesProgress.visible=false;showFotos(root.login,"");
fotorectangle.newimages=[];fotorectangle.currentimageno=0
}else{
// download next image
Imagejs.dataRequest(login,fotorectangle.newimages[currentimageno],db,xhr,fotorectangle)
}
}
Connections{
target:xhr
function onDownloadedjson(type,url,filename,i,jsonObject){
if(type=="picturelist"){
fotorectangle.currentimageno=fotorectangle.currentimageno+1
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
}
}
function onDownloaded(type,url,filename,i){
if(type=="picture"){fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
function onError(data,url,api,code){
if(data=="picturelist"){
var requestid=url.substring(url.lastIndexOf("=")+1);
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle);
fotorectangle.currentimageno=fotorectangle.currentimageno+1
} else if (data=="picture"){
Helperjs.deleteData(root.db,"imageData",root.login.username,function(){
fotorectangle.currentimageno=fotorectangle.currentimageno+1
},"link",url)
}else{
fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
}
// Connections{
// target:filesystem
// onError:{print("Error deleting");
// }
// onSuccess:print("Success deleting");
// }
function showFotos(login,friend){
if(friend=="backButton"){
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{rootstack.currentIndex=0}
}
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);
})
phototabstatusButton.text=friend.screen_name+qsTr("\'s images")
}
else {
Helperjs.readField("album", db, "imageData",login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
}
})
}
}
}
function deletepics(method, type,id){
if(method=="delete"){Imagejs.deleteImage(db,login,type, id,filesystem,root,function(){//showFotos("")
})}
}
function updatepic(method,type,id){
}
function updatepic(method,type,id){
if(method=="update"){
Helperjs.readData(db,"imageData",login.username,function(url){
photoStack.push(
"qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":[url[0].location+url[0].filename],"imageId":id,"currentAlbum":url[0].album}
photoStack.push(
"qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":[url[0].location+url[0].filename],"imageId":id,"currentAlbum":url[0].album}
)
},"id",id)}
}
function uploadUrls(urls){
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":urls})
}
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: Material.secondaryTextColor//"grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
LeftDrawerLinux{
id:leftDrawer
property var newstabstatus: newstab.newstabstatus
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
height: root.height-bar.height
}
LeftDrawerAndroid{
id: leftDrawerAndroid
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:uploadPhoto.left
anchors.rightMargin:mm
visible: false
value: fotorectangle.currentimageno/fotorectangle.newimages.length
}
MButton{
id: uploadPhoto
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
text:"\uf0ee"
onClicked: {
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml");
// var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
// var imageUpload = component.createObject(fotorectangle);
}}
MButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text:"\uf0ed"
Menu {
id:photoupdatemenu
width:8*root.fontFactor*osSettings.bigFontSize
MenuItem {
text: qsTr("All Images")
font.pointSize: osSettings.bigFontSize
onTriggered: {
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){fotorectangle.newimages=obj})}
}
MenuItem {
text: qsTr("Only new")
font.pointSize: osSettings.bigFontSize
onTriggered: {
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){fotorectangle.newimages=obj})}
}
},"id",id)}
}
onClicked: {photoupdatemenu.popup()}
}
MButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
width: Math.max(8*root.fontFactor*osSettings.bigFontSize,implicitWidth)
text: fotostab.phototabstatus=="Images"?qsTr("Own Images"):fotostab.phototabstatus
Menu {
id:phototabmenu
width: 20*root.fontFactor*osSettings.bigFontSize
MenuItem {
text: qsTr("Own Images")
font.pointSize: osSettings.bigFontSize
onTriggered: {
fotostab.phototabstatus="Images";
// phototabstatusButton.text=qsTr("Own images");
showFotos(root.login,"")}
}
function uploadUrls(urls){
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":urls})
}
onClicked: {phototabmenu.popup()}
}
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: Material.secondaryTextColor//"grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
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
}
ListModel{
id: photogroupModel
}
LeftDrawerAndroid{
id: leftDrawerAndroid
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: leftDrawer.width//mm;
y:8*mm
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm //parent.width-2*mm;
height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
border.color: Material.backgroundDimColor//"#EEEEEE"
border.width: 1
width:12*mm
height:6*mm
Text{
font.pointSize: 0.75*osSettings.systemFontSize
anchors.centerIn: parent
text:qsTr("More")
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:uploadPhoto.left
anchors.rightMargin:mm
visible: false
value: fotorectangle.currentimageno/fotorectangle.newimages.length
}
MButton{
id: uploadPhoto
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
text:"\uf0ee"
onClicked: {photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml")}
}
MButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text:"\uf0ed"
Menu {
id:photoupdatemenu
width:8*root.fontFactor*osSettings.bigFontSize
MenuItem {
text: qsTr("All Images")
font.pointSize: osSettings.bigFontSize
onTriggered: {
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){fotorectangle.newimages=obj})}
}
MenuItem {
text: qsTr("Only new")
font.pointSize: osSettings.bigFontSize
onTriggered: {
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){fotorectangle.newimages=obj})}
}
}
MouseArea{anchors.fill:parent
onClicked:{//print(photogroupModel.get(0).foreignPicture);
var lastalbum_id=photogroupModel.count-1;
if(photogroupModel.get(photogroupModel.count-1).foreignPicture==true){
Imagejs.newRequestFriendsAlbumPictures(login,photogroupModel.get(0).friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true,'friend':photogroupModel.get(0).friend}
photoWorker.sendMessage(msg)
})
}
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
onClicked: {photoupdatemenu.popup()}
}
MButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
width: Math.max(8*root.fontFactor*osSettings.bigFontSize,implicitWidth)
text: fotostab.phototabstatus=="Images"?qsTr("Own Images"):fotostab.phototabstatus
Menu {
id:phototabmenu
width: 20*root.fontFactor*osSettings.bigFontSize
MenuItem {
text: qsTr("Own Images")
font.pointSize: osSettings.bigFontSize
onTriggered: {
fotostab.phototabstatus="Images";
// phototabstatusButton.text=qsTr("Own images");
showFotos(root.login,"")}
}
}
onClicked: {phototabmenu.popup()}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
ListModel{
id: photogroupModel
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: leftDrawer.width
y:8*mm
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm
height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
border.color: Material.backgroundDimColor
border.width: 1
color: Material.dialogColor
width:12*mm
height:6*mm
Text{
color: Material.primaryTextColor
font.pointSize: 0.75*osSettings.systemFontSize
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{
var lastalbum_id=photogroupModel.count-1;
if(photogroupModel.get(photogroupModel.count-1).foreignPicture==true){
Imagejs.newRequestFriendsAlbumPictures(login,photogroupModel.get(0).friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true,'friend':photogroupModel.get(0).friend}
photoWorker.sendMessage(msg)
})
}
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
}
Rectangle { id: photoBackground; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { width: parent.width; height:parent.height; model: visualphotoModel.parts.browser; interactive: false }
MButton {
id: backButton
text: "\uf057"
x: parent.width - backButton.width - root.fontFactor*osSettings.bigFontSize
y: -backButton.height - root.fontFactor*osSettings.bigFontSize
z:2
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: {
root.fotoSignal.connect(showFotos);
root.uploadSignal.connect(uploadUrls);
root.changeimage.connect(deletepics);
root.changeimage.connect(updatepic);
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
}
}
Rectangle { id: photoBackground; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { width: parent.width; height:parent.height; model: visualphotoModel.parts.browser; interactive: false }
MButton {
id: backButton
text: "\uf057"
x: parent.width - backButton.width - root.fontFactor*osSettings.bigFontSize
y: -backButton.height - root.fontFactor*osSettings.bigFontSize
z:2
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: {
root.fotoSignal.connect(showFotos);
root.uploadSignal.connect(uploadUrls);
root.changeimage.connect(deletepics);
root.changeimage.connect(updatepic);
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
}
}
}