added password protected connexion

correction bug on detection of already downloaded file
This commit is contained in:
2023-02-27 23:48:05 +01:00
parent 10060ee2c4
commit e7eafb3117
9 changed files with 314 additions and 50 deletions
+10 -2
View File
@@ -33,7 +33,7 @@ void MainWindow::cancelled(QProcess * process)
n = process->waitForFinished(30000);
if (n == false)
{
process->kill();
process->close();
}
}
@@ -42,7 +42,15 @@ void MainWindow::download()
{
QString cmd;
QStringList param;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
this->downloading.process = new QProcess(this);
if (!this->downloading.user.isEmpty())
{
this->downloading.server.prepend(this->connexion.user + "@");
env.insert("RSYNC_PASSWORD", this->downloading.password); // Add an environment variable
this->downloading.process->setProcessEnvironment(env);
}
// Populating array with command and parameters for popen2
cmd = "rsync";
if (this->connexion.bandwidthLimit != 0)
@@ -53,7 +61,7 @@ void MainWindow::download()
param << "-aXP";
param << this->downloading.server + "::" + this->downloading.service + "/" + this->downloading.path << this->downloading.savePath + "/";
this->downloading.process = new QProcess(this);
connect(this->downloading.process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(downloadFinished(int, QProcess::ExitStatus)));
//connect(this->downloading.process, SIGNAL(errorOccurred(QProcess::ProcessError error)), this, SLOT(downloadProcessError(QProcess::ProcessError error)));