diff options
Diffstat (limited to 'eventsview-plugins')
5 files changed, 56 insertions, 11 deletions
diff --git a/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml b/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml index 8db1811..e9c76da 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml +++ b/eventsview-plugins/eventsview-plugin-mastodon/MastodonFeedItem.qml @@ -1,11 +1,12 @@ -/**************************************************************************** - ** - ** Copyright (C) 2013-2026 Jolla Ltd. - ** - ****************************************************************************/ +/* + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ 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() } } } diff --git a/eventsview-plugins/eventsview-plugin-mastodon/eventsview-plugin-mastodon.pro b/eventsview-plugins/eventsview-plugin-mastodon/eventsview-plugin-mastodon.pro index 723d78b..8c9663e 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/eventsview-plugin-mastodon.pro +++ b/eventsview-plugins/eventsview-plugin-mastodon/eventsview-plugin-mastodon.pro @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. +# +# SPDX-License-Identifier: BSD-3-Clause + TEMPLATE = lib TARGET = jollaeventsviewmastodonplugin TARGET = $$qtLibraryTarget($$TARGET) diff --git a/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml b/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml index aa1bcb0..2a5d9c1 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml +++ b/eventsview-plugins/eventsview-plugin-mastodon/mastodon-delegate.qml @@ -1,8 +1,8 @@ -/**************************************************************************** - ** - ** Copyright (C) 2013-2026 Jolla Ltd. - ** - ****************************************************************************/ +/* + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ import QtQuick 2.0 import Sailfish.Silica 1.0 diff --git a/eventsview-plugins/eventsview-plugin-mastodon/plugin.cpp b/eventsview-plugins/eventsview-plugin-mastodon/plugin.cpp index aa993a0..9ade6e2 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/plugin.cpp +++ b/eventsview-plugins/eventsview-plugin-mastodon/plugin.cpp @@ -1,5 +1,7 @@ /* - * Copyright (C) 2013-2026 Jolla Ltd. + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause */ #include <QQmlExtensionPlugin> diff --git a/eventsview-plugins/eventsview-plugins.pro b/eventsview-plugins/eventsview-plugins.pro index d9b1842..095fd02 100644 --- a/eventsview-plugins/eventsview-plugins.pro +++ b/eventsview-plugins/eventsview-plugins.pro @@ -1,2 +1,6 @@ +# SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. +# +# SPDX-License-Identifier: BSD-3-Clause + TEMPLATE = subdirs SUBDIRS += eventsview-plugin-mastodon |
