]> cloud.milkyroute.net Git - dolphin.git/commitdiff
KFileItemModelRolesUpdater: only update the size for changed folders
authorFrank Reininghaus <frank78ac@googlemail.com>
Wed, 22 May 2013 16:06:54 +0000 (18:06 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Wed, 22 May 2013 16:09:42 +0000 (18:09 +0200)
When using inotify, we also receive signals for modified files, even if
we only ask KDirWatch to watch the directory containing them. In that
case, we must not set the size to -1 (which means "unknown number of
items" for folders) temporarily, or we end up with an apparent file size
of 2^64 - 1 bytes.

BUG: 309740
FIXED-IN: 4.10.4
REVIEW: 110428

src/kitemviews/kfileitemmodelrolesupdater.cpp

index 39d01e232045dde60776bd02aef27c9bdf218dcf..7cade10f5f6a7f8de4e67196aa021d31beb50150 100644 (file)
@@ -630,6 +630,13 @@ void KFileItemModelRolesUpdater::slotDirWatchDirty(const QString& path)
     if (getSizeRole || getIsExpandableRole) {
         const int index = m_model->index(KUrl(path));
         if (index >= 0) {
+            if (!m_model->fileItem(index).isDir()) {
+                // If INotify is used, KDirWatch issues the dirty() signal
+                // also for changed files inside the directory, even if we
+                // don't enable this behavior explicitly (see bug 309740).
+                return;
+            }
+
             QHash<QByteArray, QVariant> data;
 
             const int count = subItemsCount(path);