v0.5.1
This commit is contained in:
parent
01e9ae06f4
commit
7119d5bdf4
292 changed files with 790 additions and 16347 deletions
1
source-android/qml/contactqml
Symbolic link
1
source-android/qml/contactqml
Symbolic link
|
@ -0,0 +1 @@
|
|||
./../../source-linux/qml/contactqml/
|
|
@ -1,92 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 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.4
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: contactComponent
|
||||
height: 8*mm
|
||||
width: parent.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: 8*mm
|
||||
border.color: "grey"
|
||||
color:"white"
|
||||
Image {
|
||||
id: photoImage
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
width: 7*mm
|
||||
height:7*mm
|
||||
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"}}
|
||||
}
|
||||
|
||||
Column{
|
||||
width: wrapper.width-8*mm
|
||||
anchors.left: photoImage.right
|
||||
anchors.margins: 1*mm
|
||||
spacing: mm
|
||||
Label {
|
||||
id: namelabel
|
||||
width: wrapper.width-4
|
||||
height: 3*mm
|
||||
text: contact.name
|
||||
elide:Text.ElideRight
|
||||
color: "#303030"
|
||||
font.pixelSize: 3*mm
|
||||
}
|
||||
Label {
|
||||
id: screennamelabel
|
||||
width: wrapper.width-8*mm
|
||||
height: 2.5*mm
|
||||
text: "@"+contact.screen_name
|
||||
elide:Text.ElideRight
|
||||
color: "#303030"
|
||||
font.pixelSize: 2.5*mm
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
rootstack.currentIndex=0;
|
||||
bar.currentIndex=0;
|
||||
root.contactdetailsSignal(contact)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 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.4
|
||||
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"
|
||||
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{
|
||||
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Button{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Button{
|
||||
id: closeButton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text: "\uf057" //"close"
|
||||
onClicked:{contactLargeComponent.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 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/>.
|
||||
|
||||
// List of people
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.5
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:contactlistRectangle
|
||||
property var contacts:[]
|
||||
property var possibleUsers: []
|
||||
//y:8*mm
|
||||
color: "white"
|
||||
border.color: "light grey"
|
||||
radius:0.5*mm
|
||||
width:groupListView.width
|
||||
height:groupListView.height
|
||||
|
||||
ListView {
|
||||
id: contactView
|
||||
x:mm
|
||||
y:6*mm
|
||||
width: contactlistRectangle.width-2*mm
|
||||
height: contactlistRectangle.height-10*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
model: contactModel
|
||||
delegate: listContact
|
||||
}
|
||||
|
||||
ListModel{id: contactModel}
|
||||
|
||||
Component { id:listContact
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
radius:0.5*mm
|
||||
width:contactView.width
|
||||
height:6*mm
|
||||
Image {
|
||||
id: contactImage
|
||||
x:1
|
||||
y:1
|
||||
width: 5*mm
|
||||
height:5*mm
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Text{
|
||||
font.pixelSize: 3*mm
|
||||
anchors.left: contactImage.right
|
||||
anchors.margins: 1*mm
|
||||
text:Qt.atob(contact.name)
|
||||
}
|
||||
Text {
|
||||
id:selected
|
||||
anchors.right:parent.right
|
||||
visible: contactlist.indexOf(contact)>-1
|
||||
z:4
|
||||
text: "\u2713"
|
||||
width: 5*mm
|
||||
anchors.top: parent.top
|
||||
color: "green"
|
||||
font.pixelSize: 3*mm
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
if(selected.visible==true){
|
||||
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
|
||||
selected.visible=false
|
||||
}
|
||||
else{
|
||||
contacts.push(contact);
|
||||
selected.visible=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: closeButton
|
||||
height:6* mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
//color:"white"
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
groupModelAppend(contacts,function(){
|
||||
contactlistRectangle.destroy()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
for (var user in possibleUsers){
|
||||
contactModel.append({"contact":possibleUsers[user]})
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,392 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 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.4
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
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:/qml/contactqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
y:1
|
||||
color: "white"
|
||||
|
||||
function showContactdetails(contact){
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if(contact.isFriend){
|
||||
friendsTabView.currentIndex=1;
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
else{friendsTabView.currentIndex=2;
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
}
|
||||
|
||||
function showProfile(callback){
|
||||
var profile=({});
|
||||
Helperjs.readData(db,"profiles",login.username,function(profileobject){
|
||||
var profilearray=[];
|
||||
for (var i in profileobject){
|
||||
profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata)));
|
||||
}
|
||||
profile.profiles=profilearray;
|
||||
});
|
||||
Helperjs.readData(db,"contacts",login.username,function(owner){
|
||||
profile.friendica_owner=owner[0];
|
||||
},"isFriend",2);
|
||||
callback(profile)
|
||||
}
|
||||
|
||||
TabBar {
|
||||
id: friendsbar
|
||||
width: parent.width
|
||||
height: 9*mm
|
||||
position:TabBar.Header
|
||||
currentIndex: 1
|
||||
TabButton {
|
||||
text: qsTr("Me")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Friends")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Contacts")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Groups")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
}
|
||||
StackLayout{
|
||||
id:friendsTabView
|
||||
//anchors.fill: parent
|
||||
x:mm
|
||||
y:10*mm
|
||||
width: parent.width-2*mm
|
||||
height: parent.height-10*mm
|
||||
currentIndex: friendsbar.currentIndex
|
||||
signal contactsSignal(var contact)
|
||||
signal groupsSignal(var username)
|
||||
onCurrentIndexChanged:{
|
||||
if (currentIndex==1){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==2){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==3){groupsSignal(root.login.username)}
|
||||
}
|
||||
// style: TabViewStyle {
|
||||
// frameOverlap: 1
|
||||
// tab: Rectangle {
|
||||
// color: "white"
|
||||
// implicitWidth: root.width/4-2*mm
|
||||
// implicitHeight: 4*mm
|
||||
// Text { id: text
|
||||
// anchors.centerIn: parent
|
||||
// text: styleData.title
|
||||
// color: "dark grey"
|
||||
// font.pixelSize:2.5*mm
|
||||
// font.bold: styleData.selected
|
||||
// }
|
||||
// }
|
||||
// frame: Rectangle { color: "light grey" }
|
||||
// tabsAlignment:Qt.AlignHCenter
|
||||
// }
|
||||
|
||||
Item{
|
||||
id:profileGridTab
|
||||
Layout.fillWidth:true
|
||||
Layout.fillHeight: true
|
||||
Component.onCompleted:{
|
||||
showProfile(function(profile){
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
|
||||
var profilecomp = component.createObject(profileGridTab,{"profile": profile});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id: friendsGridTab
|
||||
Layout.fillWidth:true
|
||||
Layout.fillHeight: true
|
||||
property int currentContact: 0
|
||||
function showFriends(contact){
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
|
||||
for (var i=0;i<friendsobject.length;i++){
|
||||
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]});
|
||||
}
|
||||
},"isFriend",1,"screen_name ASC");
|
||||
}
|
||||
Connections{
|
||||
target:xhr
|
||||
onDownloaded:{
|
||||
if(type=="contactlist"){
|
||||
//print(url+" "+filename+" "+i)
|
||||
friendsGridTab.currentContact=i+1;
|
||||
if(friendsGridTab.currentContact==root.newContacts.length){
|
||||
friendsGridTab.showFriends(root.login.username)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MButton {
|
||||
id: updateFriendsButton
|
||||
text: "\uf021"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
onClicked: {
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
//root.contactLoadType="friends";
|
||||
Newsjs.requestFriends(root.login,db,root,function(nc){
|
||||
root.newContacts=nc
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar{
|
||||
id: newContactsProgress
|
||||
width: 15*mm
|
||||
height: updateFriendsButton.height
|
||||
anchors.top: parent.top
|
||||
anchors.right:updateFriendsButton.left
|
||||
anchors.rightMargin:mm
|
||||
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
|
||||
value: friendsGridTab.currentContact/root.newContacts.length
|
||||
}
|
||||
|
||||
//GridView {
|
||||
ListView{
|
||||
id: friendsView
|
||||
x:mm
|
||||
y:updateFriendsButton.height+2*mm
|
||||
width:friendsGridTab.width-2*mm
|
||||
height:friendsGridTab.height-updateFriendsButton.height-2*mm
|
||||
clip: true
|
||||
spacing: 2
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
model: friendsModel
|
||||
delegate: ContactComponent { }
|
||||
}
|
||||
|
||||
ListModel{id:friendsModel}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.friendsSignal.connect(showFriends);
|
||||
friendsTabView.contactsSignal.connect(showFriends);
|
||||
showFriends(root.login.username);
|
||||
root.newContacts=[]
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id: contactsGridTab
|
||||
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){
|
||||
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");
|
||||
}
|
||||
MButton {
|
||||
id: cleanButton
|
||||
text: "\uf021"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
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");
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: contactsView
|
||||
x:mm
|
||||
y:cleanButton.height+2*mm
|
||||
width:contactsGridTab.width-2*mm
|
||||
height:contactsGridTab.height-cleanButton.height-2*mm
|
||||
clip: true
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
model: contactsModel
|
||||
delegate: ContactComponent { }
|
||||
}
|
||||
|
||||
ListModel{id: contactsModel}
|
||||
Component.onCompleted: {
|
||||
friendsTabView.contactsSignal.connect(showContacts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item{
|
||||
id: groupsGridTab
|
||||
Layout.fillWidth:true
|
||||
Layout.fillHeight: true
|
||||
|
||||
function showGroups(username){
|
||||
try {groupsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db, "groups",root.login.username,function(groupsobject){
|
||||
for (var j=0;j<groupsobject.length;j++){
|
||||
groupsModel.append({"group":groupsobject[j]});
|
||||
}})}
|
||||
|
||||
function updateGroup(login,database,group){
|
||||
// update groups
|
||||
//var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
//var groupdata={"gid":group.id,"name":group.name,"user":group.user};
|
||||
//print("Groupdata "+JSON.stringify(group));
|
||||
var api="";
|
||||
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
|
||||
xhr.url= login.server + api;
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.clearParams();
|
||||
xhr.setParam("gid",group.id);
|
||||
xhr.setParam("name",group.name);
|
||||
xhr.setParam("user", group.user);
|
||||
xhr.setParam("json",group);
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
|
||||
onSuccess:{print("gruppe "+data);
|
||||
Newsjs.requestGroups(root.login,root.db,root,function(){
|
||||
showGroups(root.login.username)});
|
||||
}
|
||||
}
|
||||
MButton {
|
||||
id: updateGroupsButton
|
||||
text: "\uf021"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: mm
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
onClicked: {
|
||||
Newsjs.requestGroups(root.login,root.db,root,function(){
|
||||
groupsGridTab.showGroups(root.login.username)})}
|
||||
}
|
||||
// BlueButton {
|
||||
// id: newGroupButton
|
||||
// text: "\uf234"
|
||||
// anchors.top: parent.top
|
||||
// anchors.topMargin: mm
|
||||
// anchors.right: updateGroupsButton.left
|
||||
// anchors.rightMargin: mm
|
||||
// onClicked: {
|
||||
// groupsModel.append({"group": {"new":true}});
|
||||
// }
|
||||
// }
|
||||
GridView {
|
||||
id: groupsView
|
||||
x:mm
|
||||
y:updateGroupsButton.height+2*mm
|
||||
width:groupsGridTab.width-2*mm
|
||||
height:groupsGridTab.height-updateGroupsButton.height-2*mm
|
||||
clip: true
|
||||
cellHeight: 16*mm
|
||||
cellWidth: 17*mm
|
||||
add: Transition {
|
||||
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
}
|
||||
model: groupsModel
|
||||
delegate: GroupComponent {}
|
||||
//footer:groupFooter
|
||||
}
|
||||
ListModel{
|
||||
id: groupsModel
|
||||
}
|
||||
// Component{
|
||||
// id: groupFooter
|
||||
// Image{
|
||||
// id: footerImage
|
||||
// width: 15*mm
|
||||
// height: 15*mm
|
||||
// fillMode: Image.PreserveAspectFit
|
||||
// source:"qrc:/images/addImage.png"
|
||||
// MouseArea{
|
||||
// anchors.fill: parent
|
||||
// onClicked:{
|
||||
// print("new group")
|
||||
// var component = Qt.createComponent("qrc:/qml/contactqml/GroupComponent.qml");
|
||||
// var imagedialog = component.createObject(groupsView,{"group": []});}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Component.onCompleted: {
|
||||
friendsTabView.groupsSignal.connect(showGroups);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Component.onCompleted: {
|
||||
//root.contactdetailsSignal.connect(showContactdetails);
|
||||
}
|
||||
}
|
|
@ -1,269 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 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.4
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: groupComponent
|
||||
property var groupmembers:[]
|
||||
//property bool newGroup: false
|
||||
function groupModelAppend(groupcontacts,callback){
|
||||
for (var n in groupcontacts){
|
||||
groupModel.append({"groupmember":groupcontacts[n]});}
|
||||
callback()
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width: 16*mm
|
||||
height: 15*mm
|
||||
border.color: "grey"
|
||||
color:"white"
|
||||
|
||||
Image {
|
||||
id: photoImage
|
||||
x:1
|
||||
y:1
|
||||
width: 10*mm
|
||||
height:10*mm
|
||||
source:"qrc:/images/defaultcontact.jpg"
|
||||
}
|
||||
Rectangle{
|
||||
id:namelabelRect
|
||||
x: 1
|
||||
width: wrapper.width-2
|
||||
height: 3.5*mm
|
||||
anchors.top: photoImage.bottom
|
||||
border.color: "light grey"
|
||||
TextInput {
|
||||
id: namelabel
|
||||
anchors.fill: parent
|
||||
readOnly: true
|
||||
text: group.new?"":group.groupname
|
||||
color: "#303030"
|
||||
font.pixelSize: 3*mm
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id: closeButton
|
||||
visible: false
|
||||
width: 8*mm
|
||||
height: 6*mm
|
||||
anchors.left: infobutton.right
|
||||
anchors.margins: mm
|
||||
anchors.top: parent.top
|
||||
|
||||
text: "\uf057"
|
||||
font.pixelSize: 3*mm
|
||||
onClicked:{groupComponent.state="";
|
||||
if (group.new){groupsModel.remove(index)}
|
||||
}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:infobutton
|
||||
width: 4*mm
|
||||
height: 6*mm
|
||||
|
||||
//color:"transparent"
|
||||
text:"?"
|
||||
font.pixelSize: 3*mm
|
||||
anchors.left: photoImage.right
|
||||
anchors.leftMargin: mm
|
||||
anchors.topMargin: mm
|
||||
anchors.top: parent.top
|
||||
onClicked:{
|
||||
//if(group.new){
|
||||
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
|
||||
try {groupModel.clear()}catch (e){print(e)}
|
||||
groupmembers=JSON.parse(groups);
|
||||
for (var user in groupmembers){
|
||||
Helperjs.readData(root.db,"contacts",root.login.username,function(userdata){
|
||||
if (userdata[0]){
|
||||
userdata[0].name=Qt.atob(userdata[0].name);
|
||||
userdata[0].description=Qt.atob(userdata[0].description)
|
||||
groupModel.append({"groupmember":userdata[0]
|
||||
})}
|
||||
},"id",groupmembers[user])
|
||||
} //catch(e){}
|
||||
},"groupname",group.groupname);
|
||||
//}
|
||||
groupComponent.state="large"
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id: detailsrectangle
|
||||
anchors.top: namelabelRect.bottom
|
||||
anchors.topMargin: mm
|
||||
opacity: 0
|
||||
|
||||
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)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id: groupListView
|
||||
x:1
|
||||
//anchors.top: parent.top
|
||||
width: root.width-10*mm
|
||||
height:groupsView.height - 24*mm
|
||||
clip: true
|
||||
spacing: 2
|
||||
model: groupModel
|
||||
delegate: groupMember
|
||||
}
|
||||
|
||||
ListModel{id: groupModel}
|
||||
|
||||
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"}}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "large"
|
||||
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width; readOnly:false}
|
||||
PropertyChanges { target: namelabelRect; height: 4.5*mm}
|
||||
PropertyChanges { target: closeButton; visible: true}
|
||||
PropertyChanges { target: groupComponent; z: 2 }
|
||||
PropertyChanges { target: wrapper; width:groupsView.width;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; opacity:1 }
|
||||
PropertyChanges { target: infobutton; visible: false}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,285 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 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.4
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
Rectangle {
|
||||
// width:parent.width-2*mm
|
||||
// height:parent.height-14*mm
|
||||
anchors.fill:parent
|
||||
color:"white"
|
||||
property var profile:({})
|
||||
property var attachImageURLs:[]
|
||||
property var createdAtDate: new Date(profile.friendica_owner.created_at)
|
||||
|
||||
function updateProfileImage(){
|
||||
xhr.url= login.server + "/api/account/update_profile_image.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.clearParams();
|
||||
xhr.setImageFileParam("image", photoImage.source );
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
function buildProfiletext(pobject,callback){
|
||||
var profileobject={};
|
||||
var profiletext="";
|
||||
for (var key in pobject){//print(key+obj[key])
|
||||
if(pobject[key]!=""&&key!="users"&&key!="profile_id"){
|
||||
var keytext="";
|
||||
switch(key){
|
||||
case "profile_name":keytext=qsTr("profile name");break;
|
||||
case "is_default":keytext=qsTr("is default");break;
|
||||
case "hide_friends":keytext=qsTr("hide friends");break;
|
||||
case "profile_photo":keytext=qsTr("profile photo");break;
|
||||
case "profile_thumb":keytext=qsTr("profile thumb");break;
|
||||
case "publish":keytext=qsTr("publish");break;
|
||||
case "net_publish":keytext=qsTr("publish in network");break;
|
||||
case "description":keytext=qsTr("description");break;
|
||||
case "date_of_birth":keytext=qsTr("date of birth");break;
|
||||
case "address":keytext=qsTr("address");break;
|
||||
case "city":keytext=qsTr("city");break;
|
||||
case "region":keytext=qsTr("region");break;
|
||||
case "postal_code":keytext=qsTr("postal code");break;
|
||||
case "country":keytext=qsTr("country");break;
|
||||
case "hometown":keytext=qsTr("hometown");break;
|
||||
case "gender":keytext=qsTr("gender");break;
|
||||
case "marital":keytext=qsTr("marital status");break;
|
||||
case "marital_with":keytext=qsTr("married with");break;
|
||||
case "marital_since":keytext=qsTr("married since");break;
|
||||
case "sexual":keytext=qsTr("sexual");break;
|
||||
case "politic":keytext=qsTr("politics");break;
|
||||
case "religion":keytext=qsTr("religion");break;
|
||||
case "public_keywords":keytext=qsTr("public keywords");break;
|
||||
case "private_keywords":keytext=qsTr("private keywords");break;
|
||||
case "likes":keytext=qsTr("likes");break;
|
||||
case "dislikes":keytext=qsTr("dislikes");break;
|
||||
case "about":keytext=qsTr("about");break;
|
||||
case "music":keytext=qsTr("music");break;
|
||||
case "book":keytext=qsTr("book");break;
|
||||
case "tv":keytext=qsTr("tv");break;
|
||||
case "film":keytext=qsTr("film");break;
|
||||
case "interest":keytext=qsTr("interest");break;
|
||||
case "romance":keytext=qsTr("romance");break;
|
||||
case "work":keytext=qsTr("work");break;
|
||||
case "education":keytext=qsTr("education");break;
|
||||
case "social_networks":keytext=qsTr("social networks");break;
|
||||
case "homepage":keytext=qsTr("homepage");break;
|
||||
default:keytext=key;
|
||||
}
|
||||
profiletext=profiletext+("<b>"+keytext+": </b> "+(pobject[key])+"<br>");
|
||||
}
|
||||
}
|
||||
callback(profiletext)
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: update
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
text: "\uf021"
|
||||
font.pixelSize: 3*mm
|
||||
onClicked: {
|
||||
Service.requestProfile(root.login,root.db,root,function(nc){
|
||||
root.newContacts=nc;
|
||||
photoImage.source="";
|
||||
showProfile(function(newprofile){
|
||||
profile=newprofile;
|
||||
try {profileModel.clear()} catch(e){print(e)};
|
||||
newprofile.profiles.sort(function(obj1, obj2) {
|
||||
return obj1.profile_id - obj2.profile_id;
|
||||
})
|
||||
for(var i in newprofile.profiles){var obj=newprofile.profiles[i];
|
||||
buildProfiletext(obj,function(profiletext){
|
||||
profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext})
|
||||
})
|
||||
}
|
||||
photoImage.source="file://"+newprofile.friendica_owner.profile_image;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Image {
|
||||
id: photoImage
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.left: parent.left
|
||||
width: 15*mm
|
||||
height:15*mm
|
||||
source: "file://"+profile.friendica_owner.profile_image
|
||||
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
imagePicking=true;
|
||||
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
|
||||
'}}',profileGridTab,"imagePicker");
|
||||
imagePicker.pickImage()
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
id:phototextRectangle
|
||||
color:"black"
|
||||
z:3
|
||||
opacity: 0.5
|
||||
width:6*mm
|
||||
height: phototext.contentHeight
|
||||
anchors.top: photoImage.top
|
||||
anchors.right: photoImage.right
|
||||
}
|
||||
Text {
|
||||
id:phototext
|
||||
z:4
|
||||
text: "\uf040"
|
||||
width:5*mm
|
||||
anchors.top: photoImage.top
|
||||
anchors.right:photoImage.right
|
||||
color: "white"
|
||||
font.pixelSize: 4*mm
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:updatebutton
|
||||
height: 6*mm
|
||||
width:8*mm
|
||||
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
|
||||
text:qsTr("Update")
|
||||
font.pixelSize: 3*mm
|
||||
anchors.left: photoImage.right
|
||||
anchors.leftMargin: 0.5*mm
|
||||
anchors.topMargin: mm
|
||||
anchors.top: parent.top
|
||||
onClicked:{updateProfileImage()}
|
||||
}
|
||||
Label {
|
||||
id: namelabel
|
||||
x: mm
|
||||
width: parent.width-6*mm
|
||||
height: 3*mm
|
||||
text:(Qt.atob(profile.friendica_owner.name))+" (@"+profile.friendica_owner.screen_name+")"
|
||||
elide:Text.ElideRight
|
||||
anchors.topMargin: 0
|
||||
anchors.left: photoImage.left
|
||||
wrapMode: Text.Wrap
|
||||
color: "#303030"
|
||||
font.pixelSize: 4*mm
|
||||
anchors.top: photoImage.bottom
|
||||
}
|
||||
|
||||
ListModel{id:profileModel}
|
||||
Component{
|
||||
id:profileItem
|
||||
Rectangle{
|
||||
id:profileRect
|
||||
width:profileView.width
|
||||
height: 5*mm+profiletextfield.height
|
||||
Text{
|
||||
y:mm
|
||||
font.pixelSize: 3*mm
|
||||
text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>"
|
||||
color:"black"
|
||||
}
|
||||
Text{
|
||||
id:profiletextfield
|
||||
x:2*mm
|
||||
y:4.5*mm
|
||||
width:parent.width-2.5*mm
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 3*mm
|
||||
text:profiletext
|
||||
color:"black"
|
||||
}
|
||||
}
|
||||
}
|
||||
Component{
|
||||
id:textcomponent
|
||||
Text{
|
||||
id:namelabeltext
|
||||
width: namelabelflickable.width
|
||||
height: implicitHeight
|
||||
font.pixelSize: 3*mm
|
||||
textFormat:Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
text:"<b>"+qsTr("Description")+": </b> "+(Qt.atob(profile.friendica_owner.description))+"<br> <b>"+qsTr("Location")+":</b> "+profile.friendica_owner.location+"<br> <b>"+qsTr("Posts")+":</b> "+profile.friendica_owner.statuses_count+
|
||||
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ profile.friendica_owner.url+"'>"+profile.friendica_owner.url+"</a><br>"+
|
||||
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||
onLinkActivated: {
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
}
|
||||
|
||||
// Rectangle{
|
||||
// id: detailsrectangle
|
||||
|
||||
|
||||
ScrollView{
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
id:namelabelflickable
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
width: parent.width-mm
|
||||
height:parent.height-22*mm//friendsTabView.height-45*mm
|
||||
x: mm
|
||||
clip:true
|
||||
|
||||
ListView {
|
||||
id: profileView
|
||||
header:textcomponent
|
||||
// width:parent.width
|
||||
// height: root.height
|
||||
// clip: true
|
||||
spacing: 0
|
||||
model: profileModel
|
||||
delegate: profileItem
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
Component.onCompleted: {
|
||||
profile.profiles.sort(function(obj1, obj2) {
|
||||
return obj1.profile_id - obj2.profile_id;
|
||||
})
|
||||
for(var i in profile.profiles){var obj=profile.profiles[i];
|
||||
buildProfiletext(obj,function(profiletext){
|
||||
profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue