import QtQuick 2.7 import QtQuick.Controls 1.4 import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs import "qrc:/qml/genericqml" Rectangle{ id:imageDialog //property var attachImageURLs: [] property var contacts: [] property var groups: [] property var contact_allow:login.permissions[0] property var contact_deny:login.permissions[1] property var group_allow:login.permissions[2] property var group_deny:login.permissions[3] property int imageNo: 0 function uploadSelectedImage(inumber){ xhr.url= login.server + "/api/friendica/photo/create.json"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.clearParams(); xhr.setParam("desc",imageUploadModel.get(inumber).description); xhr.setParam("album", album.currentText); xhr.setParam("contact_allow","27"); 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))}; if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))}; xhr.setImageFileParam("media", imageUploadModel.get(inumber).imageUrl ); xhr.post(); } z:2 border.color: "grey" width: parent.width-4*mm height:parent.height-12*mm x:2*mm y:10*mm property string directory: "" ImagePicker { id: imagePicker; multiple : true onReady: {//var urlstring=decodeURIComponent(imagePicker.imageUrl); //var fileurl="file://"+urlstring.substring(5); for (var n in imagePicker.imageUrls){ imageUploadModel.append({"imageUrl":imagePicker.imageUrls[n].toString(),"description":""}) } } } Connections{ target:xhr onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}} onSuccess:{ imageNo=imageNo+1; if(imageNo0){ uploadSelectedImage(0) }} } } ProgressBar{ id: newimageProgress width: 15*mm height: buttonRow.height anchors.top: parent.top anchors.right:buttonRow.left anchors.rightMargin:mm visible: false value: imageNo/imageUploadModel.count } Component.onCompleted:{ albumModel.append({"text":""}); try{Helperjs.readField("album",db,"imageData",login.username,function(storedAlbums){ //print(JSON.stringify(storedAlbums)) for (var n in storedAlbums){ albumModel.append({"text":storedAlbums[n]})} })} catch (e){print(e)} } // BusyIndicator{ // id: imageBusy // anchors.horizontalCenter: imageUploadView.horizontalCenter // anchors.top:imageUploadView.top // anchors.topMargin: 2*mm // width:10*mm // height: 10*mm // running:false // } }