fix copy toot-URL

if the toot url isn't provided (for example in retoots), the toot uri will be used
This commit is contained in:
molan-git 2020-06-09 18:46:36 +02:00
parent 5f4dae2a2d
commit 6c4e5466c0
2 changed files with 23 additions and 8 deletions

View file

@ -17,8 +17,9 @@ Page {
property ListModel suggestedModel property ListModel suggestedModel
property string toot_id: "" property string toot_id: ""
property string toot_url: "" property string toot_url: ""
property string toot_uri: ""
property int tootMaxChar: 500; property int tootMaxChar: 500;
property ListModel mdl property ListModel mdl
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
onSuggestedUserChanged: { onSuggestedUserChanged: {
@ -100,13 +101,26 @@ Page {
} }
PullDownMenu { PullDownMenu {
visible: type === "reply" && toot_url !== "" id: pulleyConversation
MenuItem { visible: type === "reply" //&& toot_url !== ""
text: qsTr("Copy Link to Clipboard") MenuItem {
onClicked: Clipboard.text = toot_url text: qsTr("Copy Link to Clipboard")
} onClicked: if (toot_url === "") {
}
} var test = toot_uri.split("/")
console.log(toot_uri)
console.log(JSON.stringify(test))
console.log(JSON.stringify(test.length))
if (test.length === 8 && (test[7] === "activity")) {
var urialt = toot_uri.replace("activity", "")
Clipboard.text = urialt
}
else Clipboard.text = toot_uri
} else onClicked: Clipboard.text = toot_url
}
}
}
Rectangle { Rectangle {
id: predictionList id: predictionList

View file

@ -340,6 +340,7 @@ BackgroundItem {
headerTitle: "Conversation", headerTitle: "Conversation",
toot_id: status_id, toot_id: status_id,
toot_url: status_url, toot_url: status_url,
toot_uri: status_uri,
title: account_display_name, title: account_display_name,
description: '@'+account_acct, description: '@'+account_acct,
avatar: account_avatar, avatar: account_avatar,