dnssd Library API Documentation

servicebrowser.h

00001 /* This file is part of the KDE project
00002  *
00003  * Copyright (C) 2004 Jakub Stachowski <qbast@go2.pl>
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this library; see the file COPYING.LIB.  If not, write to
00017  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef DNSSDSERVICEBROWSER_H
00022 #define DNSSDSERVICEBROWSER_H
00023 
00024 #include <qobject.h>
00025 #include <qdict.h>
00026 #include <dnssd/remoteservice.h>
00027 
00028 
00029 class QStringList;
00030 namespace DNSSD
00031 {
00032 class DomainBrowser;
00033 class ServiceBrowserPrivate;
00034 
00054 class KDNSSD_EXPORT ServiceBrowser : public QObject
00055 {
00056     Q_OBJECT
00057 public:
00064     enum State { Working, Stopped, Unsupported };
00065 
00079     ServiceBrowser(const QString& type,DomainBrowser* domains=0,bool autoResolve=false);
00080     
00087     ServiceBrowser(const QString& type,const QString& domain, bool autoResolve=false);
00088     
00089     ~ServiceBrowser();
00090 
00094     const QValueList<RemoteService::Ptr>& services() const;
00095 
00100     virtual void startBrowse();
00101 
00107     const DomainBrowser* browsedDomains() const;
00108     
00113     static const QString AllServices;
00114     
00143     static const State isAvailable();
00144 
00145 signals:
00150     void serviceAdded(DNSSD::RemoteService::Ptr);
00156     void serviceRemoved(DNSSD::RemoteService::Ptr);
00157 
00167     void finished();
00168 
00169 public slots:
00173     void removeDomain(const QString& domain);
00174     
00178     void addDomain(const QString& domain);
00179 
00180 protected:
00181     virtual void virtual_hook(int, void*);
00182 private:
00183     ServiceBrowserPrivate *d;
00184 
00185     bool allFinished();
00186     QValueList<RemoteService::Ptr>::Iterator findDuplicate(RemoteService::Ptr src);
00187 private slots:
00188     void serviceResolved(bool success);
00189     void gotNewService(DNSSD::RemoteService::Ptr);
00190     void gotRemoveService(DNSSD::RemoteService::Ptr);
00191     void queryFinished();
00192     void init(const QString&, DomainBrowser*, bool);
00193 
00194 };
00195 
00196 }
00197 
00198 #endif
KDE Logo
This file is part of the documentation for dnssd Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Aug 2 12:24:54 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003