summaryrefslogtreecommitdiff
path: root/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml
diff options
context:
space:
mode:
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
+ }
}