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

List:       kde-devel
Subject:    Re: Synchronous KIO
From:       Charles Samuels <charles () kde ! org>
Date:       2002-04-26 23:43:20
[Download RAW message or body]

fredag 26 april 2002, 03:15 pm, skrev Jay Cornwall:
> Hi
>
> Is there a way to synchronously request a directory listing from a
> kioslave, in a similar way to the methods that KIO::NetAccess provides?
>
> I ask, because my program needs to check the contents of a directory when
> the user selects a menu item (it's a bit more complicated than that, but
> that's the general idea).
>
> KIO::listDir() suggests an asynchronous slot-based system, but this is
> difficult to fit into my program design. I'd have to start the request,
> leave my slot (which is called when the menu item is selected), somehow
> stop the user from issuing further GUI requests until the listDir() is
> complete, and finish the request in a different slot.
>
> It would be easier if I could just start the request and wait for
> completion in the menu slot (there isn't a lot else my program can do in
> the mean time). Any ideas how I might implement this?

You could call processEvents() until KIO is done.  It just screams HACK, 
however :)

Like...

void slotMakeMenu()
{
	KIO::listDir foo; ....
	while (!doneListing) { kapp->processEvents(); }

	QPopupMenu ....
}

void kioDoneListing()
{
	doneListing=true;
}

I have a synchronous KIO API, however, it's incomplete, and I havn't worked on 
it much, as there's not an overwhelming demand for it.  In any case -- 
excessive for what you want to do.

For everyone else (particularly the KIO people)..  If I were to (at last) 
finish synchronous KIO, would there by any objections to integrating it into 
kdelibs, and even potentially reimplementing the current asynchronous API 
with the synchronous one, thereby reducing bloat, and possibly reducing bugs 
as well ?

-Charles

-- 
Charles Samuels <charles@kde.org>
John Ashcroft's Great!  He made the trains run on time!

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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