- added verification of already downloaded files
This commit is contained in:
+31
-12
@@ -507,11 +507,42 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
|
||||
QTreeWidgetItem * itemR;
|
||||
QString path;
|
||||
QString str;
|
||||
QMessageBox::StandardButton reply;
|
||||
|
||||
itemR = item;
|
||||
|
||||
// assembling path from treewidget
|
||||
path = item->text(0);
|
||||
|
||||
// exists saving path in settings ?
|
||||
str = "Folder/" + this->connexion.server + "/" + this->connexion.service;
|
||||
if(!this->settings.contains(str))
|
||||
{
|
||||
// saving path do not exists, asking for it
|
||||
if(!on_DefaultSaveFolder_triggered())
|
||||
{
|
||||
cout << "no directory selectioned, ignoring download request";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (QFile::exists(this->downloading.savePath + "/" + path))
|
||||
{
|
||||
reply = QMessageBox::question(
|
||||
this,
|
||||
"RsyncUI",
|
||||
tr("File is already downloaded. Do you want to reload it ? The old file will be deleted"),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
|
||||
if (reply == QMessageBox::No)
|
||||
{
|
||||
return;
|
||||
}else
|
||||
{
|
||||
QFile::remove(this->downloading.savePath + "/" + path);
|
||||
}
|
||||
}
|
||||
while(itemR->parent() != NULL)
|
||||
{
|
||||
itemR = itemR->parent();
|
||||
@@ -524,18 +555,6 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
|
||||
// Item is a file
|
||||
if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty())
|
||||
{
|
||||
// exists saving path in settings ?
|
||||
str = "Folder/" + this->connexion.server + "/" + this->downloading.service;
|
||||
if(!this->settings.contains(str))
|
||||
{
|
||||
// saving path do not exists, asking for it
|
||||
if(!on_DefaultSaveFolder_triggered())
|
||||
{
|
||||
cout << "no directory selectioned, ignoring download request";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// is there a downloading process ?
|
||||
if (this->downloading.process == nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user