From f73174216adbe3c6ce3cf750f73af6da99bbb99e Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Sat, 11 Feb 2023 13:40:46 +0100 Subject: [PATCH] -corrected bug - added warning when selecting a file which is already in download queue --- RsyncUI_fr_FR.ts | 29 ++++++++++------- languages/fr_FR/RsyncUI_fr_FR.qm | Bin 14403 -> 14545 bytes mainwindow.cpp | 52 ++++++++++++++++++++----------- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/RsyncUI_fr_FR.ts b/RsyncUI_fr_FR.ts index 722a54d..20b3414 100644 --- a/RsyncUI_fr_FR.ts +++ b/RsyncUI_fr_FR.ts @@ -248,62 +248,67 @@ Voulez-vous vraiment sortir ? - + File Doc - + File is already downloaded. Do you want to reload it ? The old file will be deleted Le document est déjà téléchargé. Voulez-vous le télécharger à nouveau ? L'ancien fichier sera effacé - + + File is already downloading + Le document est déjà en téléchargement + + + Rsync process crashed Le processus rsync à planté - + Version Version - + Licence License - + Author Auteur - + EMail Courriel - + Source code Code source - + Since the save path is linked to service, you need to select a service before you can select a folder Vous devez sélectionnez un service pour pouvoir sélectionnez un dossier par défaut - + Choose folder where to save file Choisissez un dossier où enregistrer le document - + Do you want to stop downloading and delete this file from download queue ? Voulez-vous arrêter le téléchargement et enlever ce fichier de la file de téléchargement ? - + Do you want to delete this file from download queue ? Voulez-vous enlever ce fichier de la file de téléchargement ? diff --git a/languages/fr_FR/RsyncUI_fr_FR.qm b/languages/fr_FR/RsyncUI_fr_FR.qm index 829bc007402634da6d43e975440aa7b0dd039d4e..66e5449ec4b8f40feba98955d66fa142607861e2 100644 GIT binary patch delta 554 zcmWNOUr1A77{;G-&c1VY+?l%RT-)3~&BZFSO>y0{po<1F7F`xHm~^t$u<0Na!9f%h zR4S($p+l{RD1vH2RI{WOEsJPI&>!k9>SB3OfdnSKS3mf8-sk;&-}fwC8JuwWPXoGp zz=re0U&I2y%z#ZH?k0{APXNx)WW=4l3U>Sg9WH~-F`&5&wx|N0A7~1Nfo-=Cxl{tg z@8}7w0ga;=+__4ndTwQ80BHHj#~;Lj;5h%L{~8rf@$a2(z;cfNTY65p4}w=uJ-XMz z$K@C;?G-*}`e|Q4*L#ITCcpTzcUfmkA7Geb!^#Ulxy{ZN$=#k~)6-7@N08m;+JM?L zdm^p?z8j*n^)kR`#r>}u0B=M*urvf1&xj}AJqEU%62ApVxiKtO6YBtXQCu4))vlsc zlW_sA>r&stT3~ZgI^0b(x6Vn$BUN(tNtJmDxQ}W%&X@Je`t>Ny1!8h*nb_VTx69HDrxJev$x$*nlTlR07=_GmXi2MEC;w$;snu6 z{34D5Ia?7=Zk-Wa-z<>b0B)6|p&Q(3J7D%B)9C^#tnkcT0{lDbo!>zEAd?sf0{P9X zZ{G)0iIGhyyGfC!q;S%m;`yPGjyx$|!vQj_N8)y-R8C=}S{=8vbPnh@xIM-SXhYly zp8#z6yim3Xu)}=IZ5nyc_|}_VKr_jYKOO@mzj7NR6+49Fun91k1^C#NppJSI3s!WDrvf!l&7i=CH0e6 zp!$eWs=%o>M16qbUVX@f>D9RUdW9tBDUEL41=zPW(MGyL&)sAW0almhC0a$*^~)Z% fQ0z$YW>ArOx7^R#`9K#?v#_(lsdownloading.savePath + "/" + path)) + }else { - 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); - } + this->downloading.savePath = this->settings.value(str).toString(); } + + while(itemR->parent() != NULL) { itemR = itemR->parent(); @@ -553,6 +540,25 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD 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( + 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); + } + } + 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 { @@ -628,7 +641,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) disconnect(this->downloading.process, 0, 0, 0); // reset variables and window - this->downloading.process= nullptr; + this->downloading.process = nullptr; ui->progressBar->hide(); delete ui->listDownload->takeItem(0); this->downloading.clear(); @@ -653,7 +666,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) path.resize(pos); this->downloading.path = path; - // save path exists in settings ? + // savepath exists in settings ? str = "Folder/" + this->downloading.server + "/" + this->downloading.service; if (this->settings.contains(str)) { @@ -671,6 +684,7 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) } } } + saveDownloadList(); }