[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. ae3f1a6f9e4dfcc14e6747ac88656d6e85ee0d4b

George Kiagiadakis gkiagia-guest at alioth.debian.org
Sat Mar 7 00:28:21 UTC 2009


The following commit has been merged in the master branch:
commit ae3f1a6f9e4dfcc14e6747ac88656d6e85ee0d4b
Author: George Kiagiadakis <gkiagia at users.sourceforge.net>
Date:   Sat Mar 7 02:21:14 2009 +0200

    Fix a bug with the progressBar value in recursiveRmDir.
    Some filesystems (like reiserfs) have variable directory size, so when counting
    the directory size we must make sure that no files have been removed from this
    directory, or else .size() will report smaller value than the value that it had
    reported for the same directory in calculateDirSize().

diff --git a/diroperations/recursivedirjob.cpp b/diroperations/recursivedirjob.cpp
index f06cdd9..e6493f6 100644
--- a/diroperations/recursivedirjob.cpp
+++ b/diroperations/recursivedirjob.cpp
@@ -285,6 +285,12 @@ void RecursiveDirJobHelper::recursiveRmDir(const QString & dir)
         emit setLabelText(tr("Removing files..."));
         if (dirSize > 0) {
             emit setMaximum(dirSize);
+            //start with the size of the directory to be removed.
+            //we do this before starting removing files, because on some filesystems
+            //(like reiserfs) the directory size is variable and will be smaller
+            //when all files have been removed
+            bytesRemoved += QFileInfo(dir).size();
+            emit setValue(bytesRemoved);
         } else {
             //no files to be removed, so set the progressbar to 100%
             emit setMaximum(1);
@@ -297,6 +303,11 @@ void RecursiveDirJobHelper::recursiveRmDir(const QString & dir)
         if ( !currentList.isEmpty() ){
             currentItem = currentList.takeFirst();
 
+            if ( m_reportProgress ) {
+                bytesRemoved += currentItem.size();
+                emit setValue(bytesRemoved);
+            }
+
             if ( currentItem.isDir() && !currentItem.isSymLink() )
             {
                 if ( !currentDir.cd(currentItem.fileName()) )
@@ -306,11 +317,6 @@ void RecursiveDirJobHelper::recursiveRmDir(const QString & dir)
             }
             else
             {
-                if ( m_reportProgress ) {
-                    bytesRemoved += currentItem.size();
-                    emit setValue(bytesRemoved);
-                }
-
                 if ( !currentDir.remove(currentItem.fileName()) )
                     throw Exception(Exception::RmFail, currentItem.absoluteFilePath());
             }
@@ -327,12 +333,6 @@ void RecursiveDirJobHelper::recursiveRmDir(const QString & dir)
             QString tmpname = currentDir.dirName();
             currentDir.cdUp();
 
-            if ( m_reportProgress ) {
-                //count the directory special file before it is removed
-                bytesRemoved += QFileInfo(currentDir, tmpname).size();
-                emit setValue(bytesRemoved);
-            }
-
             if ( !currentDir.rmdir(tmpname) )
                 throw Exception(Exception::RmFail, currentDir.absoluteFilePath(tmpname));
 

-- 
Kaboom - Debian KDE 3->4 migration tool



More information about the pkg-kde-commits mailing list