[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: DNS based service discovery
From: Jakub Stachowski <stachowski () hypair ! net>
Date: 2004-11-26 19:07:02
Message-ID: 200411262007.03640.stachowski () hypair ! net
[Download RAW message or body]
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?
["sig.patch" (text/x-diff)]
--- 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 <kurl.h>
#include <kio/global.h>
#include <kdirwatch.h>
+#include <dcopclient.h>
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;
}
>> 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