Friendiqa v0.2
This commit is contained in:
parent
74fb551755
commit
a3be940192
123 changed files with 9156 additions and 2455 deletions
|
@ -1,3 +1,34 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -19,7 +50,7 @@ Rectangle {
|
|||
y:1
|
||||
width: 10*mm
|
||||
height:10*mm
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
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"}}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,34 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -8,7 +39,7 @@ x:mm
|
|||
y:mm
|
||||
property var contact:{}
|
||||
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>")
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
|
@ -50,7 +81,7 @@ Rectangle{
|
|||
frameVisible: true
|
||||
id:namelabelflickable
|
||||
width: root.width-10*mm
|
||||
height:root.height-50*mm//friendsTabView.height-45*mm
|
||||
height:root.height-50*mm
|
||||
x: mm
|
||||
clip:true
|
||||
Text{
|
||||
|
@ -82,7 +113,7 @@ Rectangle{
|
|||
fotostab.phototabstatus="Contact";
|
||||
root.currentIndex=2;
|
||||
fotostab.active=true;
|
||||
root.fotoSignal(contact) ;
|
||||
root.fotoSignal(root.login,contact) ;
|
||||
contactLargeComponent.destroy();
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +124,7 @@ Rectangle{
|
|||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.messageSignal(contact.id) ;
|
||||
root.messageSignal(contact) ;
|
||||
contactLargeComponent.destroy();
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +150,7 @@ Rectangle{
|
|||
root.currentIndex=3;
|
||||
calendartab.active=true;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
root.eventSignal(contact.url);
|
||||
root.eventSignal(contact);
|
||||
contactLargeComponent.destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
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:friendsTabView.height-45*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> "+Qt.atob(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
|
||||
|
||||
BlueButton{
|
||||
id:photobutton
|
||||
text: "\uf03e" // "Photos"
|
||||
visible:(contact.network=="dfrn")
|
||||
onClicked:{
|
||||
fotostab.phototabstatus="Contact";
|
||||
root.currentIndex=2;
|
||||
fotostab.active=true;
|
||||
root.fotoSignal(contact) ;
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:messagebutton
|
||||
text: "\uf0e6" //"Messages"
|
||||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.messageSignal(contact.id) ;
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:dmbutton
|
||||
visible: (contact.following=="true")
|
||||
text: "\uf040" //"DM"
|
||||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.directmessageSignal(contact.screen_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BlueButton{
|
||||
id:eventbutton
|
||||
visible:(contact.network=="dfrn")
|
||||
text:"\uf073"
|
||||
onClicked:{
|
||||
root.currentIndex=3;
|
||||
calendartab.active=true;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
root.eventSignal(contact.url);
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id: closeButton
|
||||
text: "\uf057" //"close"
|
||||
onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,34 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 "qrc:/js/helper.js" as Helperjs
|
||||
|
|
|
@ -1,6 +1,38 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
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
|
||||
|
@ -14,15 +46,28 @@ Rectangle {
|
|||
function showContactdetails(contact){
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if(contact.isFriend){
|
||||
friendsTabView.currentIndex=0;
|
||||
friendsTabView.currentIndex=1;
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
else{friendsTabView.currentIndex=1;
|
||||
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)
|
||||
}
|
||||
|
||||
TabView{
|
||||
id:friendsTabView
|
||||
|
@ -31,23 +76,23 @@ Rectangle {
|
|||
y:mm
|
||||
width: root.width-2*mm
|
||||
height: root.height-10*mm
|
||||
currentIndex: 0
|
||||
currentIndex: 1
|
||||
signal contactsSignal(var contact)
|
||||
signal groupsSignal(var username)
|
||||
onCurrentIndexChanged:{
|
||||
if (currentIndex==0){
|
||||
if (currentIndex==1){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==1){
|
||||
else if (currentIndex==2){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==2){groupsSignal(root.login.username)}
|
||||
else if (currentIndex==3){groupsSignal(root.login.username)}
|
||||
}
|
||||
style: TabViewStyle {
|
||||
frameOverlap: 1
|
||||
tab: Rectangle {
|
||||
color: "white"
|
||||
implicitWidth: root.width/3-2*mm
|
||||
implicitWidth: root.width/4-2*mm
|
||||
implicitHeight: 4*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
|
@ -61,24 +106,43 @@ Rectangle {
|
|||
tabsAlignment:Qt.AlignHCenter
|
||||
}
|
||||
|
||||
Tab{
|
||||
id:profileGridTab
|
||||
title: qsTr("Me")
|
||||
Component.onCompleted:{
|
||||
showProfile(function(profile){
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
|
||||
var profilecomp = component.createObject(profileGridTab,{"profile": profile});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Tab{
|
||||
title: qsTr("Friends")
|
||||
Rectangle{
|
||||
id: friendsGridTab
|
||||
property int currentContact:0
|
||||
function showFriends(contact){
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db,"contacts",login.username,function(friendsobject){
|
||||
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
|
||||
for (var i=0;i<friendsobject.length;i++){
|
||||
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)
|
||||
currentContact=i+1;
|
||||
if(currentContact==root.newContacts.length){showFriends(root.login.username)}
|
||||
}
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: updateFriendsButton
|
||||
text: "\uf021"
|
||||
|
@ -101,8 +165,8 @@ Rectangle {
|
|||
anchors.top: parent.top
|
||||
anchors.right:updateFriendsButton.left
|
||||
anchors.rightMargin:mm
|
||||
visible: (root.currentContact!=root.newContacts.length)?true:false
|
||||
value: root.currentContact/root.newContacts.length
|
||||
visible: (currentContact!=(root.newContacts.length))?true:false
|
||||
value: currentContact/root.newContacts.length
|
||||
}
|
||||
|
||||
GridView {
|
||||
|
@ -126,7 +190,8 @@ Rectangle {
|
|||
Component.onCompleted: {
|
||||
root.friendsSignal.connect(showFriends);
|
||||
friendsTabView.contactsSignal.connect(showFriends);
|
||||
showFriends(root.login.username)
|
||||
showFriends(root.login.username);
|
||||
root.newContacts=[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,17 +275,6 @@ Rectangle {
|
|||
xhr.setParam("user", group.user);
|
||||
xhr.setParam("json",group);
|
||||
xhr.post();
|
||||
// Helperjs.friendicaPostRequest(login,api,groupdata,"POST",rootwindow, function (obj){print("groupcreate "+obj);
|
||||
// var groups=JSON.parse(obj);
|
||||
// db.transaction( function(tx) {
|
||||
// var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups
|
||||
// for (var i=0;i<groups.length;i++){
|
||||
// var memberarray=[]; for (var user in groups[i].user){memberarray.push(parseInt(groups[i].user[user].cid))}
|
||||
// //print("Members: "+groups[i].user)
|
||||
// var result2 = tx.executeSql('INSERT INTO groups VALUES (?,?,?,?)', [login.username,groups[i].name,groups[i].gid,JSON.stringify(memberarray)])}
|
||||
// callback()
|
||||
// });
|
||||
// })
|
||||
}
|
||||
|
||||
Connections{
|
||||
|
|
|
@ -1,3 +1,34 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
|
|
277
source-android/qml/contactqml/ProfileComponent.qml
Normal file
277
source-android/qml/contactqml/ProfileComponent.qml
Normal file
|
@ -0,0 +1,277 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/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 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
Rectangle {
|
||||
width:root.width-2*mm
|
||||
height:root.height-14*mm
|
||||
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)
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: update
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
text: "\uf021"
|
||||
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
|
||||
x:mm
|
||||
y:mm
|
||||
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:{
|
||||
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
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:updatebutton
|
||||
height: 5*mm
|
||||
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
|
||||
text:qsTr("Update")
|
||||
anchors.left: photoImage.right
|
||||
anchors.leftMargin: 0.5*mm
|
||||
anchors.topMargin: mm
|
||||
anchors.top: parent.top
|
||||
onClicked:{updateProfileImage()}
|
||||
}
|
||||
Label {
|
||||
id: namelabel
|
||||
x: mm
|
||||
width: root.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:3.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> "+(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
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
|
||||
ScrollView{
|
||||
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
|
||||
frameVisible: true
|
||||
id:namelabelflickable
|
||||
width: root.width-10*mm
|
||||
height:root.height-36*mm//friendsTabView.height-45*mm
|
||||
x: mm
|
||||
clip:true
|
||||
|
||||
ListView {
|
||||
id: profileView
|
||||
header:textcomponent
|
||||
width:root.width-10*mm
|
||||
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