[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeutils/kfloppy
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2004-08-12 12:04:38
Message-ID: 20040812120438.095989A68 () office ! kde ! org
[Download RAW message or body]

CVS commit by goutte: 

- Fix progress bar when calling fdformat, which seems to have changed its
  output since KFloppy was written. (Part of bug #67767)
- Set LC_ALL="C"
CCMAIL:67767@bugs.kde.org


  M +15 -7     format.cpp   1.12


--- kdeutils/kfloppy/format.cpp  #1.11:1.12
@@ -26,4 +26,5 @@
 
 #include <qtimer.h>
+#include <qregexp.h>
 
 #include <klocale.h>
@@ -353,5 +354,5 @@ bool FloppyAction::startProcess()
                 this,SLOT(processStdErr(KProcess *,char *,int)));
 
-
+        theProcess->setEnvironment( "LC_ALL", "C" ); // We need the untranslated output of the tool
         return theProcess->start(KProcess::NotifyOnExit,
                 KProcess::AllOutput);
@@ -472,4 +472,16 @@ void FDFormat::processStdOut(KProcess *,
 #elif defined(ANY_LINUX)
         s = QString::fromLatin1(b,l);
+#if 1
+        QRegExp regexp( "([0-9]+)" );
+        if ( regexp.search(s) > -1 )
+        {
+            const int p = regexp.cap(1).toInt();
+            if ((p>0) && (p<deviceInfo->tracks))
+            {
+                    emit status(QString::null,
+                            p * 100 / deviceInfo->tracks);
+            }
+        }
+#else
         int p;
         if ((p=s.find("track")) != -1)
@@ -480,11 +492,7 @@ void FDFormat::processStdOut(KProcess *,
                 {
                         p=s.mid(p,8).toInt();
-                        if ((p>0) && (p<deviceInfo->tracks))
-                        {
-                                emit status(QString::null,
-                                        p * 100 / deviceInfo->tracks);
-                        }
                 }
         }
+#endif
         else if (s.contains("ioctl(FDFMTBEG)"))
         {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic