summaryrefslogtreecommitdiff
path: root/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@jolla.com>2026-02-12 12:34:14 +0100
committerAndrew Branson <andrew.branson@jolla.com>2026-02-12 15:05:57 +0100
commitbce74e963abeb96a9c335f5461611dee544abc4c (patch)
treeca584a97f1094212c79942702c6b96f6c66029c0 /eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml
parent6ec21cf79e0103b874086089673800bd32fc6bea (diff)
Enhance Mastodon post actions and metadata handling for reblogs and favourites
Diffstat (limited to 'eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml')
-rw-r--r--eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml22
1 files changed, 20 insertions, 2 deletions
diff --git a/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml b/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml
index 906dc9c..aefaa96 100644
--- a/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml
+++ b/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml
@@ -25,6 +25,10 @@ SocialMediaAccountDelegate {
dataType: SocialSync.Posts
providerName: "mastodon"
+ MastodonPostActions {
+ id: mastodonPostActions
+ }
+
model: MastodonPostsModel {
onCountChanged: {
if (count > 0) {
@@ -42,9 +46,12 @@ SocialMediaAccountDelegate {
imageList: delegateItem.variantRole(model, ["images", "mediaAttachments", "media"])
avatarSource: delegateItem.convertUrl(delegateItem.stringRole(model, ["icon", "avatar", "avatarUrl"]))
fallbackAvatarSource: delegateItem.stringRole(model, ["icon", "avatar", "avatarUrl"])
- accountId: model.accounts[0]
+ resolvedStatusUrl: delegateItem.statusUrl(model)
+ postId: delegateItem.stringRole(model, ["mastodonId", "statusId", "id", "twitterId"])
+ postActions: mastodonPostActions
+ accountId: delegateItem.firstAccountId(model)
- onTriggered: Qt.openUrlExternally(delegateItem.statusUrl(model))
+ onTriggered: Qt.openUrlExternally(resolvedStatusUrl)
Component.onCompleted: {
refreshTimeCount = Qt.binding(function() { return delegateItem.refreshTimeCount })
@@ -164,4 +171,15 @@ SocialMediaAccountDelegate {
}
return source
}
+
+ function firstAccountId(modelData) {
+ var accounts = modelData.accounts
+ if (accounts && accounts.length > 0) {
+ var accountId = Number(accounts[0])
+ if (!isNaN(accountId)) {
+ return accountId
+ }
+ }
+ return -1
+ }
}