Calligra 3.0 for Qt 5.1?
Jos van den Oever
jos.van.den.oever at kogmbh.com
Tue Jul 30 13:39:21 BST 2013
On 07/30/13 13:23, Boudewijn Rempt wrote:
> On Tue, 30 Jul 2013, Jos van den Oever wrote:
>
>> The KIODevice : public QIODevice would have to have an async
>> implementation like QTcpSocket and QProcess. No rocket science, but
>> something to keep in mind. waitForReadyRead() and
>> waitForBytesWritten() would be needed to block until KIO::FileJob
>> gives back data.
>
> For calligra, I think that sychronous would be quite okay -- and I think
> that even just using local files would be quite okay. In fact, I am sure
> that there quite a few places where non-local KIO file handling was broken.
The point was the most of KIO is not synchronous, so a wrapper
necessarily is not either.
>
>>
>> Perhaps KF already has an adaptor that returns a QIODevice from a
>> KIO::FileJob.
>>
>> Do we need more KIO than simply
>> FileJob *KIO::open(const KUrl &url, QIODevice::OpenMode mode)
>> ?
>>
>
> Well, we use KIO in 218 places in 93 files --
>
> KIO::NetAccess::del
> KIO::move
> KIO::NetAccess::synchronousRun
> KIO::move
> KIO::storedHttpPost
> KIO::copy
> KIO::NetAccess::download
> KIO::NetAccess::exists
> KIO::NetAccess::stat
> KIO::NetAccess::removeTempFile
> KIO::NetAccess::upload
> KIO::file_copy
> KIO::filePreview
> KIO::PreviewJob::availablePlugins()
> KIO::storedGet
> KIO::moveAs
>
> Seems to be the sum of the KIO api we use -- plus what's hidden inside
> KFileDialog and so on.
And KIO::open is not in that list. Amazing :-)
Calligra uses storedGet instead. Actually a combination of
NetAccess::download and QFile is probably the best way to open files in
Calligra. The fallback to just QFile is then easy.
$ egrep 'KIO::(:|\w)+\(' -rohI .|sort|uniq -c
1 KIO::convertSize(
1 KIO::copy(
4 KIO::del(
3 KIO::file_copy(
4 KIO::filePreview(
1 KIO::get(
1 KIO::JobUiDelegate::askFileRename(
7 KIO::move(
1 KIO::moveAs(
7 KIO::NetAccess::del(
2 KIO::NetAccess::dircopy(
15 KIO::NetAccess::download(
28 KIO::NetAccess::exists(
1 KIO::NetAccess::lastErrorString(
16 KIO::NetAccess::removeTempFile(
2 KIO::NetAccess::stat(
7 KIO::NetAccess::synchronousRun(
6 KIO::NetAccess::upload(
1 KIO::pixmapForUrl(
2 KIO::PreviewJob::availablePlugins(
8 KIO::storedGet(
3 KIO::storedHttpPost(
1 KIO::storedPut(
The most complex calls in here are the ones getting a pixmap, but that
can be implemented by getting the embedded thumbnail or returning the
mimetype icon.
I'm in favor of wrapping all and switching between KIO or Qt with
compile switch or putting KIO functionality in a loadable module. The
latter would allow people to install Calligra and install optional
Plasma Desktop integration.
Cheers,
Jos
More information about the calligra-devel
mailing list