KFilterDev changes from KDE3

David Faure faure at kde.org
Mon Mar 16 20:23:25 GMT 2009

On Sunday 15 March 2009, Martin Koller wrote:
> The problem ist, the constructor taking the KFilterBase is now private!

Yes, KFilterBase itself is no longer part of the public API [except when writing
a new filter].
It was a messy API of mine, with rather confusing ownership semantics
for the KFilterBase instance, which is now fully handled by KFilterDev and hidden
into it.

> So my question: How do I set the KFilterBase here ?

Forget about setting a KFilterBase :-)

> The only way coming close to what I need is the method,
> but this needs the mimetype again.
> static QIODevice *   device (QIODevice *inDevice, const QString &mimetype, bool autoDeleteInDevice=true)

Yes, this is the one you want.
Why is it a problem that it "needs the mimetype"? You said the kde3 code uses
KFilterBase::findFilterByMimeType() so surely it knows the mimetype.
Instead of keeping a filterbase around until the KFilterDev creation,
just keep around the mimetype and call the above method. I.e. port

    KFilterDev filter(filterBase, false);


    QIODevice* filter = KFilterDev::device(&comprFile, mimeType, false);
    delete filter;

David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list