Conversations improvement

Privacy option in the conversation is now inherited by toot in the thread
This commit is contained in:
Dusko Angirevic 2017-10-19 10:42:40 +02:00
parent 006222854d
commit 751a6e7759
2 changed files with 30 additions and 31 deletions

View file

@ -20,6 +20,7 @@ Page {
} }
} }
WorkerScript { WorkerScript {
id: worker id: worker
source: "../lib/Worker.js" source: "../lib/Worker.js"
@ -54,15 +55,13 @@ Page {
} }
delegate: VisualContainer {} delegate: VisualContainer {}
onCountChanged: { onCountChanged: {
for (var i = 0; i < mdl.count; i++){ if (mdl)
if (mdl.get(i).status_id === toot_id) { for (var i = 0; i < mdl.count; i++){
console.log(mdl.get(i).status_id) if (mdl.get(i).status_id === toot_id) {
positionViewAtIndex(i, ListView.Center ) console.log(mdl.get(i).status_id)
positionViewAtIndex(i, ListView.Center )
}
} }
}
//last_id_MN
} }
} }
@ -196,7 +195,6 @@ Page {
onClicked: { onClicked: {
btnAddImage.enabled = false; btnAddImage.enabled = false;
var once = true; var once = true;
// MultiImagePickerDialog
var imagePicker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { "allowedOrientations" : Orientation.All }); var imagePicker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { "allowedOrientations" : Orientation.All });
imagePicker.selectedContentChanged.connect(function () { imagePicker.selectedContentChanged.connect(function () {
var imagePath = imagePicker.selectedContent; var imagePath = imagePicker.selectedContent;
@ -205,18 +203,6 @@ Page {
imageUploader.setFile(imagePath); imageUploader.setFile(imagePath);
imageUploader.setAuthorizationHeader(Logic.conf.api_user_token); imageUploader.setAuthorizationHeader(Logic.conf.api_user_token);
imageUploader.upload(); imageUploader.upload();
/*if (once) {
for(var i = 0; i < imagePicker.selectedContent.count; i++){
var file = imagePicker.selectedContent.get(i);
console.log(JSON.stringify(file))
imageUploader.setUploadUrl("https://mastodon.social/api/v1/media")
//imageUploader.setUploadUrl("https://httpbin.org/post")
imageUploader.setFile(file.url);
imageUploader.setAuthorizationHeader(Logic.conf.api_user_token);
imageUploader.upload();
}
once = false;
}*/
}); });
} }
} }
@ -245,15 +231,6 @@ Page {
} }
/*function run() {
imageUploader.setFile('file:///media/sdcard/686E-E026/Pictures/Camera/20170701_143819.jpg');
imageUploader.setParameters("imageUploadData.imageAlbum", "imageUploadData.imageTitle", "imageUploadData.imageDesc");
imageUploader.setAuthorizationHeader(Logic.conf.api_user_token);
imageUploader.setUserAgent("constant.userAgent");
imageUploader.upload();
}*/
} }
ComboBox { ComboBox {
id: privacy id: privacy
@ -328,6 +305,28 @@ Page {
} }
Component.onCompleted: { Component.onCompleted: {
toot.cursorPosition = toot.text.length toot.cursorPosition = toot.text.length
if (mdl.count > 0) {
var setIndex = 0;
switch (mdl.get(0).status_visibility){
case "unlisted":
setIndex = 1;
break;
case "private":
setIndex = 2;
break;
case "direct":
privacy.enabled = false;
setIndex = 3;
break;
default:
privacy.enabled = true;
setIndex = 0;
}
privacy.currentIndex = setIndex;
}
console.log(JSON.stringify())
worker.sendMessage({ worker.sendMessage({
'action' : 'statuses/'+mdl.get(0).status_id+'/context', 'action' : 'statuses/'+mdl.get(0).status_id+'/context',
'method' : 'GET', 'method' : 'GET',

View file

@ -61,7 +61,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Theme.highlightDimmerColor color: Theme.highlightDimmerColor
visible: status_sensitive visible: typeof status_sensitive != 'undefined' && status_sensitive ? true : false
Image { Image {
source: "image://theme/icon-l-attention?"+Theme.highlightColor source: "image://theme/icon-l-attention?"+Theme.highlightColor
anchors.centerIn: parent anchors.centerIn: parent