File 0003-fix-distrolst.cpp.patch of Package unetbootin

From 879f90846abf164f1521c23e494bda986653a1e4 Mon Sep 17 00:00:00 2001
From: Valeriy Malov <jazzvoid@gmail.com>
Date: Fri, 28 Jul 2017 21:33:28 +0300
Subject: [PATCH 3/4] fix distrolst.cpp fix listdistros/listversions output
 findbrokendownloads.rb doesn't need root, use default ruby use default CONFIG
 to allow debug builds

---
 distrolst.cpp          |  6 +++---
 findbrokendownloads.rb | 13 ++++---------
 unetbootin.cpp         | 25 +++++++++++++++++--------
 unetbootin.pro         |  3 +--
 4 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/distrolst.cpp b/distrolst.cpp
index b4829f4..3b45583 100644
--- a/distrolst.cpp
+++ b/distrolst.cpp
@@ -474,7 +474,7 @@ if (nameDistro == "Frugalware")
 //	"ftp://ftp12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
 	"http://www12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
 //	"ftp://ftp4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
-	"http://www4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
+	"http://www4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/"; //<<
 //	"ftp://ftp2.frugalware.org/frugalware/pub/frugalware/frugalware-"+relname+"/boot/" <<
 //	"ftp://ftp3.frugalware.org/mirrors/frugalware/pub/frugalware/frugalware-"+relname+"/boot/";
 	downloadfile(fileFilterNetDir(frugalwaremirrorsL
@@ -550,7 +550,7 @@ if (nameDistro == "Kaspersky Rescue Disk")
 	{
 		downloadfile(fileFilterNetDir(QStringList() <<
 		"http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk/" <<
-		"http://ftp.kaspersky.com/devbuilds/RescueDisk/" <<
+		"http://ftp.kaspersky.com/devbuilds/RescueDisk/" //<<
 //		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk/"
 		, 9288000, 1048576000, QList<QRegExp>() <<
 		QRegExp(".iso$", Qt::CaseInsensitive) <<
@@ -561,7 +561,7 @@ if (nameDistro == "Kaspersky Rescue Disk")
 	{
 		downloadfile(fileFilterNetDir(QStringList() <<
 		"http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk10/" <<
-		"http://ftp.kaspersky.com/devbuilds/RescueDisk10/" <<
+		"http://ftp.kaspersky.com/devbuilds/RescueDisk10/" //<<
 //		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk10/"
 		, 9288000, 1048576000, QList<QRegExp>() <<
 		QRegExp(".iso$", Qt::CaseInsensitive) <<
diff --git a/unetbootin.cpp b/unetbootin.cpp
index 0767fc8..6ffd6fc 100644
--- a/unetbootin.cpp
+++ b/unetbootin.cpp
@@ -12,6 +12,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
 #include <QMessageBox>
 #include <QFileDialog>
 #include <QProgressDialog>
+#include <QDebug>
 
 static const QList<QRegExp> ignoredtypesbothRL = QList<QRegExp>()
 << QRegExp("isolinux.bin$", Qt::CaseInsensitive)
@@ -468,8 +469,9 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
 				QTextStream out(stdout);
 				for (int i = 1; i < this->distroselect->count(); ++i)
 				{
-					out << this->distroselect->itemText(i);
+					out << this->distroselect->itemText(i) << endl;
 				}
+				out.flush();
 				QApplication::exit();
 				exit(0);
 			}
@@ -478,8 +480,9 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
 				QTextStream out(stdout);
 				for (int i = 0; i < this->dverselect->count(); ++i)
 				{
-					out << this->dverselect->itemText(i);
+					out << this->dverselect->itemText(i) << endl;
 				}
+				out.flush();
 				QApplication::exit();
 				exit(0);
 			}
@@ -2629,12 +2632,13 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
 
 	QUrl redirectUrl;
 	bool downloadFailed = false;
+	QNetworkReply::NetworkError errorCode;
 
 	connect(networkReply, &QNetworkReply::finished, &dlewait, &QEventLoop::quit);
 	connect(networkReply, &QNetworkReply::downloadProgress, this, &unetbootin::dlprogressupdate64);
-	connect(networkReply, &QNetworkReply::redirected, [&redirectUrl](const QUrl &url){ redirectUrl = url; });
+	connect(networkReply, &QNetworkReply::redirected, [&](const QUrl &url){ redirectUrl = url; });
 	connect(networkReply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
-			[&downloadFailed](QNetworkReply::NetworkError){ downloadFailed = true; });
+			[&](QNetworkReply::NetworkError code){ downloadFailed = true; errorCode = code; });
 
 	dlewait.exec();
 
@@ -2646,7 +2650,8 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
 
 	if (downloadFailed)
 	{
-		QString errorStr = networkReply->errorString();
+		qDebug() << networkReply->errorString();
+		qDebug() << "Error code: " << errorCode;
 		showDownloadFailedScreen(fileurl);
 		return;
 	}
@@ -2685,7 +2690,8 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
 	if (testingDownload)
 	{
 		// Note that this only tests that the first download succeeds
-		printf("exitstatus:downloadcomplete\n");
+		QTextStream out(stdout);
+		out << "exitstatus:downloadcomplete" << endl << flush;
 		QApplication::exit();
 		exit(0);
 	}
@@ -2701,7 +2707,8 @@ void unetbootin::showDownloadFailedScreen(const QString &fileurl)
 	this->downloadFailed = true;
 	if (exitOnCompletion)
 	{
-		printf("exitstatus:downloadfailed\n");
+		QTextStream out(stdout);
+		out << "exitstatus:downloadfailed" << endl << flush;
 		QApplication::exit();
 		exit(0);
 	}
@@ -2777,6 +2784,7 @@ QString unetbootin::downloadpagecontents(QUrl pageurl)
 
 QStringList unetbootin::lstFtpDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize)
 {
+	qDebug() << "lstFtpDirFiles called for " << ldfDirStringUrl;
 	return {};
 /*
 	QUrl ldfDirUrl(ldfDirStringUrl);
@@ -4299,7 +4307,8 @@ void unetbootin::fininstall()
     finishLogging();
 	if (exitOnCompletion)
 	{
-		printf("exitstatus:success\n");
+		QTextStream out(stdout);
+		out << "exitstatus:success" << endl << flush;
 		QApplication::exit();
 		exit(0);
 	}
diff --git a/unetbootin.pro b/unetbootin.pro
index f3af65f..6405ba2 100644
--- a/unetbootin.pro
+++ b/unetbootin.pro
@@ -2,13 +2,12 @@ TEMPLATE = app
 TARGET = unetbootin
 DEPENDPATH += .
 INCLUDEPATH += .
-CONFIG += release \
-    static
 
 HEADERS += unetbootin.h
 FORMS += unetbootin.ui
 SOURCES += main.cpp \
     unetbootin.cpp \
+    customdistrolst.cpp \
     distrolst.cpp \
     distrover.cpp \
     distrovercust.cpp
-- 
2.21.0