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

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