From 751a6e775959cbf09f2b81cc23d5f84cd67a6bee Mon Sep 17 00:00:00 2001 From: Dusko Angirevic Date: Thu, 19 Oct 2017 10:42:40 +0200 Subject: [PATCH] Conversations improvement Privacy option in the conversation is now inherited by toot in the thread --- qml/pages/Conversation.qml | 59 ++++++++++++++++---------------- qml/pages/components/MyImage.qml | 2 +- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/qml/pages/Conversation.qml b/qml/pages/Conversation.qml index 27a2d30..073a34b 100644 --- a/qml/pages/Conversation.qml +++ b/qml/pages/Conversation.qml @@ -20,6 +20,7 @@ Page { } } + WorkerScript { id: worker source: "../lib/Worker.js" @@ -54,15 +55,13 @@ Page { } delegate: VisualContainer {} onCountChanged: { - for (var i = 0; i < mdl.count; i++){ - if (mdl.get(i).status_id === toot_id) { - console.log(mdl.get(i).status_id) - positionViewAtIndex(i, ListView.Center ) + if (mdl) + for (var i = 0; i < mdl.count; i++){ + if (mdl.get(i).status_id === toot_id) { + console.log(mdl.get(i).status_id) + positionViewAtIndex(i, ListView.Center ) + } } - } - - //last_id_MN - } } @@ -196,7 +195,6 @@ Page { onClicked: { btnAddImage.enabled = false; var once = true; - // MultiImagePickerDialog var imagePicker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { "allowedOrientations" : Orientation.All }); imagePicker.selectedContentChanged.connect(function () { var imagePath = imagePicker.selectedContent; @@ -205,18 +203,6 @@ Page { imageUploader.setFile(imagePath); imageUploader.setAuthorizationHeader(Logic.conf.api_user_token); 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 { id: privacy @@ -328,6 +305,28 @@ Page { } Component.onCompleted: { 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({ 'action' : 'statuses/'+mdl.get(0).status_id+'/context', 'method' : 'GET', diff --git a/qml/pages/components/MyImage.qml b/qml/pages/components/MyImage.qml index 1527d4e..4f94ce9 100644 --- a/qml/pages/components/MyImage.qml +++ b/qml/pages/components/MyImage.qml @@ -61,7 +61,7 @@ Item { Rectangle { anchors.fill: parent color: Theme.highlightDimmerColor - visible: status_sensitive + visible: typeof status_sensitive != 'undefined' && status_sensitive ? true : false Image { source: "image://theme/icon-l-attention?"+Theme.highlightColor anchors.centerIn: parent