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

List:       kde-core-devel
Subject:    Re: KFilterDev changes from KDE3
From:       David Faure <faure () kde ! org>
Date:       2009-03-16 20:23:25
Message-ID: 200903162123.26550.faure () kde ! org
[Download RAW message or body]

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

    filterBase->setDevice(&comprFile);
    KFilterDev filter(filterBase, false);
    filter.open(IO_WriteOnly);

to

    QIODevice* filter = KFilterDev::device(&comprFile, mimeType, false);
    filter->open(IO_WriteOnly);
    [...]
    delete filter;

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


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

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