Commit 1ad5a37b authored by Méven Car's avatar Méven Car

Do not display a buggy filesize for non local files

Summary:
When displaying a virtual folder or remote drive the folder size in the information panel is wrong.
The subDirectoriesCount function supports only local files.
It creates a bug where when a url such as recentdocuments:/ is displayed in dolphin, the count reflected in the size field is in fact the count of its path meaning the number of files in the root folder /.

Test Plan: Manual

Reviewers: #dolphin, ngraham, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: #baloo

Tags: #baloo

Differential Revision: https://phabricator.kde.org/D22529
parent cef2c6ea
......@@ -164,12 +164,17 @@ void FileMetaDataProvider::insertSingleFileBasicData()
const KFileItem& item = m_fileItems.first();
if (item.isDir()) {
const int count = subDirectoriesCount(item.url().path());
if (count == -1) {
bool isSizeUnknown = !item.isLocalFile();
if (!isSizeUnknown) {
const int count = subDirectoriesCount(item.url().path());
isSizeUnknown = count == -1;
if (!isSizeUnknown) {
const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count);
m_data.insert(QStringLiteral("kfileitem#size"), itemCountString);
}
}
if (isSizeUnknown) {
m_data.insert(QStringLiteral("kfileitem#size"), i18nc("unknown file size", "Unknown"));
} else {
const QString itemCountString = i18ncp("@item:intable", "%1 item", "%1 items", count);
m_data.insert(QStringLiteral("kfileitem#size"), itemCountString);
}
} else {
KFormat format;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment