Version 0.004

This commit is contained in:
LubuWest 2017-05-11 22:15:34 +02:00
commit 438f8a4e4d
64 changed files with 2736 additions and 636 deletions

View file

@ -16,7 +16,7 @@ Flickable{
id:messageSend
property string parentId: ""
property string reply_to_user:""
property string attachImageURL: "";
property var attachImageURLs: [];
property int directmessage: 0;
property var contacts: []
property var groups: []
@ -25,11 +25,13 @@ Flickable{
property var group_allow:login.permissions[2]
property var group_deny:login.permissions[3]
onAttachImageURLChanged: {if(attachImageURL!=""){
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment; source:"'+
attachImageURL.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURL="";imageAttachment.destroy()}}}',messageColumn,"attachedImage");
console.log("You chose: " + attachImageURL)
}}
function attachImage(url){
//onAttachImageURLsChanged: {if(attachImageURL!=""){
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
url.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+url+'",1)); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
console.log("You chose: " + url)
}
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
xhr.url= login.server + "/api/statuses/update.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
@ -42,7 +44,7 @@ Flickable{
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))};
if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )};
if (attachImageURL.length>0) {for (var image in attachImageURL){xhr.setImageFileParam("media", attachImageURL[image] )}};
xhr.post();
}
@ -122,12 +124,11 @@ Flickable{
}
}
Row{
spacing:2
BlueButton{id:permButton
visible: (directmessage==1)?false:true
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"//qsTr("Permissions")
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
onClicked: {
var component = Qt.createComponent("qrc:/qml/newsqml/PermissionDialog.qml");
var permissions = component.createObject(messageColumn);
@ -137,14 +138,14 @@ Flickable{
text: "\uf0c6"
visible:(directmessage==0)
onClicked: {
if (attachImageURL!=""){
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment. Remove other attachment first!"), messageColumn)}
else{print(filesystem.homePath);
var defaultDirectory="file://"+osSettings.attachImageDir;//"file:///storage/emif.open()
print(defaultDirectory);
var component = Qt.createComponent("qrc:/qml/newsqml/ImageDialog.qml");
var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
}
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)
}
else{
var defaultDirectory="file://"+osSettings.attachImageDir;
var component = Qt.createComponent("qrc:/qml/newsqml/ImageDialog.qml");
var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
}
}
}
BlueButton{
@ -188,7 +189,7 @@ Flickable{
var title=titleField.text.replace("\"","\'");
var body=bodyField.getText(0,bodyField.length);
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURL.toString())}
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
newstab.newstabstatus=login.newsViewType; newsStack.pop()
}