bug correction: when stopping a dl an error when prompted

This commit is contained in:
Daniel Tartavel 2023-03-11 13:53:05 +01:00
parent f40e4f9485
commit e10558ff5b
3 changed files with 6 additions and 4 deletions

View File

@ -983,7 +983,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
tr("Rsync process crashed"));
}
//test result code of command (if 20 then command stopped by user)
if (exitCode != 0)
if (exitCode != 0 and this->stopDlAsked != true)
{
if (exitCode == 20)
{
@ -1006,7 +1006,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
retry = true;
}
}
this->stopDlAsked = false;
this->trayIcon->showMessage(a.applicationName(), tr("Download ") + aborted + "\n" + this->downloading.path, QSystemTrayIcon::Information);
// disconnecting signals to slots
@ -1080,6 +1080,7 @@ void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
if (reply == QMessageBox::Yes)
{
// stopping download
this->stopDlAsked = true;
emit (stopDownloading(this->downloading.process));
}
}else
@ -1096,7 +1097,6 @@ void MainWindow::on_listDownload_itemClicked(QListWidgetItem *item)
// removing line from download list
ui->listDownload->removeItemWidget(item);
delete item;
}
}
if (config.autosaveCheckbox->checkState() == Qt::Checked)

View File

@ -120,6 +120,7 @@ class MainWindow : public QMainWindow
QSystemTrayIcon * trayIcon;
QString icon = "/usr/share/icons/RsyncUI.png";
bool rescan = false;
bool stopDlAsked;
QList<QString> UnitText {
tr("B"),

View File

@ -48,7 +48,7 @@ const vector<string> explode(const string& s, const char& c, int n = 0)
// return true in case of error
bool testRsyncReturn(MainWindow * w, QProcess * myProcess)
{
if (myProcess->exitStatus() != 0)
if (myProcess->exitStatus() != 0 and w->stopDlAsked != true)
{
QMessageBox::warning(
w,
@ -58,6 +58,7 @@ bool testRsyncReturn(MainWindow * w, QProcess * myProcess)
QMessageBox::Ok);
return true;
}
w->stopDlAsked = false;
return false;
}