[network/ktorrent/release/26.08] ktorrent/view: Fix data checker progress bar skipping to 100% when cancelled or error happened

Jack Hill <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 071474bff60832cf07e0b5a3e44f4f1e76e8bf9e by Jack Hill.
Committed on 21/07/2026 at 21:15.
Pushed by jackh into branch 'release/26.08'.

Fix data checker progress bar skipping to 100% when cancelled or error happened

To reproduce:
- Have a fairly large torrent (1GB is probably enough)
- Right click in main view and select "Check Data"
- Let it check a few chunks
- Press cancel

Before:
- Progress bar skipped to 100%

Now:
- Progress bar stays at the value it was at before being cancelled


(cherry picked from commit ec220c29ca09742d217a4d8f25081e78ab97daa5)

Co-authored-by: Jack Hill <[email protected]>

M  +3    -2    ktorrent/view/scanextender.cpp

https://invent.kde.org/network/ktorrent/-/commit/071474bff60832cf07e0b5a3e44f4f1e76e8bf9e

diff --git a/ktorrent/view/scanextender.cpp b/ktorrent/view/scanextender.cpp
index e45ebb473..2064852b5 100644
--- a/ktorrent/view/scanextender.cpp
+++ b/ktorrent/view/scanextender.cpp
@@ -99,12 +99,13 @@ void ScanExtender::percent(long unsigned int percent)
 
 void ScanExtender::finished(KJob *j)
 {
-    progress_bar->setValue(progress_bar->maximum());
     progress_bar->setEnabled(false);
     cancel_button->setDisabled(true);
     close_button->setEnabled(true);
 
-    if (j->error() && !j->errorText().isEmpty()) {
+    if (!j->error()) {
+        progress_bar->setValue(progress_bar->maximum());
+    } else if (!j->errorText().isEmpty()) {
         error_msg->show();
         error_msg->setText(i18n("<font color=\"red\">%1</font>", j->errorText()));
         Q_EMIT resized(this);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.