-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>
<message> <message>
<location filename="mainwindow.cpp" line="456"/> <location filename="mainwindow.cpp" line="456"/>
<location filename="mainwindow.cpp" line="553"/> <location filename="mainwindow.cpp" line="540"/>
<source>File</source> <source>File</source>
<translation>Doc</translation> <translation>Doc</translation>
</message> </message>
<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> <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> <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>
<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> <source>Rsync process crashed</source>
<translation>Le processus rsync à planté</translation> <translation>Le processus rsync à planté</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="770"/> <location filename="mainwindow.cpp" line="784"/>
<source>Version</source> <source>Version</source>
<translation>Version</translation> <translation>Version</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="771"/> <location filename="mainwindow.cpp" line="785"/>
<source>Licence</source> <source>Licence</source>
<translation>License</translation> <translation>License</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="772"/> <location filename="mainwindow.cpp" line="786"/>
<source>Author</source> <source>Author</source>
<translation>Auteur</translation> <translation>Auteur</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="773"/> <location filename="mainwindow.cpp" line="787"/>
<source>EMail</source> <source>EMail</source>
<translation>Courriel</translation> <translation>Courriel</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="774"/> <location filename="mainwindow.cpp" line="788"/>
<source>Source code</source> <source>Source code</source>
<translation>Code source</translation> <translation>Code source</translation>
</message> </message>
<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> <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> <translation>Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut</translation>
</message> </message>
<message> <message>
<location filename="mainwindow.cpp" line="802"/> <location filename="mainwindow.cpp" line="816"/>
<source>Choose folder where to save file</source> <source>Choose folder where to save file</source>
<translation>Choisissez un dossier enregistrer le document</translation> <translation>Choisissez un dossier enregistrer le document</translation>
</message> </message>
<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> <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> <translation>Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ?</translation>
</message> </message>
<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> <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> <translation>Voulez-vous enlever ce fichier de la file de téléchargement ?</translation>
</message> </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"; cout << "no directory selectioned, ignoring download request";
return; 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)) if (QFile::exists(this->downloading.savePath + "/" + path))
{ {
reply = QMessageBox::question( reply = QMessageBox::question(
@ -543,16 +558,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
QFile::remove(this->downloading.savePath + "/" + path); 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()) if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty())
{ {
// is there a downloading process ? // is there a downloading process ?
@ -570,6 +576,13 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
// Adding download in download list // Adding download in download list
str = path + " => " + this->connexion.server + "/" + this->connexion.service; str = path + " => " + this->connexion.server + "/" + this->connexion.service;
ui->listDownload->addItem(str); ui->listDownload->addItem(str);
}else
{
QMessageBox::warning(
this,
"RsyncUI",
tr("File is already downloading" )
);
} }
}else }else
{ {
@ -671,6 +684,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus)
} }
} }
} }
saveDownloadList();
} }