diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ project(baloo-widgets VERSION ${KDE_APPLICATIONS_VERSION}) set(QT_MIN_VERSION "5.8.0") -set(KF5_MIN_VERSION "5.57.0") +set(KF5_MIN_VERSION "5.58.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH}) diff --git a/src/propertymaputil_p.h b/src/propertymaputil_p.h --- a/src/propertymaputil_p.h +++ b/src/propertymaputil_p.h @@ -23,15 +23,23 @@ /** * Converts the property map into a variant map - * using the property name as key. + * using the property name as key. Converts maps + * with duplicated keys into single entry maps + * with lists. */ static inline QVariantMap toNamedVariantMap(const KFileMetaData::PropertyMap& propMap) { QVariantMap map; - KFileMetaData::PropertyMap::const_iterator it = propMap.constBegin(); - for (; it != propMap.constEnd(); it++) { - KFileMetaData::PropertyInfo pi(it.key()); - map.insertMulti(pi.name(), it.value()); + + const auto uniqueKeys = propMap.uniqueKeys(); + for (const auto& key : uniqueKeys) + { + KFileMetaData::PropertyInfo pi(key); + if (propMap.count(key) > 1) { + map.insert(pi.name(), propMap.values(key)); + } else { + map.insert(pi.name(), propMap.value(key)); + } } return map;