diff options
Diffstat (limited to 'transferengine-plugins/mastodonshareplugin')
6 files changed, 0 insertions, 320 deletions
diff --git a/transferengine-plugins/mastodonshareplugin/MastodonSharePost.qml b/transferengine-plugins/mastodonshareplugin/MastodonSharePost.qml deleted file mode 100644 index d859d96..0000000 --- a/transferengine-plugins/mastodonshareplugin/MastodonSharePost.qml +++ /dev/null @@ -1,138 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -import QtQuick 2.6 -import Sailfish.Silica 1.0 -import Sailfish.Lipstick 1.0 -import Sailfish.TransferEngine 1.0 - -Item { - id: root - - property var shareAction - property string mimeType: { - if (shareAction && shareAction.mimeType) { - return shareAction.mimeType - } - if (shareAction && shareAction.resources - && shareAction.resources.length > 0 - && shareAction.resources[0] - && shareAction.resources[0].type) { - return shareAction.resources[0].type - } - return "" - } - property bool textShare: mimeType === "text/x-url" || mimeType === "text/plain" - - width: parent ? parent.width : 0 - height: previewLoader.item ? previewLoader.item.height : 0 - - Loader { - id: previewLoader - - anchors.fill: parent - sourceComponent: root.textShare ? postPreview : imagePreview - } - - Component { - id: imagePreview - - ShareFilePreview { - shareAction: root.shareAction - metadataStripped: true - descriptionPlaceholderText: qsTr("Write a post") - } - } - - Component { - id: postPreview - - SilicaFlickable { - id: postRoot - - width: parent.width - height: contentHeight - contentHeight: contentColumn.height - - Component.onCompleted: { - sailfishTransfer.loadConfiguration(root.shareAction.toConfiguration()) - statusTextField.forceActiveFocus() - statusTextField.cursorPosition = statusTextField.text.length - } - - SailfishTransfer { - id: sailfishTransfer - } - - Column { - id: contentColumn - - width: parent.width - - TextArea { - id: linkTextField - - width: parent.width - //% "Link" - label: qsTrId("sailfishshare-la-link") - placeholderText: label - visible: sailfishTransfer.content.type === "text/x-url" - text: sailfishTransfer.content.data || sailfishTransfer.content.status || "" - } - - TextArea { - id: statusTextField - - width: parent.width - //% "Status update" - label: qsTrId("sailfishshare-la-status_update") - placeholderText: label - text: { - var title = sailfishTransfer.content.name || sailfishTransfer.content.linkTitle || "" - if (linkTextField.visible) { - return title - } - var body = sailfishTransfer.content.data || sailfishTransfer.content.status || "" - if (title.length > 0 && body.length > 0) { - return title + ": " + body - } - return title + body - } - } - - SystemDialogIconButton { - id: postButton - - anchors.horizontalCenter: parent.horizontalCenter - width: parent.width / 2 - iconSource: "image://theme/icon-m-share" - bottomPadding: Theme.paddingLarge - _showPress: false - - //: Post a social network account status update - //% "Post" - text: qsTrId("sailfishshare-la-post_status") - - onClicked: { - var status = statusTextField.text || "" - var link = linkTextField.visible ? (linkTextField.text || "") : "" - if (link.length > 0 && status.indexOf(link) === -1) { - status = status.length > 0 ? (status + "\n" + link) : link - } - - sailfishTransfer.userData = { - "accountId": sailfishTransfer.transferMethodInfo.accountId, - "status": status - } - sailfishTransfer.mimeType = linkTextField.visible ? "text/x-url" : "text/plain" - sailfishTransfer.start() - root.shareAction.done() - } - } - } - } - } -} diff --git a/transferengine-plugins/mastodonshareplugin/mastodonplugininfo.cpp b/transferengine-plugins/mastodonshareplugin/mastodonplugininfo.cpp deleted file mode 100644 index 919d544..0000000 --- a/transferengine-plugins/mastodonshareplugin/mastodonplugininfo.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "mastodonplugininfo.h" -#include "mastodonshareservicestatus.h" - -MastodonPluginInfo::MastodonPluginInfo() - : SharingPluginInfo() - , m_mastodonShareServiceStatus(new MastodonShareServiceStatus(this)) -{ - m_capabilities << QLatin1String("image/jpeg") - << QLatin1String("image/png") - << QLatin1String("video/mp4") - << QLatin1String("text/x-url") - << QLatin1String("text/plain"); - - connect(m_mastodonShareServiceStatus, &MastodonShareServiceStatus::serviceReady, - this, &MastodonPluginInfo::serviceReady); - connect(m_mastodonShareServiceStatus, &MastodonShareServiceStatus::serviceError, - this, &MastodonPluginInfo::infoError); -} - -MastodonPluginInfo::~MastodonPluginInfo() -{ -} - -QList<SharingMethodInfo> MastodonPluginInfo::info() const -{ - return m_info; -} - -void MastodonPluginInfo::query() -{ - m_mastodonShareServiceStatus->queryStatus(MastodonShareServiceStatus::PassiveMode); -} - -void MastodonPluginInfo::serviceReady() -{ - m_info.clear(); - - for (int i = 0; i < m_mastodonShareServiceStatus->count(); ++i) { - SharingMethodInfo info; - - const MastodonShareServiceStatus::AccountDetails details = m_mastodonShareServiceStatus->details(i); - info.setDisplayName(details.providerName); - info.setSubtitle(details.displayName); - info.setAccountId(details.accountId); - - info.setMethodId(QLatin1String("Mastodon")); - info.setMethodIcon(QLatin1String("image://theme/icon-l-mastodon")); - info.setShareUIPath(QLatin1String("/usr/share/nemo-transferengine/plugins/sharing/MastodonSharePost.qml")); - info.setCapabilities(m_capabilities); - m_info << info; - } - - emit infoReady(); -} diff --git a/transferengine-plugins/mastodonshareplugin/mastodonplugininfo.h b/transferengine-plugins/mastodonshareplugin/mastodonplugininfo.h deleted file mode 100644 index 80fe552..0000000 --- a/transferengine-plugins/mastodonshareplugin/mastodonplugininfo.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef MASTODONPLUGININFO_H -#define MASTODONPLUGININFO_H - -#include <sharingplugininfo.h> -#include <QStringList> - -class MastodonShareServiceStatus; - -class MastodonPluginInfo : public SharingPluginInfo -{ - Q_OBJECT - -public: - MastodonPluginInfo(); - ~MastodonPluginInfo(); - - QList<SharingMethodInfo> info() const; - void query(); - -private Q_SLOTS: - void serviceReady(); - -private: - MastodonShareServiceStatus *m_mastodonShareServiceStatus; - QList<SharingMethodInfo> m_info; - QStringList m_capabilities; -}; - -#endif // MASTODONPLUGININFO_H diff --git a/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.cpp b/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.cpp deleted file mode 100644 index 8c139a2..0000000 --- a/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "mastodonshareplugin.h" -#include "mastodonplugininfo.h" - -#include <QtPlugin> - -MastodonSharePlugin::MastodonSharePlugin() - : QObject(), SharingPluginInterface() -{ -} - -MastodonSharePlugin::~MastodonSharePlugin() -{ -} - -SharingPluginInfo *MastodonSharePlugin::infoObject() -{ - return new MastodonPluginInfo; -} - -QString MastodonSharePlugin::pluginId() const -{ - return QLatin1String("Mastodon"); -} diff --git a/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.h b/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.h deleted file mode 100644 index 04d8412..0000000 --- a/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef MASTODONSHAREPLUGIN_H -#define MASTODONSHAREPLUGIN_H - -#include <QtCore/QObject> - -#include <sharingplugininterface.h> - -class Q_DECL_EXPORT MastodonSharePlugin : public QObject, public SharingPluginInterface -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.sailfishos.share.plugin.mastodon") - Q_INTERFACES(SharingPluginInterface) - -public: - MastodonSharePlugin(); - ~MastodonSharePlugin(); - - SharingPluginInfo *infoObject(); - QString pluginId() const; -}; - -#endif // MASTODONSHAREPLUGIN_H diff --git a/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.pro b/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.pro deleted file mode 100644 index 59fb7e1..0000000 --- a/transferengine-plugins/mastodonshareplugin/mastodonshareplugin.pro +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. -# -# SPDX-License-Identifier: BSD-3-Clause - -TEMPLATE = lib -TARGET = $$qtLibraryTarget(mastodonshareplugin) -CONFIG += plugin -DEPENDPATH += . -INCLUDEPATH += .. -INCLUDEPATH += ../../common - -CONFIG += link_pkgconfig -PKGCONFIG += nemotransferengine-qt5 accounts-qt5 sailfishaccounts libsignon-qt5 - -HEADERS += mastodonshareplugin.h \ - mastodonplugininfo.h \ - ../mastodonshareservicestatus.h - -SOURCES += mastodonshareplugin.cpp \ - mastodonplugininfo.cpp \ - ../mastodonshareservicestatus.cpp - -target.path = $$[QT_INSTALL_LIBS]/nemo-transferengine/plugins/sharing - -OTHER_FILES += *.qml - -shareui.files = MastodonSharePost.qml -shareui.path = /usr/share/nemo-transferengine/plugins/sharing - -INSTALLS += target shareui |
