summaryrefslogtreecommitdiff
path: root/user/baloo-widgets/revert.patch
blob: cc54adf6fd5cdc32d61707fc4d89aa5bdcf6d672 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- baloo-widgets-19.08.0/src/filemetadatautil.cpp.old	2019-08-09 00:09:30.000000000 +0000
+++ baloo-widgets-19.08.0/src/filemetadatautil.cpp	2019-08-15 15:31:58.938750148 +0000
@@ -58,30 +58,10 @@
 QVariantMap toNamedVariantMap(const KFileMetaData::PropertyMap& propMap)
 {
     QVariantMap map;
-    if (propMap.isEmpty()) {
-        return map;
-    }
-
-    using entry = std::pair<const KFileMetaData::Property::Property&, const QVariant&>;
-
-    auto begin = propMap.constKeyValueBegin();
-
-    while (begin != propMap.constKeyValueEnd()) {
-        auto key = (*begin).first;
-        KFileMetaData::PropertyInfo property(key);
-        auto rangeEnd = std::find_if(begin, propMap.constKeyValueEnd(),
-            [key](const entry& e) { return e.first != key; });
-
-        auto distance = std::distance(begin, rangeEnd);
-        if (distance > 1) {
-            QVariantList list;
-            list.reserve(static_cast<int>(distance));
-            std::for_each(begin, rangeEnd, [&list](const entry& s) { list.append(s.second); });
-            map.insert(property.name(), list);
-        } else {
-            map.insert(property.name(), (*begin).second);
-        }
-        begin = rangeEnd;
+    KFileMetaData::PropertyMap::const_iterator it = propMap.constBegin();
+    for (; it != propMap.constEnd(); it++) {
+        KFileMetaData::PropertyInfo pi(it.key());
+        map.insertMulti(pi.name(), it.value());
     }
 
     return map;