added password protected connexion
correction bug on detection of already downloaded file
This commit is contained in:
+10
-2
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user