Hi,

I'm playing with the code, and I find something strange. I'm trying to get the 
type of the file in the current editor (header or source).
If I'm on a header file, and call the function file()->mimetype() in CPPEditor, 
it returns the string text/x-c++src.
I would have expected text/x-c++hdr.

If I do something like this:
    Core::ICore *core = Core::ICore::instance();
    QFileInfo fi(file()->fileName());
    const Core::MimeDatabase *mimeDatase = core->mimeDatabase();
    const Core::MimeType mimeType = mimeDatase->findByFile(fi);
    const QString typeName = mimeType.type();
    if (typeName == QLatin1String(CppTools::Constants::C_HEADER_MIMETYPE) ||
        typeName == QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))
it's working.

Is it a bug?
What is the best way to know if a file open in an editor is a header or a 
source?

Thanks,
Nicolas

-- 
Nicolas Arnaud-Cormos | [email protected] | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions

_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-creator

Reply via email to