Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 644360
Collapse All | Expand All

(-)a/sys-boot/unetbootin/Manifest (+1 lines)
Line 1 Link Here
1
DIST unetbootin-657.tar.gz 16258176 BLAKE2B 7124e3a4cace41b1ca61ca468e37adc90ae7d3099f54dc5da200cc7b7d94567afa5b4a597ba7d7e3a1327951fd7e61f320bc676b72ba68c7255e9145e5791adc SHA512 69ffdbc23f372c795e84267dfbed2221783a7efc9b1d5f589e7c308384cdfd0d9cf0950058f665e2c10bf6f17e0efd3eff81a1bedb98da316583f2462dfed2d9
1
DIST unetbootin-657.tar.gz 16258176 BLAKE2B 7124e3a4cace41b1ca61ca468e37adc90ae7d3099f54dc5da200cc7b7d94567afa5b4a597ba7d7e3a1327951fd7e61f320bc676b72ba68c7255e9145e5791adc SHA512 69ffdbc23f372c795e84267dfbed2221783a7efc9b1d5f589e7c308384cdfd0d9cf0950058f665e2c10bf6f17e0efd3eff81a1bedb98da316583f2462dfed2d9
2
DIST unetbootin-661.tar.gz 16257579 BLAKE2B 2f92cf286c8010a80d4d4cc48a7ece55e159af9f3729277d97eb99ef2ebe8945023d03c51d6e97d7101d8547240e3c2152004222ec4c825ef4ab954c4018e7b0 SHA512 bbf74a4c4ca9b52f4da672eb54524b7fcb796c65ba80700dc3c6f2677bde37574f42a11c213cc4d4eee38783aed650beee1e2894f60185745e509a2e9571f70a
(-)a/sys-boot/unetbootin/files/unetbootin-661-qt5.patch (+988 lines)
Line 0 Link Here
1
From d8266c51317d279caf8f6a0f595dc2642014b12b Mon Sep 17 00:00:00 2001
2
From: Valeriy Malov <jazzvoid@gmail.com>
3
Date: Fri, 28 Jul 2017 19:45:04 +0300
4
Subject: [PATCH 1/4] rought Qt5 port this breaks unetbootin::lstFtpDirFiles
5
 due to https://bugreports.qt.io/ browse/QTBUG-26294
6
7
---
8
 main.cpp       |  24 +++---
9
 unetbootin.cpp | 194 +++++++++++++++---------------------------
10
 unetbootin.h   |  12 +--
11
 unetbootin.pro |   1 +
12
 4 files changed, 84 insertions(+), 147 deletions(-)
13
14
diff --git a/main.cpp b/main.cpp
15
index 486b75b2..1ef73048 100644
16
--- a/main.cpp
17
+++ b/main.cpp
18
@@ -9,6 +9,8 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
19
 
20
 #include "unetbootin.h"
21
 
22
+#include <QMessageBox>
23
+
24
 #ifdef Q_OS_WIN32
25
 
26
 void configsysUndo(QString uninstPathL)
27
@@ -380,18 +382,16 @@ int main(int argc, char **argv)
28
 		uninstmsgb.setIcon(QMessageBox::Information);
29
 		uninstmsgb.setWindowTitle(uninstaller::tr("%1 Uninstaller").arg(UNETBOOTINB));
30
 		uninstmsgb.setText(uninstaller::tr("%1 is currently installed. Remove the existing version?").arg(UNETBOOTINB));
31
- 		uninstmsgb.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
32
- 		switch (uninstmsgb.exec())
33
- 		{
34
- 			case QMessageBox::Ok:
35
- 			{
36
- 				ubnUninst();
37
-			}
38
-			case QMessageBox::Cancel:
39
-				break;
40
-	 		default:
41
-				break;
42
- 		}
43
+		uninstmsgb.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
44
+		switch (uninstmsgb.exec())
45
+		{
46
+		case QMessageBox::Ok:
47
+			ubnUninst();
48
+			break;
49
+		case QMessageBox::Cancel:
50
+		default:
51
+			break;
52
+		}
53
 		return 0;
54
 	}
55
 #endif
56
diff --git a/unetbootin.cpp b/unetbootin.cpp
57
index 3982f617..0767fc87 100644
58
--- a/unetbootin.cpp
59
+++ b/unetbootin.cpp
60
@@ -9,6 +9,10 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
61
 
62
 #include "unetbootin.h"
63
 
64
+#include <QMessageBox>
65
+#include <QFileDialog>
66
+#include <QProgressDialog>
67
+
68
 static const QList<QRegExp> ignoredtypesbothRL = QList<QRegExp>()
69
 << QRegExp("isolinux.bin$", Qt::CaseInsensitive)
70
 << QRegExp("isolinux.cfg$", Qt::CaseInsensitive)
71
@@ -101,8 +105,8 @@ void callexternappT::run()
72
 void callexternappWriteToStdinT::run()
73
 {
74
 	QProcess lnexternapp;
75
-    lnexternapp.start("\"" + execFile + "\" " + execParm);
76
-	lnexternapp.write(writeToStdin.toAscii().data());
77
+	lnexternapp.start("\"" + execFile + "\" " + execParm);
78
+	lnexternapp.write(writeToStdin.toLatin1().data());
79
 	lnexternapp.closeWriteChannel();
80
 	lnexternapp.waitForFinished(-1);
81
 	retnValu = QString(lnexternapp.readAll());
82
@@ -133,16 +137,6 @@ void copyfileT::run()
83
 	emit finished();
84
 }
85
 
86
-ubngetrequestheader::ubngetrequestheader(QString urhost, QString urpath)
87
-{
88
-	this->setRequest("GET", urpath);
89
-	this->setValue("HOST", urhost);
90
-	this->setValue("User-Agent", "UNetbootin/1.1.1");
91
-//	this->setValue("User-Agent", "Wget/1.10.2");
92
-	this->setValue("Accept", "*/*");
93
-	this->setValue("Connection", "Keep-Alive");
94
-}
95
-
96
 randtmpfile::randtmpfile(QString rfpath, QString rfextn)
97
 {
98
 	QString basefn = getrandfilename(rfpath, rfextn);
99
@@ -159,7 +153,7 @@ QString randtmpfile::getrandfilename(QString rfpath, QString rfextn)
100
 	}
101
 	return basefn;
102
 }
103
-
104
+/*
105
 void nDirListStor::sAppendSelfUrlInfoList(QUrlInfo curDirUrl)
106
 {
107
 	if (curDirUrl.isValid() && curDirUrl.isReadable() && curDirUrl.isFile() && curDirUrl.size() > nMinFileSizeBytes && curDirUrl.size() < nMaxFileSizeBytes)
108
@@ -171,7 +165,7 @@ void nDirListStor::sAppendSelfUrlInfoList(QUrlInfo curDirUrl)
109
 		nDirFileListSL.append(curDirUrl.name());
110
 	}
111
 }
112
-
113
+*/
114
 unetbootin::unetbootin(QWidget *parent)
115
 	: QWidget(parent)
116
 {
117
@@ -471,18 +465,20 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
118
 		{
119
 			if (psecond.contains("listdistros", Qt::CaseInsensitive))
120
 			{
121
+				QTextStream out(stdout);
122
 				for (int i = 1; i < this->distroselect->count(); ++i)
123
 				{
124
-					printf("%s\n", this->distroselect->itemText(i).toAscii().constData());
125
+					out << this->distroselect->itemText(i);
126
 				}
127
 				QApplication::exit();
128
 				exit(0);
129
 			}
130
 			else if (psecond.contains("listversions", Qt::CaseInsensitive))
131
 			{
132
+				QTextStream out(stdout);
133
 				for (int i = 0; i < this->dverselect->count(); ++i)
134
 				{
135
-					printf("%s\n", this->dverselect->itemText(i).toAscii().constData());
136
+					out << this->dverselect->itemText(i);
137
 				}
138
 				QApplication::exit();
139
 				exit(0);
140
@@ -1098,7 +1094,7 @@ bool unetbootin::checkifoutofspace(QString destindir)
141
 	bool outofspace = false;
142
 	#ifdef Q_OS_UNIX
143
 	struct statfs diskstatS;
144
-	if (!statfs(QString(destindir+"/.").toAscii(), &diskstatS))
145
+	if (!statfs(QString(destindir+"/.").toLatin1(), &diskstatS))
146
 	{
147
 		if (diskstatS.f_bavail * diskstatS.f_bfree < 1024)
148
 			outofspace = true;
149
@@ -2620,31 +2616,41 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
150
 	{
151
 		rmFile(targetfile);
152
 	}
153
-	QUrl dlurl(fileurl);
154
-	bool isftp = false;
155
-	if (dlurl.scheme() == "ftp")
156
-	{
157
-		isftp = true;
158
-	}
159
-	QHttp dlhttp;
160
-	QFtp dlftp;
161
+	QNetworkAccessManager manager;
162
+	QNetworkRequest dlurl(fileurl);
163
+	QNetworkReply * networkReply = manager.get(dlurl);
164
+
165
 	QEventLoop dlewait;
166
 	pdesc5->setText("");
167
 	pdesc4->setText(tr("Downloading files, please wait..."));
168
 	pdesc3->setText(tr("<b>Source:</b> <a href=\"%1\">%1</a>").arg(fileurl));
169
 	pdesc2->setText(tr("<b>Destination:</b> %1").arg(targetfile));
170
 	pdesc1->setText(tr("<b>Downloaded:</b> 0 bytes"));
171
-	QString realupath = QString(fileurl).remove(0, fileurl.indexOf(QString("://%1").arg(dlurl.host())) + QString("://%1").arg(dlurl.host()).length());
172
-	if (isftp)
173
+
174
+	QUrl redirectUrl;
175
+	bool downloadFailed = false;
176
+
177
+	connect(networkReply, &QNetworkReply::finished, &dlewait, &QEventLoop::quit);
178
+	connect(networkReply, &QNetworkReply::downloadProgress, this, &unetbootin::dlprogressupdate64);
179
+	connect(networkReply, &QNetworkReply::redirected, [&redirectUrl](const QUrl &url){ redirectUrl = url; });
180
+	connect(networkReply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
181
+			[&downloadFailed](QNetworkReply::NetworkError){ downloadFailed = true; });
182
+
183
+	dlewait.exec();
184
+
185
+	if (!redirectUrl.isEmpty())
186
 	{
187
-		connect(&dlftp, SIGNAL(done(bool)), &dlewait, SLOT(quit()));
188
-		connect(&dlftp, SIGNAL(dataTransferProgress(qint64, qint64)), this, SLOT(dlprogressupdate64(qint64, qint64)));
189
+		downloadfile(redirectUrl.toString(), targetfile, minsize);
190
+		return;
191
 	}
192
-	else
193
+
194
+	if (downloadFailed)
195
 	{
196
-		connect(&dlhttp, SIGNAL(done(bool)), &dlewait, SLOT(quit()));
197
-		connect(&dlhttp, SIGNAL(dataReadProgress(int, int)), this, SLOT(dlprogressupdate(int, int)));
198
+		QString errorStr = networkReply->errorString();
199
+		showDownloadFailedScreen(fileurl);
200
+		return;
201
 	}
202
+
203
 	QFile dloutfile;
204
 	if (installType == tr("USB Drive"))
205
 	{
206
@@ -2654,83 +2660,17 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
207
 	{
208
 		dloutfile.setFileName(targetfile);
209
 	}
210
+
211
 	dloutfile.open(QIODevice::WriteOnly);
212
-	if (isftp)
213
-	{
214
-		dlftp.connectToHost(dlurl.host());
215
-		dlftp.login();
216
-		dlftp.get(realupath, &dloutfile);
217
-	}
218
-	else
219
-	{
220
-		dlhttp.setHost(dlurl.host());
221
-		ubngetrequestheader dlrequest(dlurl.host(), realupath);
222
-		dlhttp.request(dlrequest, 0, &dloutfile);
223
-	}
224
-	dlewait.exec();
225
-	if (!isftp)
226
-	{
227
-		QHttpResponseHeader dlresponse(dlhttp.lastResponse());
228
-		int dlrstatus = dlresponse.statusCode();
229
-		if (dlrstatus >= 300 && dlrstatus < 400 && dlresponse.hasKey("Location"))
230
-		{
231
-			dloutfile.close();
232
-			rmFile(dloutfile);
233
-			downloadfile(dlresponse.value("Location"), targetfile, minsize);
234
-			return;
235
-		}
236
-	}
237
-	if (isftp)
238
-	{
239
-		dlftp.close();
240
-	}
241
-	else
242
-	{
243
-		dlhttp.close();
244
-	}
245
+	dloutfile.write(networkReply->readAll());
246
+	networkReply->close();
247
+	networkReply->deleteLater();
248
 	dloutfile.close();
249
 	if (installType == tr("USB Drive"))
250
 	{
251
 		dloutfile.rename(targetfile);
252
 	}
253
-    if (QFile(targetfile).size() <= 4096)
254
-    {
255
-        QString redirectTargetURL;
256
-        QFile seeRedirect(targetfile);
257
-        seeRedirect.open(QIODevice::ReadOnly | QIODevice::Text);
258
-        QTextStream seeRedirectTextStream(&seeRedirect);
259
-        while (!seeRedirectTextStream.atEnd())
260
-        {
261
-            QString curline = seeRedirectTextStream.readLine();
262
-            if (curline.contains("content=\"0;url="))
263
-            {
264
-                int urlstartidx = curline.indexOf("content=\"0;url=") + QString("content=\"0;url=").size();
265
-                redirectTargetURL = curline.mid(urlstartidx);
266
-                if (redirectTargetURL.contains("\""))
267
-                {
268
-                    redirectTargetURL = redirectTargetURL.left(redirectTargetURL.indexOf("\""));
269
-                }
270
-                break;
271
-            }
272
-            if (curline.contains("content='0;url="))
273
-            {
274
-                int urlstartidx = curline.indexOf("content='0;url=") + QString("content='0;url=").size();
275
-                redirectTargetURL = curline.mid(urlstartidx);
276
-                if (redirectTargetURL.contains("'"))
277
-                {
278
-                    redirectTargetURL = redirectTargetURL.left(redirectTargetURL.indexOf("'"));
279
-                }
280
-                break;
281
-            }
282
-        }
283
-        seeRedirect.close();
284
-        if (!redirectTargetURL.isEmpty())
285
-        {
286
-            rmFile(targetfile);
287
-            downloadfile(redirectTargetURL, targetfile, minsize);
288
-            return;
289
-        }
290
-    }
291
+
292
 	if (QFile(targetfile).size() < minsize)
293
 	{
294
 		// download failed
295
@@ -2812,31 +2752,33 @@ void unetbootin::cpprogressupdate64(qint64 dlbytes, qint64 maxbytes)
296
  }
297
 }
298
 
299
-QString unetbootin::downloadpagecontents(QString pageurl)
300
+QString unetbootin::downloadpagecontents(QUrl pageurl)
301
 {
302
-	QUrl pgurl(pageurl);
303
-	QHttp pghttp;
304
+	QNetworkAccessManager _manager;
305
+	QNetworkRequest dlurl(pageurl);
306
+	QNetworkReply * networkReply = _manager.get(dlurl);
307
 	QEventLoop pgwait;
308
-	connect(&pghttp, SIGNAL(done(bool)), &pgwait, SLOT(quit()));
309
-	pghttp.setHost(pgurl.host());
310
-	QString realpgupath = QString(pageurl).remove(0, pageurl.indexOf(QString("://%1").arg(pgurl.host())) + QString("://%1").arg(pgurl.host()).length());
311
-	ubngetrequestheader pgrequest(pgurl.host(), realpgupath);
312
-	pghttp.request(pgrequest);
313
+	QUrl redirectUrl;
314
+	connect(networkReply, &QNetworkReply::finished, &pgwait, &QEventLoop::quit);
315
+	connect(networkReply, &QNetworkReply::redirected, [&redirectUrl](const QUrl &url){ redirectUrl = url; });
316
+
317
 	pgwait.exec();
318
-	QHttpResponseHeader pgresponse(pghttp.lastResponse());
319
-	int pgrstatus = pgresponse.statusCode();
320
-	if (pgrstatus >= 300 && pgrstatus < 400 && pgresponse.hasKey("Location"))
321
-	{
322
-		return downloadpagecontents(pgresponse.value("Location"));
323
-	}
324
-	else
325
+
326
+	if (!redirectUrl.isEmpty())
327
 	{
328
-		return QString(pghttp.readAll());
329
+		return downloadpagecontents(redirectUrl);
330
 	}
331
+
332
+	QString result = networkReply->readAll();
333
+	networkReply->close();
334
+	networkReply->deleteLater();
335
+	return result;
336
 }
337
 
338
 QStringList unetbootin::lstFtpDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize)
339
 {
340
+	return {};
341
+/*
342
 	QUrl ldfDirUrl(ldfDirStringUrl);
343
 	QFtp ldfFtp;
344
 	QEventLoop ldfWait;
345
@@ -2851,14 +2793,14 @@ QStringList unetbootin::lstFtpDirFiles(QString ldfDirStringUrl, int ldfMinSize,
346
 	ldfFtp.list(ldfDirUrl.path());
347
 	ldfWait.exec();
348
 	ldfFtp.close();
349
-	return nDirListStorL.nDirFileListSL;
350
+	return nDirListStorL.nDirFileListSL;*/
351
 }
352
 
353
 QStringList unetbootin::lstHttpDirFiles(QString ldfDirStringUrl)
354
 {
355
 	QStringList relativefilelinksL;
356
 	QStringList relativelinksLPreFilter =
357
-		downloadpagecontents(ldfDirStringUrl)
358
+		downloadpagecontents(QUrl(ldfDirStringUrl))
359
 		.replace(">", ">\n")
360
 		.replace("<", "\n<")
361
 		.split("\n");
362
@@ -3218,11 +3160,11 @@ int unetbootin::letterToNumber(QChar lettertoconvert)
363
 {
364
 	if (lettertoconvert.isLower())
365
 	{
366
-		return static_cast<int>(lettertoconvert.toAscii() - 'a');
367
+		return static_cast<int>(lettertoconvert.toLatin1() - 'a');
368
 	}
369
 	if (lettertoconvert.isUpper())
370
 	{
371
-		return static_cast<int>(lettertoconvert.toAscii() - 'A');
372
+		return static_cast<int>(lettertoconvert.toLatin1() - 'A');
373
 	}
374
 	else
375
 	{
376
@@ -3724,7 +3666,7 @@ void unetbootin::writegrub2cfg()
377
 	QString menulstxt = QString(
378
 	"%9\n\n"
379
 #ifndef NODEFAULTBOOT
380
-	"\nmenuentry \""UNETBOOTINB"\" {\n"
381
+	"\nmenuentry \"" UNETBOOTINB"\" {\n"
382
 	"\tset root=%8\n"
383
 	"\t%1 %2 %3 %4\n"
384
 	"\t%5 %6 %7\n"
385
@@ -3845,7 +3787,7 @@ void unetbootin::runinsthdd()
386
 	"timeout 10\n"
387
 	#endif
388
 #ifndef NODEFAULTBOOT
389
-	"\ntitle "UNETBOOTINB"\n"
390
+	"\ntitle " UNETBOOTINB"\n"
391
 	#ifdef Q_OS_WIN32
392
 	"find --set-root %3\n"
393
 	#endif
394
@@ -4343,7 +4285,7 @@ void unetbootin::fininstall()
395
 	sdesc4->setText(QString("<b>%1 %2</b>").arg(sdesc4->text()).arg(trcurrent));
396
 	if (installType == tr("Hard Disk"))
397
 	{
398
-		rebootmsgtext->setText(tr("After rebooting, select the "UNETBOOTINB" menu entry to boot.%1").arg(postinstmsg));
399
+		rebootmsgtext->setText(tr("After rebooting, select the " UNETBOOTINB" menu entry to boot.%1").arg(postinstmsg));
400
 	}
401
 	if (installType == tr("USB Drive"))
402
 	{
403
diff --git a/unetbootin.h b/unetbootin.h
404
index ea607c88..8cb45d81 100644
405
--- a/unetbootin.h
406
+++ b/unetbootin.h
407
@@ -152,19 +152,13 @@ class copyfileT : public QThread
408
 	void finished();
409
 };
410
 
411
-class ubngetrequestheader : public QHttpRequestHeader
412
-{
413
-public:
414
-	ubngetrequestheader(QString urhost, QString urpath);
415
-};
416
-
417
 class randtmpfile : public QFile
418
 {
419
 public:
420
 	randtmpfile(QString rfpath, QString rfextn);
421
 	static QString getrandfilename(QString rfpath, QString rfextn);
422
 };
423
-
424
+/*
425
 class nDirListStor : public QObject
426
 {
427
 	Q_OBJECT
428
@@ -178,7 +172,7 @@ class nDirListStor : public QObject
429
 public slots:
430
 	void sAppendSelfUrlInfoList(QUrlInfo curDirUrl);
431
 };
432
-
433
+*/
434
 class unetbootin : public QWidget, private Ui::unetbootinui
435
 {
436
 	Q_OBJECT
437
@@ -280,7 +274,7 @@ class unetbootin : public QWidget, private Ui::unetbootinui
438
 	QString searchforgrub2includesfile(QString includesfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes);
439
 	QPair<QPair<QStringList, QStringList>, QPair<QStringList, QStringList> > searchforgrub2includesfileL(QString includesfile, QString archivefile, QStringList archivefileconts, QStringList visitedincludes);
440
 	void downloadfile(QString fileurl, QString targetfile, int minsize);
441
-	QString downloadpagecontents(QString pageurl);
442
+	QString downloadpagecontents(QUrl pageurl);
443
 	QStringList lstFtpDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize);
444
 	QStringList lstHttpDirFiles(QString ldfDirStringUrl);
445
 	QStringList lstNetDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize);
446
diff --git a/unetbootin.pro b/unetbootin.pro
447
index 3d4cece5..f3af65f8 100644
448
--- a/unetbootin.pro
449
+++ b/unetbootin.pro
450
@@ -14,6 +14,7 @@ SOURCES += main.cpp \
451
     distrovercust.cpp
452
 QT += core \
453
     gui \
454
+    widgets \
455
     network
456
 ICON = unetbootin.icns
457
 TRANSLATIONS += unetbootin.ts \
458
459
From e5ae50b8336b115611478af0bf036c3c7b76274d Mon Sep 17 00:00:00 2001
460
From: Valeriy Malov <jazzvoid@gmail.com>
461
Date: Fri, 28 Jul 2017 19:45:57 +0300
462
Subject: [PATCH 2/4] comment out all sources that require FTP LIST except for
463
 DrWeb, which seems to be no longer a public ftp
464
465
---
466
 distrolst.cpp | 56 ++++++++++++++++++++++----------------------
467
 1 file changed, 28 insertions(+), 28 deletions(-)
468
469
diff --git a/distrolst.cpp b/distrolst.cpp
470
index 034f07a0..b4829f4c 100644
471
--- a/distrolst.cpp
472
+++ b/distrolst.cpp
473
@@ -278,14 +278,14 @@ if (nameDistro == "CloneZilla")
474
 if (nameDistro == "Damn Small Linux")
475
 {
476
 	downloadfile(fileFilterNetDir(QStringList() << 
477
-	"ftp://ibiblio.org/pub/Linux/distributions/damnsmall/current/" << 
478
+//	"ftp://ibiblio.org/pub/Linux/distributions/damnsmall/current/" <<
479
 	"http://ibiblio.org/pub/Linux/distributions/damnsmall/current/" << 
480
-	"ftp://gd.tuwien.ac.at/opsys/linux/damnsmall/current/" << 
481
+//	"ftp://gd.tuwien.ac.at/opsys/linux/damnsmall/current/" <<
482
 	"http://gd.tuwien.ac.at/opsys/linux/damnsmall/current/" << 
483
-	"ftp://ftp.is.co.za/linux/distributions/damnsmall/current/" << 
484
+//	"ftp://ftp.is.co.za/linux/distributions/damnsmall/current/" <<
485
 //	"ftp://ftp.belnet.be/packages/damnsmalllinux/current/" << 
486
 	"http://ftp.belnet.be/packages/damnsmalllinux/current/" << 
487
-	"ftp://ftp.heanet.ie/mirrors/damnsmalllinux.org/current/" << 
488
+//	"ftp://ftp.heanet.ie/mirrors/damnsmalllinux.org/current/" <<
489
 	"http://ftp.heanet.ie/mirrors/damnsmalllinux.org/current/"
490
 //	"ftp://ftp.oss.cc.gatech.edu/pub/linux/distributions/damnsmall/current/" << 
491
 //	"http://ftp.oss.cc.gatech.edu/pub/linux/distributions/damnsmall/current/" <<
492
@@ -333,9 +333,9 @@ if (nameDistro == "Debian")
493
 if (nameDistro == "Dreamlinux")
494
 {
495
 	downloadfile(fileFilterNetDir(QStringList() << 
496
-	"ftp://ftp.nluug.nl/pub/os/Linux/distr/dreamlinux/stable/" << 
497
+//	"ftp://ftp.nluug.nl/pub/os/Linux/distr/dreamlinux/stable/" <<
498
 	"http://ftp.nluug.nl/pub/os/Linux/distr/dreamlinux/stable/" << 
499
-	"ftp://ftp.surfnet.nl/pub/os/Linux/distr/dreamlinux/stable/" << 
500
+//	"ftp://ftp.surfnet.nl/pub/os/Linux/distr/dreamlinux/stable/" <<
501
 	"http://ftp.surfnet.nl/pub/os/Linux/distr/dreamlinux/stable/"
502
 	, 524288000, 1048576000, QList<QRegExp>() << 
503
 	QRegExp(".iso$", Qt::CaseInsensitive) << 
504
@@ -467,16 +467,16 @@ if (nameDistro == "Frugalware")
505
 	QStringList frugalwaremirrorsL = QStringList() <<
506
 //	"ftp://ftp5.frugalware.org/packages/frugalware/pub/frugalware-"+relname+"/boot/" <<
507
 //	"http://www5.frugalware.org/packages/frugalware/pub/frugalware-"+relname+"/boot/" <<
508
-	"ftp://ftp8.frugalware.org/distro/frugalware/frugalware-"+relname+"/boot/" <<
509
+//	"ftp://ftp8.frugalware.org/distro/frugalware/frugalware-"+relname+"/boot/" <<
510
 	"http://www8.frugalware.org/distro/frugalware/frugalware-"+relname+"/boot/" <<
511
-	"ftp://ftp10.frugalware.org/pub/linux/frugalware/frugalware-"+relname+"/boot/" <<
512
+//	"ftp://ftp10.frugalware.org/pub/linux/frugalware/frugalware-"+relname+"/boot/" <<
513
 	"http://www10.frugalware.org/pub/linux/frugalware/frugalware-"+relname+"/boot/" <<
514
-	"ftp://ftp12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
515
+//	"ftp://ftp12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
516
 	"http://www12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
517
-	"ftp://ftp4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
518
+//	"ftp://ftp4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
519
 	"http://www4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
520
-	"ftp://ftp2.frugalware.org/frugalware/pub/frugalware/frugalware-"+relname+"/boot/" <<
521
-	"ftp://ftp3.frugalware.org/mirrors/frugalware/pub/frugalware/frugalware-"+relname+"/boot/";
522
+//	"ftp://ftp2.frugalware.org/frugalware/pub/frugalware/frugalware-"+relname+"/boot/" <<
523
+//	"ftp://ftp3.frugalware.org/mirrors/frugalware/pub/frugalware/frugalware-"+relname+"/boot/";
524
 	downloadfile(fileFilterNetDir(frugalwaremirrorsL
525
 	, 307200, 104857600, QList<QRegExp>() << 
526
 	QRegExp("vmlinuz", Qt::CaseInsensitive) <<
527
@@ -551,7 +551,7 @@ if (nameDistro == "Kaspersky Rescue Disk")
528
 		downloadfile(fileFilterNetDir(QStringList() <<
529
 		"http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk/" <<
530
 		"http://ftp.kaspersky.com/devbuilds/RescueDisk/" <<
531
-		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk/"
532
+//		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk/"
533
 		, 9288000, 1048576000, QList<QRegExp>() <<
534
 		QRegExp(".iso$", Qt::CaseInsensitive) <<
535
 		QRegExp("k\\S{0,}.iso$", Qt::CaseInsensitive)
536
@@ -562,7 +562,7 @@ if (nameDistro == "Kaspersky Rescue Disk")
537
 		downloadfile(fileFilterNetDir(QStringList() <<
538
 		"http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk10/" <<
539
 		"http://ftp.kaspersky.com/devbuilds/RescueDisk10/" <<
540
-		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk10/"
541
+//		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk10/"
542
 		, 9288000, 1048576000, QList<QRegExp>() <<
543
 		QRegExp(".iso$", Qt::CaseInsensitive) <<
544
 		QRegExp("k\\S{0,}.iso$", Qt::CaseInsensitive)
545
@@ -624,11 +624,11 @@ if (nameDistro == "Linux Mint")
546
 	QString("http://mirror.sov.uk.goscomb.net/linuxmint.com/stable/%1/").arg(relname) <<
547
 	QString("http://mirror.csclub.uwaterloo.ca/linuxmint/stable/%1/").arg(relname) <<
548
 	QString("http://mirror.aarnet.edu.au/pub/linuxmint/stable/%1/").arg(relname) <<
549
-	QString("http://mirror.waia.asn.au/pub/linux/linuxmint/linuxmint-isos/linuxmint.com/stable/%1/").arg(relname) <<
550
-	QString("ftp://mirrors.secution.com/linuxmint.com/stable/%1/").arg(relname) <<
551
-	QString("ftp://ftp.is.co.za/mirror/linuxmint.com/stable/%1/").arg(relname) <<
552
-	QString("ftp://ftp.tpnet.pl/pub/linux/linuxmint/isos/stable/%1/").arg(relname) <<
553
-	QString("ftp://mirror.unej.ac.id/pub/iso/linux-mint/stable/%1/").arg(relname)
554
+	QString("http://mirror.waia.asn.au/pub/linux/linuxmint/linuxmint-isos/linuxmint.com/stable/%1/").arg(relname) //<<
555
+//	QString("ftp://mirrors.secution.com/linuxmint.com/stable/%1/").arg(relname) <<
556
+//	QString("ftp://ftp.is.co.za/mirror/linuxmint.com/stable/%1/").arg(relname) <<
557
+//	QString("ftp://ftp.tpnet.pl/pub/linux/linuxmint/isos/stable/%1/").arg(relname) <<
558
+//	QString("ftp://mirror.unej.ac.id/pub/iso/linux-mint/stable/%1/").arg(relname)
559
 	, 61440000, 1048576000, mintregex), isotmpf);
560
 	extractiso(isotmpf);
561
 }
562
@@ -675,11 +675,11 @@ if (nameDistro == "MEPIS")
563
 	if (relname == "antix")
564
 	{
565
 		downloadfile(fileFilterNetDir(QStringList() << 
566
-		"ftp://ftp.ibiblio.org/pub/linux/distributions/mepis/released/antix/" << 
567
+//		"ftp://ftp.ibiblio.org/pub/linux/distributions/mepis/released/antix/" <<
568
 		"http://distro.ibiblio.org/pub/linux/distributions/mepis/released/antix/" <<
569
-		"ftp://ftp-linux.cc.gatech.edu/pub/linux/distributions/mepis/released/antix/" << 
570
+//		"ftp://ftp-linux.cc.gatech.edu/pub/linux/distributions/mepis/released/antix/" <<
571
 		"http://ftp.uwsg.indiana.edu/linux/mepis/released/antix/" <<
572
-		"ftp://ftp.ussg.iu.edu/pub/linux/mepis/released/antix/" <<
573
+//		"ftp://ftp.ussg.iu.edu/pub/linux/mepis/released/antix/" <<
574
 		"http://mirror.cs.vt.edu/pub/MEPIS/antix/"
575
 		, 61440000, 1048576000, QList<QRegExp>() << 
576
 		QRegExp("antiX\\S{0,}.iso$", Qt::CaseInsensitive) << 
577
@@ -689,11 +689,11 @@ if (nameDistro == "MEPIS")
578
 	else
579
 	{
580
 		downloadfile(fileFilterNetDir(QStringList() << 
581
-		"ftp://ftp.ibiblio.org/pub/linux/distributions/mepis/released/" << 
582
+//		"ftp://ftp.ibiblio.org/pub/linux/distributions/mepis/released/" <<
583
 		"http://distro.ibiblio.org/pub/linux/distributions/mepis/released/" <<
584
-		"ftp://ftp-linux.cc.gatech.edu/pub/linux/distributions/mepis/released/" << 
585
+//		"ftp://ftp-linux.cc.gatech.edu/pub/linux/distributions/mepis/released/" <<
586
 		"http://ftp.uwsg.indiana.edu/linux/mepis/released/" <<
587
-		"ftp://ftp.ussg.iu.edu/pub/linux/mepis/released/" <<
588
+//		"ftp://ftp.ussg.iu.edu/pub/linux/mepis/released/" <<
589
 		"http://mirror.cs.vt.edu/pub/MEPIS/"
590
 		, 61440000, 1048576000, QList<QRegExp>() << 
591
 		QRegExp("MEPIS\\S{0,}.iso$", Qt::CaseInsensitive) << 
592
@@ -805,9 +805,9 @@ if (nameDistro == "PCLinuxOS")
593
 if (nameDistro == "Puppy Linux")
594
 {
595
 	downloadfile(fileFilterNetDir(QStringList() << 
596
-	"ftp://ibiblio.org/pub/linux/distributions/puppylinux/" << 
597
+//	"ftp://ibiblio.org/pub/linux/distributions/puppylinux/" <<
598
 	"http://distro.ibiblio.org/pub/linux/distributions/puppylinux/" <<
599
-	"ftp://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/" << 
600
+//	"ftp://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/" <<
601
 	"http://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/"
602
 	, 61440000, 1048576000, QList<QRegExp>() << 
603
 	QRegExp(".iso$", Qt::CaseInsensitive) << 
604
@@ -1018,7 +1018,7 @@ if (nameDistro == "Ubuntu")
605
 			downloadfile(fileFilterNetDir(QStringList() << 
606
 			"http://releases.ubuntu.com/"+relname << 
607
 			"http://releases.ubuntu.com/releases/"+relname <<
608
-			"ftp://releases.ubuntu.com/releases/.pool/" << 
609
+//			"ftp://releases.ubuntu.com/releases/.pool/" <<
610
 			"http://mirrors.gigenet.com/ubuntu/"+relname <<
611
 			"http://mirrors.easynews.com/linux/ubuntu-releases/"+relname <<
612
 			"http://www.gtlib.gatech.edu/pub/ubuntu-releases/"+relname <<
613
614
From 879f90846abf164f1521c23e494bda986653a1e4 Mon Sep 17 00:00:00 2001
615
From: Valeriy Malov <jazzvoid@gmail.com>
616
Date: Fri, 28 Jul 2017 21:33:28 +0300
617
Subject: [PATCH 3/4] fix distrolst.cpp fix listdistros/listversions output
618
 findbrokendownloads.rb doesn't need root, use default ruby use default CONFIG
619
 to allow debug builds
620
621
---
622
 distrolst.cpp          |  6 +++---
623
 findbrokendownloads.rb | 13 ++++---------
624
 unetbootin.cpp         | 25 +++++++++++++++++--------
625
 unetbootin.pro         |  3 +--
626
 4 files changed, 25 insertions(+), 22 deletions(-)
627
628
diff --git a/distrolst.cpp b/distrolst.cpp
629
index b4829f4c..3b45583e 100644
630
--- a/distrolst.cpp
631
+++ b/distrolst.cpp
632
@@ -474,7 +474,7 @@ if (nameDistro == "Frugalware")
633
 //	"ftp://ftp12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
634
 	"http://www12.frugalware.org/mirrors/ftp.frugalware.org/pub/frugalware/frugalware-"+relname+"/boot/" <<
635
 //	"ftp://ftp4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
636
-	"http://www4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/" <<
637
+	"http://www4.frugalware.org/pub/linux/distributions/frugalware/frugalware-"+relname+"/boot/"; //<<
638
 //	"ftp://ftp2.frugalware.org/frugalware/pub/frugalware/frugalware-"+relname+"/boot/" <<
639
 //	"ftp://ftp3.frugalware.org/mirrors/frugalware/pub/frugalware/frugalware-"+relname+"/boot/";
640
 	downloadfile(fileFilterNetDir(frugalwaremirrorsL
641
@@ -550,7 +550,7 @@ if (nameDistro == "Kaspersky Rescue Disk")
642
 	{
643
 		downloadfile(fileFilterNetDir(QStringList() <<
644
 		"http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk/" <<
645
-		"http://ftp.kaspersky.com/devbuilds/RescueDisk/" <<
646
+		"http://ftp.kaspersky.com/devbuilds/RescueDisk/" //<<
647
 //		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk/"
648
 		, 9288000, 1048576000, QList<QRegExp>() <<
649
 		QRegExp(".iso$", Qt::CaseInsensitive) <<
650
@@ -561,7 +561,7 @@ if (nameDistro == "Kaspersky Rescue Disk")
651
 	{
652
 		downloadfile(fileFilterNetDir(QStringList() <<
653
 		"http://devbuilds.kaspersky-labs.com/devbuilds/RescueDisk10/" <<
654
-		"http://ftp.kaspersky.com/devbuilds/RescueDisk10/" <<
655
+		"http://ftp.kaspersky.com/devbuilds/RescueDisk10/" //<<
656
 //		"ftp://ftp.kaspersky.com/devbuilds/RescueDisk10/"
657
 		, 9288000, 1048576000, QList<QRegExp>() <<
658
 		QRegExp(".iso$", Qt::CaseInsensitive) <<
659
diff --git a/findbrokendownloads.rb b/findbrokendownloads.rb
660
index a9ccd896..53f0809f 100755
661
--- a/findbrokendownloads.rb
662
+++ b/findbrokendownloads.rb
663
@@ -1,20 +1,15 @@
664
-#!/usr/bin/ruby1.9
665
+#!/usr/bin/ruby
666
 
667
 # Supply as command line arg the path to the UNetbootin executable
668
 # Outputs distribution:version tuples that failed to download
669
 
670
-if `whoami`.strip != 'root'
671
-puts 'Must be run as root'
672
-exit()
673
-end
674
-
675
 unetbootin = ARGV[0]
676
 
677
-distrolist = `#{unetbootin} action=listdistros`.split("\n")
678
+distrolist = `#{unetbootin} rootcheck=n action=listdistros`.split("\n")
679
 distrolist.each {|distro|
680
-  versions = `#{unetbootin} distribution="#{distro}" action=listversions`.split("\n")
681
+  versions = `#{unetbootin} rootcheck=n distribution="#{distro}" action=listversions`.split("\n")
682
   versions.each {|version|
683
-  exitstatus = `#{unetbootin} method=distribution installtype=HDD distribution="#{distro}" version="#{version}" testingdownload=y autoinstall=y`
684
+  exitstatus = `#{unetbootin} rootcheck=n method=distribution installtype=HDD distribution="#{distro}" version="#{version}" testingdownload=y autoinstall=y`
685
   if exitstatus.include? 'downloadfailed'
686
     puts distro + ':' + version
687
   end
688
diff --git a/unetbootin.cpp b/unetbootin.cpp
689
index 0767fc87..6ffd6fc0 100644
690
--- a/unetbootin.cpp
691
+++ b/unetbootin.cpp
692
@@ -12,6 +12,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
693
 #include <QMessageBox>
694
 #include <QFileDialog>
695
 #include <QProgressDialog>
696
+#include <QDebug>
697
 
698
 static const QList<QRegExp> ignoredtypesbothRL = QList<QRegExp>()
699
 << QRegExp("isolinux.bin$", Qt::CaseInsensitive)
700
@@ -468,8 +469,9 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
701
 				QTextStream out(stdout);
702
 				for (int i = 1; i < this->distroselect->count(); ++i)
703
 				{
704
-					out << this->distroselect->itemText(i);
705
+					out << this->distroselect->itemText(i) << endl;
706
 				}
707
+				out.flush();
708
 				QApplication::exit();
709
 				exit(0);
710
 			}
711
@@ -478,8 +480,9 @@ bool unetbootin::ubninitialize(QList<QPair<QString, QString> > oppairs)
712
 				QTextStream out(stdout);
713
 				for (int i = 0; i < this->dverselect->count(); ++i)
714
 				{
715
-					out << this->dverselect->itemText(i);
716
+					out << this->dverselect->itemText(i) << endl;
717
 				}
718
+				out.flush();
719
 				QApplication::exit();
720
 				exit(0);
721
 			}
722
@@ -2629,12 +2632,13 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
723
 
724
 	QUrl redirectUrl;
725
 	bool downloadFailed = false;
726
+	QNetworkReply::NetworkError errorCode;
727
 
728
 	connect(networkReply, &QNetworkReply::finished, &dlewait, &QEventLoop::quit);
729
 	connect(networkReply, &QNetworkReply::downloadProgress, this, &unetbootin::dlprogressupdate64);
730
-	connect(networkReply, &QNetworkReply::redirected, [&redirectUrl](const QUrl &url){ redirectUrl = url; });
731
+	connect(networkReply, &QNetworkReply::redirected, [&](const QUrl &url){ redirectUrl = url; });
732
 	connect(networkReply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
733
-			[&downloadFailed](QNetworkReply::NetworkError){ downloadFailed = true; });
734
+			[&](QNetworkReply::NetworkError code){ downloadFailed = true; errorCode = code; });
735
 
736
 	dlewait.exec();
737
 
738
@@ -2646,7 +2650,8 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
739
 
740
 	if (downloadFailed)
741
 	{
742
-		QString errorStr = networkReply->errorString();
743
+		qDebug() << networkReply->errorString();
744
+		qDebug() << "Error code: " << errorCode;
745
 		showDownloadFailedScreen(fileurl);
746
 		return;
747
 	}
748
@@ -2685,7 +2690,8 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
749
 	if (testingDownload)
750
 	{
751
 		// Note that this only tests that the first download succeeds
752
-		printf("exitstatus:downloadcomplete\n");
753
+		QTextStream out(stdout);
754
+		out << "exitstatus:downloadcomplete" << endl << flush;
755
 		QApplication::exit();
756
 		exit(0);
757
 	}
758
@@ -2701,7 +2707,8 @@ void unetbootin::showDownloadFailedScreen(const QString &fileurl)
759
 	this->downloadFailed = true;
760
 	if (exitOnCompletion)
761
 	{
762
-		printf("exitstatus:downloadfailed\n");
763
+		QTextStream out(stdout);
764
+		out << "exitstatus:downloadfailed" << endl << flush;
765
 		QApplication::exit();
766
 		exit(0);
767
 	}
768
@@ -2777,6 +2784,7 @@ QString unetbootin::downloadpagecontents(QUrl pageurl)
769
 
770
 QStringList unetbootin::lstFtpDirFiles(QString ldfDirStringUrl, int ldfMinSize, int ldfMaxSize)
771
 {
772
+	qDebug() << "lstFtpDirFiles called for " << ldfDirStringUrl;
773
 	return {};
774
 /*
775
 	QUrl ldfDirUrl(ldfDirStringUrl);
776
@@ -4299,7 +4307,8 @@ void unetbootin::fininstall()
777
     finishLogging();
778
 	if (exitOnCompletion)
779
 	{
780
-		printf("exitstatus:success\n");
781
+		QTextStream out(stdout);
782
+		out << "exitstatus:success" << endl << flush;
783
 		QApplication::exit();
784
 		exit(0);
785
 	}
786
diff --git a/unetbootin.pro b/unetbootin.pro
787
index f3af65f8..6405ba27 100644
788
--- a/unetbootin.pro
789
+++ b/unetbootin.pro
790
@@ -2,13 +2,12 @@ TEMPLATE = app
791
 TARGET = unetbootin
792
 DEPENDPATH += .
793
 INCLUDEPATH += .
794
-CONFIG += release \
795
-    static
796
 
797
 HEADERS += unetbootin.h
798
 FORMS += unetbootin.ui
799
 SOURCES += main.cpp \
800
     unetbootin.cpp \
801
+    customdistrolst.cpp \
802
     distrolst.cpp \
803
     distrover.cpp \
804
     distrovercust.cpp
805
806
From 9cc0841af5d129832d8e2df87355a53f45fca417 Mon Sep 17 00:00:00 2001
807
From: Valeriy Malov <jazzvoid@gmail.com>
808
Date: Fri, 28 Jul 2017 22:13:20 +0300
809
Subject: [PATCH 4/4] don't wait until the file is downloaded fully before
810
 dumping it on disk fix some QNetworkReply/QFile resource freeing delete
811
 dlprogressupdate64 because it's never used fix some slot warnings
812
813
---
814
 unetbootin.cpp | 80 +++++++++++++++++++------------------------
815
 unetbootin.h   |  7 ++--
816
 2 files changed, 39 insertions(+), 48 deletions(-)
817
818
diff --git a/unetbootin.cpp b/unetbootin.cpp
819
index 6ffd6fc0..5a6750e7 100644
820
--- a/unetbootin.cpp
821
+++ b/unetbootin.cpp
822
@@ -699,17 +699,17 @@ QStringList unetbootin::listalldrives()
823
 	return fulldrivelist;
824
 }
825
 
826
-void unetbootin::on_typeselect_currentIndexChanged(int typeselectIndex)
827
+void unetbootin::on_typeselect_currentIndexChanged(int)
828
 {
829
 	refreshdriveslist();
830
 }
831
 
832
-void unetbootin::on_dverselect_currentIndexChanged()
833
+void unetbootin::on_dverselect_currentIndexChanged(int)
834
 {
835
 	radioDistro->setChecked(true);
836
 }
837
 
838
-void unetbootin::on_diskimagetypeselect_currentIndexChanged()
839
+void unetbootin::on_diskimagetypeselect_currentIndexChanged(int)
840
 {
841
 	radioFloppy->setChecked(true);
842
 }
843
@@ -2640,35 +2640,41 @@ void unetbootin::downloadfile(QString fileurl, QString targetfile, int minsize=5
844
 	connect(networkReply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
845
 			[&](QNetworkReply::NetworkError code){ downloadFailed = true; errorCode = code; });
846
 
847
+	QFile dloutfile;
848
+	if (installType == tr("USB Drive"))
849
+	{
850
+		dloutfile.setFileName(randtmpfile::getrandfilename(ubntmpf, "tmp"));
851
+	}
852
+	else
853
+	{
854
+		dloutfile.setFileName(targetfile);
855
+	}
856
+	dloutfile.open(QIODevice::WriteOnly);
857
+
858
+	connect(networkReply, &QNetworkReply::downloadProgress, [&](qint64, qint64){
859
+		dloutfile.write(networkReply->readAll());
860
+	});
861
+
862
 	dlewait.exec();
863
 
864
 	if (!redirectUrl.isEmpty())
865
 	{
866
+		networkReply->deleteLater();
867
 		downloadfile(redirectUrl.toString(), targetfile, minsize);
868
 		return;
869
 	}
870
 
871
 	if (downloadFailed)
872
 	{
873
-		qDebug() << networkReply->errorString();
874
+		qDebug() << "Failed to download URL: " << fileurl;
875
 		qDebug() << "Error code: " << errorCode;
876
+		qDebug() << "Error string: " << networkReply->errorString();
877
+		networkReply->deleteLater();
878
 		showDownloadFailedScreen(fileurl);
879
 		return;
880
 	}
881
 
882
-	QFile dloutfile;
883
-	if (installType == tr("USB Drive"))
884
-	{
885
-		dloutfile.setFileName(randtmpfile::getrandfilename(ubntmpf, "tmp"));
886
-	}
887
-	else
888
-	{
889
-		dloutfile.setFileName(targetfile);
890
-	}
891
-
892
-	dloutfile.open(QIODevice::WriteOnly);
893
 	dloutfile.write(networkReply->readAll());
894
-	networkReply->close();
895
 	networkReply->deleteLater();
896
 	dloutfile.close();
897
 	if (installType == tr("USB Drive"))
898
@@ -2714,34 +2720,19 @@ void unetbootin::showDownloadFailedScreen(const QString &fileurl)
899
 	}
900
 }
901
 
902
-void unetbootin::dlprogressupdate(int dlbytes, int maxbytes)
903
-{
904
- QTime time = QTime::currentTime();
905
- static int oldsec = 0;
906
- // refresh the progress bar every second
907
- if(oldsec != time.second())
908
- {
909
-   oldsec = time.second();
910
-     tprogress->setValue(dlbytes);
911
-     tprogress->setMaximum(maxbytes);
912
-   // display the downloaded size with suffix
913
-     pdesc1->setText(tr("<b>Downloaded:</b> %1 of %2").arg(displayfisize(dlbytes)).arg(displayfisize(maxbytes)));
914
- }
915
-}
916
-
917
 void unetbootin::dlprogressupdate64(qint64 dlbytes, qint64 maxbytes)
918
 {
919
- QTime time = QTime::currentTime();
920
- static int oldsec = 0;
921
- // refresh the progress bar every second
922
- if(oldsec != time.second())
923
- {
924
-   oldsec = time.second();
925
-     tprogress->setValue(dlbytes);
926
-     tprogress->setMaximum(maxbytes);
927
-   // display the downloaded size with suffix
928
-     pdesc1->setText(tr("<b>Downloaded:</b> %1 of %2").arg(displayfisize(dlbytes)).arg(displayfisize(maxbytes)));
929
- }
930
+	QTime time = QTime::currentTime();
931
+	static int oldsec = 0;
932
+	// refresh the progress bar every second
933
+	if(oldsec != time.second())
934
+	{
935
+		oldsec = time.second();
936
+		tprogress->setValue(dlbytes);
937
+		tprogress->setMaximum(maxbytes);
938
+		// display the downloaded size with suffix
939
+		pdesc1->setText(tr("<b>Downloaded:</b> %1 of %2").arg(displayfisize(dlbytes)).arg(displayfisize(maxbytes)));
940
+	}
941
 }
942
 
943
 void unetbootin::cpprogressupdate64(qint64 dlbytes, qint64 maxbytes)
944
@@ -2761,9 +2752,9 @@ void unetbootin::cpprogressupdate64(qint64 dlbytes, qint64 maxbytes)
945
 
946
 QString unetbootin::downloadpagecontents(QUrl pageurl)
947
 {
948
-	QNetworkAccessManager _manager;
949
+	QNetworkAccessManager manager;
950
 	QNetworkRequest dlurl(pageurl);
951
-	QNetworkReply * networkReply = _manager.get(dlurl);
952
+	QNetworkReply * networkReply = manager.get(dlurl);
953
 	QEventLoop pgwait;
954
 	QUrl redirectUrl;
955
 	connect(networkReply, &QNetworkReply::finished, &pgwait, &QEventLoop::quit);
956
@@ -2773,6 +2764,7 @@ QString unetbootin::downloadpagecontents(QUrl pageurl)
957
 
958
 	if (!redirectUrl.isEmpty())
959
 	{
960
+		networkReply->deleteLater();
961
 		return downloadpagecontents(redirectUrl);
962
 	}
963
 
964
diff --git a/unetbootin.h b/unetbootin.h
965
index 8cb45d81..99c93a28 100644
966
--- a/unetbootin.h
967
+++ b/unetbootin.h
968
@@ -336,9 +336,9 @@ class unetbootin : public QWidget, private Ui::unetbootinui
969
 
970
 private slots:
971
 	void on_distroselect_currentIndexChanged(int distroselectIndex);
972
-	void on_typeselect_currentIndexChanged(int typeselectIndex);
973
-	void on_dverselect_currentIndexChanged();
974
-	void on_diskimagetypeselect_currentIndexChanged();
975
+	void on_typeselect_currentIndexChanged(int);
976
+	void on_dverselect_currentIndexChanged(int);
977
+	void on_diskimagetypeselect_currentIndexChanged(int);
978
 	void on_FloppyFileSelector_clicked();
979
 	void on_KernelFileSelector_clicked();
980
 	void on_InitrdFileSelector_clicked();
981
@@ -347,7 +347,6 @@ private slots:
982
 	void on_fexitbutton_clicked();
983
 
984
 public slots:
985
-	void dlprogressupdate(int dlbytes, int maxbytes);
986
 	void dlprogressupdate64(qint64 dlbytes, qint64 maxbytes);
987
 	void cpprogressupdate64(qint64 dlbytes, qint64 maxbytes);
988
 	void on_okbutton_clicked();
(-)a/sys-boot/unetbootin/unetbootin-661.ebuild (-1 / +94 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2018 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
4
EAPI=6
5
6
inherit desktop qmake-utils
7
8
DESCRIPTION="UNetbootin installs Linux/BSD distributions to a partition or USB drive"
9
HOMEPAGE="https://github.com/unetbootin/unetbootin"
10
SRC_URI="${HOMEPAGE}/archive/${PV}.tar.gz -> ${P}.tar.gz"
11
12
SLOT="0"
13
LICENSE="GPL-2"
14
KEYWORDS="~amd64 ~x86"
15
16
UNBI_LINGUAS="
17
	am ar ast be bg bn ca cs da de el eo es et eu fa fi fo fr gl he hr hu id it
18
	ja lt lv ml ms nan nb nl nn pl pt_BR pt ro ru si sk sl sr sv sw tr uk ur vi
19
	zh_CN zh_TW
20
"
21
22
for lingua in ${UNBI_LINGUAS}; do
23
	IUSE="${IUSE} l10n_${lingua/_/-}"
24
done
25
26
S=${WORKDIR}/${P}/src/${PN}
27
28
DEPEND="
29
	dev-qt/qtcore:5
30
	dev-qt/qtgui:5
31
	dev-qt/qtnetwork:5
32
	dev-qt/qtwidgets:5
33
"
34
RDEPEND="
35
	${DEPEND}
36
	app-arch/p7zip
37
	sys-boot/syslinux
38
	sys-fs/mtools
39
"
40
PATCHES=(
41
	"${FILESDIR}/${PN}-581-desktop.patch"
42
	"${FILESDIR}/${P}-qt5.patch"
43
)
44
45
src_prepare() {
46
	default
47
48
	# QA check in case linguas are added or removed
49
	enum() {
50
		echo ${#}
51
	}
52
	[[ $(enum ${UNBI_LINGUAS}) -eq $(( $(enum $(echo ${PN}_*.ts) ) -1 )) ]] \
53
		|| die "Numbers of recorded and actual linguas do not match"
54
	unset enum
55
56
	# Remove localisations
57
	local lingua
58
	for lingua in ${UNBI_LINGUAS}; do
59
		if ! use l10n_${lingua/_/-}; then
60
			sed -i ${PN}.pro -e "/\.*${PN}_${lingua}\.ts.*/d" || die
61
			rm ${PN}_${lingua}.ts || die
62
		fi
63
	done
64
}
65
66
src_configure() {
67
	sed -i -e '/^RESOURCES/d' unetbootin.pro || die
68
69
	UNBN_QTPATH="$(qt5_get_bindir)/"
70
	"${UNBN_QTPATH}"lrelease ${PN}.pro || die
71
72
	eqmake5 ${PN}.pro || die
73
}
74
75
src_install() {
76
	dobin ${PN}
77
78
	domenu ${PN}.desktop
79
80
	for file in ${PN}*.png; do
81
		size="${file/${PN}_}"
82
		size="${size/.png}x${size/.png}"
83
		insinto /usr/share/icons/hicolor/${size}/apps
84
		newins ${file} ${PN}.png
85
	done
86
87
	local lingua
88
	for lingua in ${UNBI_LINGUAS}; do
89
		if use l10n_${lingua/_/-}; then
90
			insinto /usr/share/${PN}
91
			doins ${PN}_${lingua}.qm
92
		fi
93
	done
94
}

Return to bug 644360