create and delete events

This commit is contained in:
LubuWest 2022-11-15 22:02:09 +01:00
commit 400241ec6a
34 changed files with 1346 additions and 614 deletions

View file

@ -217,11 +217,11 @@ Page {
height: 6*mm
text:qsTr("Approve")
onClicked:{
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/authorize",'',"POST",root,function(returnvalue){
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
})
root.friendsSignal();
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){},"id", contact.id)
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
rootstackView.pop()
}
}
@ -232,9 +232,10 @@ Page {
text:qsTr("Reject")
onClicked:{
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/reject",'',"POST",root,function(returnvalue){
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
})
root.friendsSignal();
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){},"id", contact.id)
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
rootstackView.pop()
}
}
@ -245,9 +246,10 @@ Page {
text:qsTr("Ignore")
onClicked:{
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/ignore",'',"POST",root,function(returnvalue){
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
});
root.friendsSignal();
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){},"id", contact.id)
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
rootstackView.pop()
}
}
@ -259,13 +261,11 @@ Page {
onClicked:{
contactBusy.running=true;
Helperjs.friendicaPostRequest(login,"/api/v1/accounts/" + contact.id + "/follow",'',"POST",root,function(returnvalue){
Helperjs.updateData(db,"contacts",login.username,"isFriend",1,function(){},"id",contact.id)
root.friendsSignal(login.username);
rootstackView.pop()
// var username=login.username
//
});
});
Helperjs.updateData(root.db,"contacts",root.login.username,"isFriend",1,function(){},"id",contact.id)
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
rootstackView.pop()
}
}
@ -275,12 +275,13 @@ Page {
height: 6*mm
text:qsTr("Unfollow")
onClicked:{
contactBusy.running=true;
Helperjs.friendicaPostRequest(login,"/api/v1/accounts/" + contact.id + "/unfollow",'',"POST",root,function(returnvalue){
contactBusy.running=true;
Helperjs.updateData(db,"contacts",login.username,"isFriend",0,function(){},"id",contact.id)
root.friendsSignal(login.username);
rootstackView.pop()
});
Helperjs.updateData(root.db,"contacts",root.login.username,"isFriend",0,function(){},"id",contact.id)
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
rootstackView.pop()
}
}
@ -313,7 +314,9 @@ 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>"+
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())+"<br>"+
"<b>"+qsTr("Followers")+":</b> "+contact.followers_count+"<br>"+
"<b>"+qsTr("Following")+":</b> "+contact.friends_count+"<br>"
onLinkActivated: {
Qt.openUrlExternally(link)}
}

View file

@ -92,13 +92,11 @@ Page {
ListView {
id: conversationView
property string viewtype: "conversation"
//x:3*mm
//y:8*mm
width: conversationList.width//-4*mm
height:conversationList.height-root.fontFactor*osSettings.bigFontSize//-20*mm
height:conversationList.height-2*root.fontFactor*osSettings.bigFontSize//-20*mm
clip: true
spacing: 0
footer: MessageSend{conversation:true}
//footer: MessageSend{conversation:true}
model: conversationModel
delegate: Newsitem{}
}
@ -114,7 +112,7 @@ Page {
Connections{
target:newstab
onConversationChanged:{
function onConversationChanged(){
if(newstab.conversation.length==0){
rootstackView.pop()
} else { conversationBusy.running=false;

View file

@ -92,7 +92,7 @@ Rectangle{
try{newsBusy.running=true;conversationBusy.running=true}catch(e){}
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
if (in_reply_to_status_id==""){
//if (in_reply_to_status_id==""){
xhr.setApi("/api/statuses/update");
xhr.clearParams();
xhr.setParam("source", "Friendiqa");
@ -111,15 +111,16 @@ Rectangle{
}
xhr.post();
Newsjs.storeHashtags(login,db,status,root)
}else {
xhr.setApi("/api/v1/statuses");
xhr.clearParams();
xhr.setParam("status", status);
xhr.setParam("in_reply_to_id", in_reply_to_status_id);
xhr.post();
Newsjs.storeHashtags(login,db,status,root)
// }else {
// xhr.setApi("/api/v1/statuses");
// xhr.clearParams();
// xhr.setParam("status", status);
// xhr.setParam("in_reply_to_id", in_reply_to_status_id);
// xhr.post();
// Newsjs.storeHashtags(login,db,status,root)
// messageSend.destroy()
// }
messageSend.destroy()
}
}
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
@ -402,7 +403,7 @@ Rectangle{
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf03e"
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
visible:(newsSwipeview.stacktype!="DirectMessages")
onClicked: {
if (attachImageURLs.length>0){//Server currently accepts only one attachment
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
@ -526,9 +527,6 @@ Rectangle{
PropertyChanges {
target: titleField; visible:false
}
PropertyChanges {
target: attachButton; visible:false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}