D10105: baloo-widgets: Refactor filemetadataprovider for better readability
Michael Heidelbach
noreply at phabricator.kde.org
Sat Jan 27 18:00:49 GMT 2018
michaelh marked 4 inline comments as done.
michaelh added inline comments.
INLINE COMMENTS
> filemetadataprovider.cpp:141
> }
> - else {
> - //
> - // Only report the stuff that is common to all the files
> - //
> - QSet<QString> allProperties;
> - QList<QVariantMap> propertyList;
> - foreach (const QVariantMap& fileData, files) {
> - propertyList << fileData;
> - allProperties.unite(fileData.uniqueKeys().toSet());
> - }
> -
> - // Special handling for certain properties
> - totalPropertyAndInsert("duration", propertyList, allProperties);
> - totalPropertyAndInsert("characterCount", propertyList, allProperties);
> - totalPropertyAndInsert("wordCount", propertyList, allProperties);
> - totalPropertyAndInsert("lineCount", propertyList, allProperties);
> -
> - foreach (const QString& propUri, allProperties) {
> - foreach (const QVariantMap& map, propertyList) {
> - QVariantMap::const_iterator it = map.find( propUri );
> - if( it == map.constEnd() ) {
> - m_data.remove( propUri );
> - break;
> - }
> - else {
> - QVariantMap::iterator dit = m_data.find( it.key() );
> - if( dit == m_data.end() ) {
> - m_data.insert( propUri, it.value() );
> - }
> - else {
> - QVariant finalValue = intersect( it.value(), dit.value() );
> - if( finalValue.isValid() )
> - m_data[propUri] = finalValue;
> - else {
> - m_data.remove( propUri );
> - break;
> - }
> - }
> - }
> - }
> - }
> +
> + if (files.size() > 1) {
We can leave early here, I think.
Without a file
149 insertEditableData()
does not make much sense.
REPOSITORY
R824 Baloo Widgets
REVISION DETAIL
https://phabricator.kde.org/D10105
To: michaelh, elvisangelaccio, ngraham, vhanda, smithjd, #dolphin, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180127/a80114ea/attachment.htm>
More information about the kfm-devel
mailing list