summaryrefslogtreecommitdiff
path: root/eventsview-plugins/eventsview-plugin-mastodon
diff options
context:
space:
mode:
Diffstat (limited to 'eventsview-plugins/eventsview-plugin-mastodon')
-rw-r--r--eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml35
1 files changed, 35 insertions, 0 deletions
diff --git a/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml b/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
index 8db1811..2a285cd 100644
--- a/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
+++ b/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml
@@ -6,6 +6,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
+import Sailfish.Share 1.0
import Sailfish.TextLinking 1.0
import org.nemomobile.lipstick 0.1
import "shared"
@@ -51,6 +52,15 @@ SocialMediaFeedItem {
//: Action label shown in Mastodon interaction menu when the post is already boosted.
//% "Undo boost"
readonly property string _unboostActionText: qsTrId("lipstick-jolla-home-la-mastodon_unboost")
+ //: Action label shown in Mastodon interaction menu.
+ //% "Share"
+ readonly property string _shareActionText: qsTrId("lipstick-jolla-home-la-mastodon_share")
+ //: Link title used when sharing a Mastodon post.
+ //% "Post from Mastodon"
+ readonly property string _shareLinkTitle: qsTrId("lipstick-jolla-home-la-mastodon_share_link_title")
+ property var _shareAction: ShareAction {
+ title: item._shareActionText
+ }
timestamp: model.timestamp
onRefreshTimeCountChanged: formattedTime = Format.formatDate(model.timestamp, Format.TimeElapsed)
@@ -194,6 +204,10 @@ SocialMediaFeedItem {
return isNaN(parsed) ? -1 : parsed
}
+ function shareStatusUrl() {
+ return model && model.url ? model.url.toString() : ""
+ }
+
function topLevelParent() {
var p = item
while (p && p.parent) {
@@ -262,6 +276,7 @@ SocialMediaFeedItem {
interactionItems: [
{
name: "like",
+ // U+2605 BLACK STAR
symbol: "\u2605",
active: item.isFavourited,
inactiveText: item._favouriteActionText,
@@ -269,10 +284,19 @@ SocialMediaFeedItem {
},
{
name: "reblog",
+ // U+21BB CLOCKWISE OPEN CIRCLE ARROW
symbol: "\u21BB",
active: item.isReblogged,
inactiveText: item._boostActionText,
activeText: item._unboostActionText
+ },
+ {
+ name: "share",
+ // U+260D OPPOSITION (ironic doncha think)
+ symbol: "\u260D",
+ active: false,
+ inactiveText: item._shareActionText,
+ activeText: item._shareActionText
}
]
@@ -301,6 +325,17 @@ SocialMediaFeedItem {
} else {
item.postActions.boost(accountId, postId)
}
+ } else if (actionName === "share") {
+ var shareUrl = item.shareStatusUrl()
+ if (shareUrl.length === 0) {
+ return
+ }
+ item._shareAction.resources = [{
+ "data": shareUrl,
+ "linkTitle": item._shareLinkTitle,
+ "type": "text/x-url"
+ }]
+ item._shareAction.trigger()
}
}
}