File 0001-Warning-for-FlatHub.patch of Package discover6
From 89a0cb7cad9848316987d53f10eb9ad65f70e2c4 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 13 Jan 2018 15:16:39 +0100
Subject: [PATCH] Warning for FlatHub
---
.../FlatpakBackend/FlatpakSourcesBackend.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp b/libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp
index cee00f2ec..9b44c5089 100644
--- a/libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp
+++ b/libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp
@@ -18,6 +18,8 @@
#include <QStandardPaths>
#include <QTemporaryFile>
+#include <QAbstractButton>
+#include <QMessageBox>
#include <glib.h>
#include <resources/DiscoverAction.h>
#include <resources/StoredResultsStream.h>
@@ -105,7 +107,17 @@ FlatpakSourcesBackend::FlatpakSourcesBackend(const QVector<FlatpakInstallation *
m_flathubAction->setObjectName(QStringLiteral("flathub"));
m_flathubAction->setToolTip(i18n("Makes it possible to easily install the applications listed in https://flathub.org"));
connect(m_flathubAction, &DiscoverAction::triggered, this, [this]() {
- addSource(QStringLiteral("https://dl.flathub.org/repo/flathub.flatpakrepo"));
+ auto *warnBox = new QMessageBox(QMessageBox::Information, i18n("Adding a third-party source"),
+ i18n("FlatHub is not part of the openSUSE distribution.\n"
+ "It contains packages of unknown quality which might not be tested to work correctly "
+ "on openSUSE."),
+ QMessageBox::Ok | QMessageBox::Abort);
+ connect(warnBox, &QMessageBox::buttonClicked, this, [this, warnBox](QAbstractButton *button) {
+ if (warnBox->standardButton(button) == QMessageBox::Ok)
+ addSource(QStringLiteral("https://dl.flathub.org/repo/flathub.flatpakrepo"));
+ });
+ warnBox->setAttribute(Qt::WA_DeleteOnClose);
+ warnBox->show();
});
m_noSourcesItem->setEnabled(false);
--
2.51.0