]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/private/kdirectorycontentscounterworker.cpp
kfileitemmodel: sortRoleCompare: allow to sort by access time.
[dolphin.git] / src / kitemviews / private / kdirectorycontentscounterworker.cpp
index 1e4a0b3b47eb5d483be8139203b9e77a597d3964..73799e739678863657d98ada5fdba5d61d1db03f 100644 (file)
@@ -1,22 +1,9 @@
-/***************************************************************************
- *   Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com>             *
- *   Copyright (C) 2013 by Frank Reininghaus <frank78ac@googlemail.com>    *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2011 Peter Penz <peter.penz19@gmail.com>
+ * SPDX-FileCopyrightText: 2013 Frank Reininghaus <frank78ac@googlemail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "kdirectorycontentscounterworker.h"
 
@@ -48,6 +35,7 @@ KDirectoryContentsCounterWorker::CountResult walkDir(const QString &dirPath,
     auto dir = QT_OPENDIR(QFile::encodeName(dirPath));
     if (dir) {
         count = 0;
+        size = 0;
         QT_STATBUF buf;
 
         while ((dirEntry = QT_READDIR(dir))) {
@@ -122,7 +110,7 @@ KDirectoryContentsCounterWorker::CountResult KDirectoryContentsCounterWorker::su
 
     QT_DIRENT *dirEntry = nullptr;
 
-    auto res = walkDir(QFile::encodeName(path), countHiddenFiles, countDirectoriesOnly, dirEntry, maxRecursiveLevel);
+    auto res = walkDir(path, countHiddenFiles, countDirectoriesOnly, dirEntry, maxRecursiveLevel);
 
     return res;
 #endif
@@ -131,5 +119,5 @@ KDirectoryContentsCounterWorker::CountResult KDirectoryContentsCounterWorker::su
 void KDirectoryContentsCounterWorker::countDirectoryContents(const QString& path, Options options)
 {
     auto res = subItemsCount(path, options);
-    emit result(path, res.count, res.size);
+    Q_EMIT result(path, res.count, res.size);
 }