From kde-core-devel Wed May 07 02:41:00 2008 From: Vlad Date: Wed, 07 May 2008 02:41:00 +0000 To: kde-core-devel Subject: Re: Questions on the new KIO::FileJob API Message-Id: <8933.47497.qm () web54401 ! mail ! yahoo ! com> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=121012812018326 Hi, --- nf2 wrote: > 1) - Creating Files: Apparently FileJob in kio_file doesn't allow > creating files. I think this bug is fixed by adding O_CREAT whenever the user requests QIODevice::WriteOnly. If the file already exists, O_CREAT does nothing, so it shouldn't hurt. I hope to commit this fix soon: http://lists.kde.org/?l=kde-core-devel&m=121012416913922&w=2 > 2) - Reading Files: From reading the code in kio_file i'm not sure > whether data() is supposed to emit all the requested data in a > single > callback Yes, one data() should emit all the requested data, unless the slave reaches EOF, in which case it returns all the data up to the EOF. > as the client might try to call > seek() > before read() is finished. Once you call FileJob::read(), you're supposed to _wait_ until the data() slot from that read() request has been served before making another request to the FileJob (ie. calling another FileJob::seek(), FileJob::write(), etc). KioFuseApp::seekReadMainThread() in kiofuseapp.cpp does this: http://websvn.kde.org/trunk/playground/libs/kiofuse/ Also, KIO is not threadsafe, so a FileJob can only be used by the thread that it was created in. > **) I wonder if there could be a "timeout" parameter for read() and > write(). GIO, for instance, seems to allow cancellation of > read()/write() operations. That would be nice, but AFAIK apps that use KIO can't specify a timeout value. However, the slave can have its own internal timer and issue an error() if it detects that an operation is taking too long. > > 3) - Open ReadWrite doesn't seem to be implemented in kio_file I think this is fixed by the series of patches referenced above. Thanks, Vlad ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ