[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: get all MIME types
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-04-24 22:39:26
[Download RAW message or body]

On Tue, Apr 25, 2000 at 12:24:21AM +0200, Daniel Naber wrote:
> On Mon, 24 Apr 2000, David Faure wrote:
> 
> > Out of interest, why do you want all mimetypes ?
> 
> KMail guesses the mime type of any file you attach (via KMimeMagic). Since 
> it's often wrong I want to have a  combo box with all the alternatives.
> 
> BTW, KMimeMagic is often wrong because I attach short diffs, which leads to
> text/x-c, test/x-c++ or even text/c-java (all for C++ diffs). Maybe we can 
> change KMimeMagic so it uses the file's extension if there is any (at least 
> optionally). Opinions?

KMimeType::findByURL uses extensions and when that fails, uses KMimeMagic
as a fallback.
But since those are attachments, you can't use KMimeType::findByURL I guess
(unless you put them in /tmp first ?)
In any case, please don't change KMimeMagic, since usually finding by
extension happens first. What you could do though, would be something
similar to what KMimeType::findByURL does (i.e. uses KSycoca's fast
lookup-from-extension method) :
KMimeType * mime = KServiceTypeFactory::self()->findFromPattern( fileName );

HTH.
David.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic