Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* This file is part of the KDE project |
---|---|
2 | * |
3 | * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl> |
4 | * |
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. |
9 | * |
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. |
14 | * |
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. |
19 | */ |
20 | |
21 | #include "mdnsd-servicetypebrowser_p.h" |
22 | #include "servicetypebrowser.h" |
23 | #include "servicebrowser.h" |
24 | |
25 | namespace DNSSD |
26 | { |
27 | |
28 | ServiceTypeBrowser::ServiceTypeBrowser(const QString& domain,QObject *parent) : QObject(parent),d(new ServiceTypeBrowserPrivate(this)) |
29 | { |
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())); |
34 | } |
35 | |
36 | ServiceTypeBrowser::~ServiceTypeBrowser() |
37 | { |
38 | delete d; |
39 | } |
40 | |
41 | QStringList ServiceTypeBrowser::serviceTypes() const |
42 | { |
43 | return d->m_servicetypes; |
44 | } |
45 | |
46 | |
47 | void ServiceTypeBrowser::startBrowse() |
48 | { |
49 | d->m_browser->startBrowse(); |
50 | } |
51 | |
52 | //@todo: remove on Monday |
53 | #ifndef KDE_NO_DEPRECATED |
54 | bool ServiceTypeBrowser::isRunning() const |
55 | { |
56 | return false; |
57 | } |
58 | #endif |
59 | |
60 | void ServiceTypeBrowserPrivate::newService(DNSSD::RemoteService::Ptr srv) |
61 | { |
62 | QString type=srv->serviceName()+ |
63 | m_servicetypes+=type; |
64 | emit m_parent->serviceTypeAdded(type); |
65 | } |
66 | |
67 | void ServiceTypeBrowserPrivate::removeService(DNSSD::RemoteService::Ptr srv) |
68 | { |
69 | QString type=srv->serviceName()+ |
70 | m_servicetypes.removeAll(type); |
71 | emit m_parent->serviceTypeRemoved(type); |
72 | } |
73 | |
74 | |
75 | } |
76 | |
77 | |
78 | |
79 | #include "servicetypebrowser.moc" |
80 | #include "mdnsd-servicetypebrowser_p.moc" |
81 |
Warning: That file was not part of the compilation database. It may have many parsing errors.