Package: ssft
Version: 0.9.11
Severity: normal
Tags: patch

In KDE4, kdialog uses a dbus interface for progress bar operations. Here is
a patch which uses kdialog --progressbar instantiation reference string to
detect whether the (old) dcop or (current) dbus interface should be used for
communicating with progress bar window.

Thanks, Kel.
---
--- a/src/ssft.sh
+++ b/src/ssft.sh
@@ -441,35 +441,51 @@ ssft_progress_bar() {
                   --percentage "$_l_percent" --auto-close
   ;;
   kdialog)
-    _l_kdpbdc="/tmp/kdpbdc-$PID.`date +"%s"`"
-    kdialog --progressbar "$_l_title" 100 > "$_l_kdpbdc" 2> /dev/null
-    DCOPREF=$( sed -n -e '/^DCOPRef/ {
-      s/DCOPRef(\(.*\),ProgressDialog)/\1/;
-      p
-    }' $_l_kdpbdc);
-    rm -f "$_l_kdpbdc"
-    dcop $DCOPREF ProgressDialog setAutoClose true
-    while read _l_line; do
-      _l_percent="`echo $_l_line | sed -n -e '/^[0-9][0-9]*/ {
-        p;
-      };'`"
-      if [ -z "$_l_percent" ]; then
-        dcop $DCOPREF ProgressDialog setLabel "$_l_line" 2> /dev/null;
-      else
-       dcop $DCOPREF ProgressDialog setProgress "$_l_percent" 2> /dev/null;
-      fi
-    done
-    while read _l_line; do
-      _l_percent="`echo $_l_line | sed -n -e '/^[0-9][0-9]*/ {
-        p;
-      };'`"
-      if [ -z "$_l_percent" ]; then
-        _l_text="$_l_line"
-        dcop $DCOPREF ProgressDialog SetLabel "$_l_text"
-      else
-        dcop $DCOPREF ProgressDialog SetPercent "$_l_percent"
-      fi
-    done
+    _l_kdpbref="/tmp/kdpbdc-$PID.`date +"%s"`"
+    kdialog --progressbar "$_l_title" 100 > "$_l_kdpbref" 2> /dev/null
+    if grep -q '^DCOPRef' $_l_kdpbref; then
+      DCOPREF=$( sed -n -e '/^DCOPRef/ {
+       s/DCOPRef(\(.*\),ProgressDialog)/\1/;
+       p
+      }' $_l_kdpbref);
+      rm -f "$_l_kdpbref"
+      dcop $DCOPREF ProgressDialog setAutoClose true
+      while read _l_line; do
+       _l_percent="`echo $_l_line | sed -n -e '/^[0-9][0-9]*/ {
+         p;
+       };'`"
+       if [ -z "$_l_percent" ]; then
+         dcop $DCOPREF ProgressDialog setLabel "$_l_line" 2> /dev/null;
+       else
+         dcop $DCOPREF ProgressDialog setProgress "$_l_percent" 2> /dev/null;
+       fi
+      done
+      while read _l_line; do
+       _l_percent="`echo $_l_line | sed -n -e '/^[0-9][0-9]*/ {
+         p;
+       };'`"
+       if [ -z "$_l_percent" ]; then
+         _l_text="$_l_line"
+         dcop $DCOPREF ProgressDialog SetLabel "$_l_text"
+       else
+         dcop $DCOPREF ProgressDialog SetPercent "$_l_percent"
+       fi
+      done
+    else
+      DBUSREF=$(cat $_l_kdpbref)
+      rm -f "$_l_kdpbref"
+      qdbus $DBUSREF Set org.kde.kdialog.ProgressDialog autoClose true
+      while read _l_line; do
+       _l_percent="`echo $_l_line | sed -n -e '/^[0-9][0-9]*/ {
+         p;
+       };'`"
+       if [ -z "$_l_percent" ]; then
+         qdbus $DBUSREF org.kde.kdialog.ProgressDialog.setLabelText "$_l_line" 
2> /dev/null;
+       else
+         qdbus $DBUSREF Set org.kde.kdialog.ProgressDialog value "$_l_percent" 
2> /dev/null;
+       fi
+      done
+    fi
   ;;
   dialog)
     while read _l_line; do
---



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to