Commit 44c4f46b authored by Méven Car's avatar Méven Car

FileMetaDataWidget: Avoid showing fields when they have no value

Summary:
When displaying remote:/ recentlyused:/, Search:/ or and Tags:/, the information panel shows modifications time, access time and size with empty field value.
This patches avoids displaying those fields when we have no value for them.

CCBUG: 413091
More precisely https://bugs.kde.org/show_bug.cgi?id=413091#c7

Test Plan:
Open remote:/ in Dolphin:
Size, Access and modification dates fields are not visible

Reviewers: #dolphin, ngraham, bruns

Reviewed By: #dolphin, ngraham, bruns

Subscribers: #baloo

Tags: #baloo

Differential Revision: https://phabricator.kde.org/D28972
parent 50fdd3e1
......@@ -172,30 +172,34 @@ void FileMetaDataProvider::insertSingleFileBasicData()
}
}
else if (item.entry().contains(KIO::UDSEntry::UDS_SIZE)) {
isSizeUnknown = false;
m_data.insert(QStringLiteral("kfileitem#size"), format.formatByteSize(item.size()));
}
if (item.entry().contains(KIO::UDSEntry::UDS_RECURSIVE_SIZE)) {
isSizeUnknown = false;
m_data.insert(QStringLiteral("kfileitem#totalSize"), format.formatByteSize(item.recursiveSize()));
}
if (isSizeUnknown) {
m_data.insert(QStringLiteral("kfileitem#size"), i18nc("unknown file size", "Unknown"));
}
} else {
m_data.insert(QStringLiteral("kfileitem#size"), format.formatByteSize(item.size()));
if (item.entry().contains(KIO::UDSEntry::UDS_SIZE)) {
m_data.insert(QStringLiteral("kfileitem#size"), format.formatByteSize(item.size()));
}
}
m_data.insert(QStringLiteral("kfileitem#type"), item.mimeComment());
if (item.isLink()) {
m_data.insert(QStringLiteral("kfileitem#linkDest"), item.linkDest());
}
m_data.insert(QStringLiteral("kfileitem#modified"), item.time(KFileItem::ModificationTime));
QDateTime modificationTime = item.time(KFileItem::ModificationTime);
if (modificationTime.isValid()) {
m_data.insert(QStringLiteral("kfileitem#modified"), modificationTime);
}
QDateTime creationTime = item.time(KFileItem::CreationTime);
if (creationTime.isValid()) {
m_data.insert(QStringLiteral("kfileitem#created"), creationTime);
}
m_data.insert(QStringLiteral("kfileitem#accessed"), item.time(KFileItem::AccessTime));
QDateTime accessTime = item.time(KFileItem::AccessTime);
if (accessTime.isValid()) {
m_data.insert(QStringLiteral("kfileitem#accessed"), accessTime);
}
m_data.insert(QStringLiteral("kfileitem#owner"), item.user());
m_data.insert(QStringLiteral("kfileitem#group"), item.group());
m_data.insert(QStringLiteral("kfileitem#permissions"), item.permissionsString());
......
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