bruns requested changes to this revision.
bruns added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> app.cpp:147
>  {
> -    QString mimetype = m_mimeDb.mimeTypeForFile(url, 
> QMimeDatabase::MatchContent).name();
> +    QMimeType extensionMimeType = m_mimeDb.mimeTypeForFile(url, 
> QMimeDatabase::MatchExtension);
> +    QMimeType contentMimeType = m_mimeDb.mimeTypeForFile(url, 
> QMimeDatabase::MatchContent);

This only works correctly when the actual mimetype is the preferred one for 
this extension. See
https://doc.qt.io/qt-5/qmimedatabase.html#mimeTypesForFileName

Mismatching file (should be graphviz):

  $> cat test.dot
  
  # some comment
  graph {}

> app.cpp:154
> +        mimetype = contentMimeType.name();
> +    }
>      qCDebug(BALOO) << "Indexing" << id << url << mimetype;

This should be a standalone function, to reuse it in e.g. the baloo-widgets 
temp extractor

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D20011

To: astippich, #baloo, bruns
Cc: kde-frameworks-devel, gennad, domson, ashaposhnikov, michaelh, astippich, 
spoorun, ngraham, bruns, abrahams

Reply via email to