D20011: Be more precise with mimetype detection

Stefan BrĂ¼ns noreply at phabricator.kde.org
Mon Mar 25 13:59:12 GMT 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190325/3627f953/attachment.html>


More information about the Kde-frameworks-devel mailing list