Commit e1383ed7 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

flatpak, pk: Support contributor URLs

BUG: 452054
parent cb08c3df
Pipeline #209436 passed with stage
in 2 minutes and 26 seconds
......@@ -30,7 +30,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED CoreAddons Config Crash DBusAddons
find_package(KF5Kirigami2 2.7.0)
find_package(packagekitqt5 1.0.1 CONFIG)
find_package(AppStreamQt 0.14.4 CONFIG)
find_package(AppStreamQt 0.15.3 CONFIG)
find_package(KF5Attica 5.23 CONFIG)
find_package(KF5NewStuff 5.53 CONFIG)
......
......@@ -622,9 +622,11 @@ DiscoverPage {
readonly property int visibleButtons: (donateButton.visible ? 1 : 0)
+ (bugButton.visible ? 1: 0)
+ (contributeButton.visible ? 1: 0)
readonly property int buttonWidth: Math.round(textualContentLayout.width / visibleButtons)
readonly property int tallestButtonHeight: Math.max(donateButton.implicitHeight,
bugButton.implicitHeight)
bugButton.implicitHeight,
contributeButton.implicitHeight)
Layout.fillWidth: true
Layout.bottomMargin: appInfo.internalSpacings * 2
......@@ -665,6 +667,21 @@ DiscoverPage {
onClicked: Qt.openUrlExternally(application.bugURL);
}
ApplicationResourceButton {
id: contributeButton
Layout.fillWidth: true
Layout.maximumWidth: getInvolvedLayout.buttonWidth
Layout.minimumHeight: getInvolvedLayout.tallestButtonHeight
visible: application.contributeURL != ""
title: i18n("Contribute")
subtitle: i18n("Help the developers by coding, designing, testing, or translating")
tooltipText: application.contributeURL
buttonIcon: "project-development"
onClicked: Qt.openUrlExternally(application.contributeURL);
}
}
Repeater {
......
......@@ -90,6 +90,11 @@ QUrl DummyResource::donationURL()
return QUrl(QStringLiteral("https://youtu.be/0o8XMlL8rqY"));
}
QUrl DummyResource::contributeURL()
{
return QUrl(QStringLiteral("https://techbase.kde.org/Contribute"));
}
QVariant DummyResource::icon() const
{
static const QVector<QVariant> icons = {QStringLiteral("device-notifier"), QStringLiteral("media-floppy"), QStringLiteral("drink-beer")};
......
......@@ -28,6 +28,7 @@ public:
QUrl helpURL() override;
QUrl bugURL() override;
QUrl donationURL() override;
QUrl contributeURL() override;
QStringList categories() override;
AbstractResource::State state() override;
QVariant icon() const override;
......
......@@ -284,6 +284,11 @@ QUrl FlatpakResource::donationURL()
return m_appdata.url(AppStream::Component::UrlKindDonation);
}
QUrl FlatpakResource::contributeURL()
{
return m_appdata.url(AppStream::Component::UrlKindContribute);
}
FlatpakResource::FlatpakFileType FlatpakResource::flatpakFileType() const
{
return m_flatpakFileType;
......
......@@ -111,6 +111,7 @@ public:
QUrl helpURL() override;
QUrl bugURL() override;
QUrl donationURL() override;
QUrl contributeURL() override;
FlatpakFileType flatpakFileType() const;
QString flatpakName() const;
QJsonArray licenses() override;
......
......@@ -148,6 +148,11 @@ QUrl AppPackageKitResource::donationURL()
return m_appdata.url(AppStream::Component::UrlKindDonation);
}
QUrl AppPackageKitResource::contributeURL()
{
return m_appdata.url(AppStream::Component::UrlKindContribute);
}
AbstractResource::Type AppPackageKitResource::type() const
{
static QString desktop = QString::fromUtf8(qgetenv("XDG_CURRENT_DESKTOP"));
......
......@@ -28,6 +28,7 @@ public:
QUrl helpURL() override;
QUrl bugURL() override;
QUrl donationURL() override;
QUrl contributeURL() override;
QString comment() override;
QJsonArray licenses() override;
QStringList allPackageNames() const override;
......
......@@ -46,6 +46,11 @@ QUrl AbstractResource::donationURL()
return QUrl();
}
QUrl AbstractResource::contributeURL()
{
return {};
}
void AbstractResource::addMetadata(const QString &key, const QJsonValue &value)
{
m_metadata.insert(key, value);
......
......@@ -47,6 +47,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY(QUrl helpURL READ helpURL CONSTANT)
Q_PROPERTY(QUrl bugURL READ bugURL CONSTANT)
Q_PROPERTY(QUrl donationURL READ donationURL CONSTANT)
Q_PROPERTY(QUrl contributeURL READ contributeURL CONSTANT)
Q_PROPERTY(bool canUpgrade READ canUpgrade NOTIFY stateChanged)
Q_PROPERTY(bool isInstalled READ isInstalled NOTIFY stateChanged)
Q_PROPERTY(QJsonArray licenses READ licenses NOTIFY licensesChanged)
......@@ -131,6 +132,8 @@ public:
virtual QUrl bugURL();
///@returns a URL that points to the place where you can donate money to the app developer
virtual QUrl donationURL();
///@returns a URL that points to the place where you can contribute to develop the app
virtual QUrl contributeURL();
enum Type {
Application,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment