[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Problems with mimetype recognition
From: Andras Mantia <amantia () kde ! org>
Date: 2003-10-01 20:39:30
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday 01 October 2003 23:18, David Faure wrote:
> On Wednesday 01 October 2003 22:04, Andras Mantia wrote:
> > I use findByURL() in my code, but it returns application/x-php and from
this I
> > can't figure out that it's a text file or not (well, I can if I have a
list
> > of text mimetypes...) This was the reason why the [X-KDE-Text] and
> > findFormatByFileContent() was introduced. And this
findFormatByFileContent()
> > fails, because it doesn't use findByURL(). I think I will add the
findByURL()
> > call also there altough in this case findFormatByFileContent() doesn't
look
> > for format by content in every case. ;-)
>
> I'm not following. findByURL returns a KMimeType::Ptr, which you can query
> for the X-KDE-Text property.
Ok, I will try to explain again:
- - I have a function, which checks if a file belongs to a specified mime group
or not (like text/*, image/* and so). In case of text files it's very common
that there are mimetypes for text files that are not under text/*. So this
function uses first findByURL and if it's checking for text files and
findByURL returned a non-text mimetype it uses findFormatByFileContent()
- - some time in the past I brought up the above issue and the result of that
discussion was the introduction of the X-KDE-Text property and of the
KMimeType::findFormatByFileContent() by Waldo
- - now it turned out that there is some bug, because
KMimeType::findFormatByFileContent() fails to detect that some PHP files are
text, because it uses findByFileContent(). I don't know what was Waldo's
reason of using that instead of findByURL().
The conculsion is that in seems that KMimeType::findFormatByFileContent()
should use findByURL() before/instead of findByFileContent().
Is it more clear now? I just suspected a bug in KMimeType, but wasn't sure
where it is. Now it looks like its in KMimeType::findFormatByFileContent().
Andras
>
> --
> David Faure -- faure@kde.org, dfaure@klaralvdalens-datakonsult.se
> Qt/KDE/KOffice developer
> Klarälvdalens Datakonsult AB, Platform-independent software solutions
>
>
>
>
>
>
- --
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE/ezuCTQdfac6L/08RAkkzAKDHaeujrjkZmYlaxuHS6ZePYnkpJgCeJqma
loaPOlUKB0wmorEZgQmJqlY=
=dxL6
-----END PGP SIGNATURE-----
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic