Dummy implementation in RemoteView for scaleResize, so there will be no 'slot not...
[kdenetwork.git] / kdnssd / kdedmodule / watcher.cpp
blob6c3fe21f0f9c1c8b081ddb1db791182f8a6c04be
1 /* This file is part of the KDE Project
2 Copyright (c) 2004 Jakub Stachowski <qbast@go2.pl>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include "watcher.h"
21 #include <kdirnotify.h>
22 #include <dnssd/remoteservice.h>
23 #include <dnssd/servicebrowser.h>
24 #include <dnssd/servicetypebrowser.h>
26 Watcher::Watcher()
27 : refcount(1), updateNeeded(false)
31 ServiceWatcher::ServiceWatcher(const QString& type) : Watcher(), m_type(type)
33 browser = new DNSSD::ServiceBrowser(type);
34 browser->setParent(this);
35 connect(browser,SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)),
36 SLOT(scheduleUpdate()));
37 connect(browser,SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)),
38 SLOT(scheduleUpdate()));
39 connect(browser,SIGNAL(finished()),SLOT(finished()));
40 browser->startBrowse();
44 TypeWatcher::TypeWatcher() : Watcher()
46 typebrowser = new DNSSD::ServiceTypeBrowser();
47 typebrowser->setParent(this);
48 connect(typebrowser,SIGNAL(serviceTypeAdded(const QString&)),
49 this,SLOT(scheduleUpdate()));
50 connect(typebrowser,SIGNAL(serviceTypeRemoved(const QString&)),
51 this,SLOT(scheduleUpdate()));
52 connect(typebrowser,SIGNAL(finished()),this,SLOT(finished()));
53 typebrowser->startBrowse();
56 QString TypeWatcher::constructUrl()
58 return QString("zeroconf:/");
61 QString ServiceWatcher::constructUrl()
63 return QString("zeroconf:/")+m_type+'/';
66 void Watcher::scheduleUpdate()
68 updateNeeded=true;
71 void Watcher::finished()
73 if (updateNeeded) org::kde::KDirNotify::emitFilesAdded( constructUrl() );
74 updateNeeded=false;
77 #include "watcher.moc"