Bug 507443 - Progress bar cancellation cannot be detected in script
Summary: Progress bar cancellation cannot be detected in script
Status: REPORTED
Alias: None
Product: kdialog
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Brad Hards
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-24 14:01 UTC by burneddi
Modified: 2025-07-24 14:01 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description burneddi 2025-07-24 14:01:40 UTC
SUMMARY
kdialog --progressbar can be cancelled by the user, but when it is, this is difficult to detect from a script. The way described in the documentation of querying the wasCancelled property from DBus does not work, because when the user clicks cancel, the progress bar closes, which includes closing its DBus service. It is also difficult if not impossible to get the exit code of the progress bar process itself, because it forks itself and cannot be `wait`ed on.

STEPS TO REPRODUCE
Try this example from the docs https://develop.kde.org/docs/administration/kdialog/#--progressbar-dialog-box-example-with-cancel

dbusRef=`kdialog --progressbar "Press Cancel at Any time" 10`
qdbus $dbusRef showCancelButton true

until test "true" = `qdbus $dbusRef wasCancelled`; do
 sleep 1
 inc=$((`qdbus $dbusRef Get "" "value"` + 1))
 qdbus $dbusRef Set "" "value" $inc;
done

qdbus $dbusRef close

OBSERVED RESULT
Clicking Cancel makes the script throw a bunch of errors:

Cannot find '.Get' in object /ProgressDialog at org.kde.kdialog-2655344
Cannot find '.Set' in object /ProgressDialog at org.kde.kdialog-2655344
Service 'org.kde.kdialog-2655344' does not exist.
./test.sh: line 6: test: true: unary operator expected


EXPECTED RESULT
Clicking cancel stops the script.



ADDITIONAL INFORMATION