File 0001-Warning-for-FlatHub.patch of Package discover

From 74a4eff529e6b71f6a822841d9112d9b71b44d24 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

---
 .../backends/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 e96dd5bc..77646179 100644
--- a/libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp
+++ b/libdiscover/backends/FlatpakBackend/FlatpakSourcesBackend.cpp
@@ -24,6 +24,8 @@
 #include "FlatpakBackend.h"
 #include <KLocalizedString>
 #include <QDebug>
+#include <QAbstractButton>
+#include <QMessageBox>
 #include <QNetworkAccessManager>
 #include <QNetworkReply>
 #include <QAction>
@@ -57,7 +59,17 @@ FlatpakSourcesBackend::FlatpakSourcesBackend(const QVector<FlatpakInstallation *
 
     m_flathubAction->setToolTip(QStringLiteral("flathub"));
     connect(m_flathubAction, &QAction::triggered, this, [this](){
-        addSource(QStringLiteral("https://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. Prefer to install software from the official openSUSE repository."),
+                            QMessageBox::Ok | QMessageBox::Abort);
+        connect(warnBox, &QMessageBox::buttonClicked, this, [this, warnBox](QAbstractButton *button) {
+            if (warnBox->standardButton(button) == QMessageBox::Ok)
+                addSource(QStringLiteral("https://flathub.org/repo/flathub.flatpakrepo"));
+        });
+        warnBox->setAttribute(Qt::WA_DeleteOnClose);
+        warnBox->show();
     });
     for (auto installation : installations) {
         if (!listRepositories(installation)) {
-- 
2.16.2

openSUSE Build Service is sponsored by