From kde-devel Fri Nov 26 19:07:02 2004 From: Jakub Stachowski Date: Fri, 26 Nov 2004 19:07:02 +0000 To: kde-devel Subject: Re: DNS based service discovery Message-Id: <200411262007.03640.stachowski () hypair ! net> X-MARC-Message: https://marc.info/?l=kde-devel&m=110149605830285 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_X73pBRaN1IZS7NS" --Boundary-00=_X73pBRaN1IZS7NS Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Dnia czwartek, 28 pa=BCdziernika 2004 21:50, David Faure napisa=B3: > On Thursday 28 October 2004 21:38, Jakub Stachowski wrote: > > Dnia czwartek, 28 pa=BCdziernika 2004 17:57, David Faure napisa=B3: > > > > Is there any way to check what directories are "in use" (opened in > > > > file dialog or in konqueror) ? > > > > > > Not currently. But a kded module could keep track of that, maybe. > > > > Yes. Maybe KDirLister could emit dcop signals like enteredDirectory(KUR= L) > > and leftDirectory(KURL). Then kded module could listen to that and know > > what to keep track of. > > Yes, good idea. > This patch will be ok? --Boundary-00=_X73pBRaN1IZS7NS Content-Type: text/x-diff; charset="iso-8859-2"; name="sig.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sig.patch" --- kio/kdirlister_p.h 2004-11-26 19:49:46.000000000 +0100 +++ kio-new/kdirlister_p.h 2004-11-26 19:51:13.000000000 +0100 @@ -30,6 +30,7 @@ #include #include #include +#include class QTimer; class KDirLister; @@ -229,12 +230,26 @@ ~DirItem() { - if ( autoUpdates && KDirWatch::exists() ) - kdirwatch->removeDir( url.path() ); - + if ( autoUpdates) + { + if ( KDirWatch::exists() ) + kdirwatch->removeDir( url.path() ); + sendSignal(false, url ); + } delete rootItem; delete lstItems; } + + void sendSignal(bool entering,const KURL& url) + { + DCOPClient* client = DCOPClient::mainClient(); + if (!client) + return; + QByteArray data; + QDataStream arg( data, IO_WriteOnly ); + arg << url; + client->emitDCOPSignal("KDirNotify", entering ? "enteredDirectory(KURL)" : "leftDirectory(KURL)", data ); + } void redirect( const KURL& newUrl ) { @@ -242,9 +257,11 @@ { if ( url.isLocalFile() ) kdirwatch->removeDir( url.path() ); + sendSignal(false, url ); if ( newUrl.isLocalFile() ) kdirwatch->addDir( newUrl.path() ); + sendSignal(true, url ); } url = newUrl; @@ -255,14 +272,23 @@ void incAutoUpdate() { - if ( autoUpdates++ == 0 && url.isLocalFile() ) - kdirwatch->addDir( url.path() ); + if ( autoUpdates++ == 0) + { + if ( url.isLocalFile() ) + kdirwatch->addDir( url.path() ); + sendSignal(true, url ); + } } void decAutoUpdate() { - if ( --autoUpdates == 0 && url.isLocalFile() ) - kdirwatch->removeDir( url.path() ); + if ( --autoUpdates == 0 ) + { + if ( url.isLocalFile() ) + kdirwatch->removeDir( url.path() ); + sendSignal(false, url ); + } + else if ( autoUpdates < 0 ) autoUpdates = 0; } --Boundary-00=_X73pBRaN1IZS7NS Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Boundary-00=_X73pBRaN1IZS7NS--