v0.6.2 Bugfix: download and upload public images, comments in timeline

This commit is contained in:
LubuWest 2021-08-11 20:06:17 +02:00
commit d09a55bcd9
14 changed files with 200 additions and 145 deletions

View file

@ -29,9 +29,11 @@
// 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 2.15
AnimatedImage {id:gif;
width:toprow.width;
cache:false
smooth: false
//property string mimetype:""
fillMode: Image.PreserveAspectFit;
onStatusChanged: {playing = (status == AnimatedImage.Ready)}

View file

@ -173,7 +173,13 @@ Rectangle{
function getOldNews(){
var currentTime= new Date();
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
var oldnewsitemobject=newsModel.get(newsModel.count-1).newsitemobject;
try{ if(oldnewsitemobject.hasOwnProperty("lastcomment")){
var lastnews_id=oldnewsitemobject.lastcomment.created_at;
}else{
var lastnews_id=oldnewsitemobject.created_at;
}
} catch(e){print(e);var lastnews_id=99999999999999 }
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;

View file

@ -53,7 +53,7 @@ Rectangle{
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("desc",imageUploadModel.get(inumber).description);
xhr.setParam("album", album.currentText);
if(album.editText!=""){xhr.setParam("album", album.editText)}else{xhr.setParam("album", album.currentText)};
//if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
//if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
//if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
@ -96,7 +96,7 @@ Rectangle{
}else{
Imagejs.requestList(login,db, true,root,function(obj){
fotorectangle.newimages=obj;
imageDialog.destroy()
photoStack.pop()
})
}} else{
@ -304,7 +304,7 @@ Rectangle{
text: imageId==""?qsTr("Upload"):qsTr("Change")
font.pointSize: osSettings.bigFontSize
onClicked:{
if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
if(album.currentText==""&&album.editText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
else if (imageId!=""){uploadBusy.running=true; updateImage()}
else{newimageProgress.visible=true;
if (imageUploadModel.count>0){

View file

@ -61,22 +61,28 @@ StackView{
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);
//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();
// 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}
// download next image
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{
@ -90,10 +96,17 @@ StackView{
function onDownloaded(type,url,filename,i){
if(type=="picture"){fotorectangle.currentimageno=fotorectangle.currentimageno+1}
}
function onError(data,url,api,code){if(data=="picturelist"){
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)
} else {fotorectangle.currentimageno=fotorectangle.currentimageno+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{