diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION}) set(QT_MIN_VERSION "5.8.0") -set(KF5_MIN_VERSION "5.56.0") +set(KF5_MIN_VERSION "5.58.0") # ECM setup find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -56,18 +56,34 @@ { QHash values; - QMapIterator it(file.properties()); - while (it.hasNext()) { - it.next(); + using entry = std::pair; + + const auto& propMap = file.properties(); + auto rangeBegin = propMap.constKeyValueBegin(); + + while (rangeBegin != propMap.constKeyValueEnd()) { + auto key = (*rangeBegin).first; + const KFileMetaData::PropertyInfo propertyInfo(key); + const QByteArray role = roleForProperty(propertyInfo.name()); + + auto rangeEnd = std::find_if(rangeBegin, propMap.constKeyValueEnd(), + [key](const entry& e) { return e.first != key; }); - const KFileMetaData::PropertyInfo pi(it.key()); - const QString property = pi.name(); - const QByteArray role = roleForProperty(property); if (role.isEmpty() || !roles.contains(role)) { + rangeBegin = rangeEnd; continue; } - values.insert(role, pi.formatAsDisplayString(it.value())); + auto distance = std::distance(rangeBegin, rangeEnd); + if (distance > 1) { + QVariantList list; + list.reserve(static_cast(distance)); + std::for_each(rangeBegin, rangeEnd, [&list](const entry& s) { list.append(s.second); }); + values.insert(role, propertyInfo.formatAsDisplayString(list)); + } else { + values.insert(role, propertyInfo.formatAsDisplayString((*rangeBegin).second)); + } + rangeBegin = rangeEnd; } KFileMetaData::UserMetaData md(file.path());