Add PropertyMap to QVariantMap conversion function using names
AbandonedPublic

Authored by astippich on Feb 17 2019, 7:21 PM.

Details

Reviewers
bruns
ngraham
Summary

Add a conversion function from a
PropertyMap to a VariantMap using the property name.
Will be used by baloo-widgets.
Depends on D19097

Diff Detail

Repository
R286 KFileMetaData
Branch
named_map_conversion
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8442
Build 8460: arc lint + arc unit
astippich created this revision.Feb 17 2019, 7:21 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptFeb 17 2019, 7:21 PM
Restricted Application added subscribers: Baloo, kde-frameworks-devel. · View Herald Transcript
astippich requested review of this revision.Feb 17 2019, 7:21 PM
bruns added a comment.Feb 18 2019, 4:45 PM

Why would we want to use a QVariantMap in baloo-widgets, and not a KFM::PropertyMap?

It already does at two different places, because it fuses different information into a single QMap later on (xattr, file size etc...)
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/extractor.cpp$65
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/filefetchjob.cpp$62
I would like to consolidate the two different implementations of the conversion functions. I think it is also useful for debugging purposes, e.g. dumping a property map to cmd line.

It already does at two different places, because it fuses different information into a single QMap later on (xattr, file size etc...)
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/extractor.cpp$65
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/filefetchjob.cpp$62

This can be done by using a KFM::PropertyMap directly, and adding property types for the UserMetaData (tags, comment, rating). Note, the strings returned by PropertyInfo::name() are not shared ...

I would like to consolidate the two different implementations of the conversion functions. I think it is also useful for debugging purposes, e.g. dumping a property map to cmd line.

The latter can be achieved by making KFM::Property known to QDebug.

It already does at two different places, because it fuses different information into a single QMap later on (xattr, file size etc...)
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/extractor.cpp$65
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/filefetchjob.cpp$62

This can be done by using a KFM::PropertyMap directly, and adding property types for the UserMetaData (tags, comment, rating). Note, the strings returned by PropertyInfo::name() are not shared ...

It is not only xattr, also everything from kfileitems{group,size,owner...}. Adding these as property with no users in KFileMetaData does not seem clean.
Also, you would have to construct the properties from the name. Why not use the names directly then? Changing everything to a PropertyMap requires a rewrite of large parts, and I certainly will not rewrite baloo-widgets right now.
This is just for a small cleanup.

bruns added a comment.Feb 21 2019, 6:53 PM

It already does at two different places, because it fuses different information into a single QMap later on (xattr, file size etc...)
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/extractor.cpp$65
https://phabricator.kde.org/source/baloo-widgets/browse/master/src/filefetchjob.cpp$62

This can be done by using a KFM::PropertyMap directly, and adding property types for the UserMetaData (tags, comment, rating). Note, the strings returned by PropertyInfo::name() are not shared ...

It is not only xattr, also everything from kfileitems{group,size,owner...}. Adding these as property with no users in KFileMetaData does not seem clean.
Also, you would have to construct the properties from the name. Why not use the names directly then? Changing everything to a PropertyMap requires a rewrite of large parts, and I certainly will not rewrite baloo-widgets right now.
This is just for a small cleanup.

It is also not clean to expose an interface in KFileMetaData which is only used by baloo-widgets, and internal to baloo-widgets. If you want to consolidate the implementations, combine the two implementations inside baloo-widgets.

astippich abandoned this revision.Mar 10 2019, 2:22 PM