-corrected bug

- added  warning when selecting a file which is already in download
  queue
This commit is contained in:
Daniel Tartavel 2023-02-11 13:40:46 +01:00
parent 0b60543ff3
commit f73174216a
3 changed files with 50 additions and 31 deletions

View File

@ -248,62 +248,67 @@ Voulez-vous vraiment sortir ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="553"/>
<location filename="mainwindow.cpp" line="540"/>
<source>File</source>
<translation>Doc</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="534"/>
<location filename="mainwindow.cpp" line="549"/>
<source>File is already downloaded. Do you want to reload it ? The old file will be deleted</source>
<translation>Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L&apos;ancien fichier sera effacé</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="615"/>
<location filename="mainwindow.cpp" line="584"/>
<source>File is already downloading</source>
<translation>Le document est déjà en téléchargement</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="628"/>
<source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="770"/>
<location filename="mainwindow.cpp" line="784"/>
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="771"/>
<location filename="mainwindow.cpp" line="785"/>
<source>Licence</source>
<translation>License</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="772"/>
<location filename="mainwindow.cpp" line="786"/>
<source>Author</source>
<translation>Auteur</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="773"/>
<location filename="mainwindow.cpp" line="787"/>
<source>EMail</source>
<translation>Courriel</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="774"/>
<location filename="mainwindow.cpp" line="788"/>
<source>Source code</source>
<translation>Code source</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="797"/>
<location filename="mainwindow.cpp" line="811"/>
<source>Since the save path is linked to service, you need to select a service before you can select a folder</source>
<translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="802"/>
<location filename="mainwindow.cpp" line="816"/>
<source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="688"/>
<location filename="mainwindow.cpp" line="702"/>
<source>Do you want to stop downloading and delete this file from download queue ?</source>
<translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message>
<message>
<location filename="mainwindow.cpp" line="702"/>
<location filename="mainwindow.cpp" line="716"/>
<source>Do you want to delete this file from download queue ?</source>
<translation>Voulez-vous enlever ce fichier de la file de téléchargement ?</translation>
</message>

Binary file not shown.

View File

@ -524,8 +524,23 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
cout << "no directory selectioned, ignoring download request";
return;
}
}else
{
this->downloading.savePath = this->settings.value(str).toString();
}
while(itemR->parent() != NULL)
{
itemR = itemR->parent();
// concatening parent to path
path.prepend(itemR->text(0) + "/");
};
if (item->text(1) == tr("File") or downloadDir == true)
{
// Item is a file
// searching if file exists in savepath
if (QFile::exists(this->downloading.savePath + "/" + path))
{
reply = QMessageBox::question(
@ -543,16 +558,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
QFile::remove(this->downloading.savePath + "/" + path);
}
}
while(itemR->parent() != NULL)
{
itemR = itemR->parent();
// concatening parent to path
path.prepend(itemR->text(0) + "/");
};
if (item->text(1) == tr("File") or downloadDir == true)
{
// Item is a file
if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty())
{
// is there a downloading process ?
@ -570,6 +576,13 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
// Adding download in download list
str = path + " => " + this->connexion.server + "/" + this->connexion.service;
ui->listDownload->addItem(str);
}else
{
QMessageBox::warning(
this,
"RsyncUI",
tr("File is already downloading" )
);
}
}else
{
@ -671,6 +684,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
}
}
}
saveDownloadList();
}