fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / dnssd / mdnsd-servicetypebrowser.cpp
blob6e963d3abfb9ab3e3a411ebe8c1a052f8db6cc33
1 /* This file is part of the KDE project
3 * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #include "mdnsd-servicetypebrowser_p.h"
22 #include "servicetypebrowser.h"
23 #include "servicebrowser.h"
25 namespace DNSSD
28 ServiceTypeBrowser::ServiceTypeBrowser(const QString& domain,QObject *parent) : QObject(parent),d(new ServiceTypeBrowserPrivate(this))
30 d->m_browser=new ServiceBrowser("_services._dns-sd._udp",false, domain);
31 connect(d->m_browser,SIGNAL(serviceAdded(DNSSD::RemoteService::Ptr)), d, SLOT(newService(DNSSD::RemoteService::Ptr)));
32 connect(d->m_browser,SIGNAL(serviceRemoved(DNSSD::RemoteService::Ptr)), d, SLOT(removeService(DNSSD::RemoteService::Ptr)));
33 connect(d->m_browser,SIGNAL(finished()), this, SIGNAL(finished()));
36 ServiceTypeBrowser::~ServiceTypeBrowser()
38 delete d;
41 QStringList ServiceTypeBrowser::serviceTypes() const
43 return d->m_servicetypes;
47 void ServiceTypeBrowser::startBrowse()
49 d->m_browser->startBrowse();
52 //@todo: remove on Monday
53 bool ServiceTypeBrowser::isRunning() const
55 return false;
58 void ServiceTypeBrowserPrivate::newService(DNSSD::RemoteService::Ptr srv)
60 QString type=srv->serviceName()+'.'+srv->type();
61 m_servicetypes+=type;
62 emit m_parent->serviceTypeAdded(type);
65 void ServiceTypeBrowserPrivate::removeService(DNSSD::RemoteService::Ptr srv)
67 QString type=srv->serviceName()+'.'+srv->type();
68 m_servicetypes.removeAll(type);
69 emit m_parent->serviceTypeRemoved(type);
77 #include "servicetypebrowser.moc"
78 #include "mdnsd-servicetypebrowser_p.moc"