summaryrefslogtreecommitdiffstats
path: root/dnssd/domainbrowser.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-22 00:17:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-22 00:17:47 +0000
commit847c48556bc8f7c17bd201ced9381e2fbb2d5d09 (patch)
tree1e5e47d7dcb6e0de81a8ce9f0464ab88e2d8babe /dnssd/domainbrowser.cpp
parentcfa3abbed0a36890d0c5a41fff2ef6c0f850de25 (diff)
downloadtdelibs-847c48556bc8f7c17bd201ced9381e2fbb2d5d09.tar.gz
tdelibs-847c48556bc8f7c17bd201ced9381e2fbb2d5d09.zip
Attempt to fix compilation when Avahi is not available
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1152784 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dnssd/domainbrowser.cpp')
-rw-r--r--dnssd/domainbrowser.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/dnssd/domainbrowser.cpp b/dnssd/domainbrowser.cpp
index 294ce2576..3739bc520 100644
--- a/dnssd/domainbrowser.cpp
+++ b/dnssd/domainbrowser.cpp
@@ -34,6 +34,7 @@
namespace DNSSD
{
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
AvahiLookupResultFlags, void* context);
@@ -41,12 +42,13 @@ void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBr
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
void* context);
#endif
+#endif
-class DomainBrowserPrivate
+class DomainBrowserPrivate
{
public:
- DomainBrowserPrivate(DomainBrowser* owner) : m_browseLAN(false), m_started(false),
+ DomainBrowserPrivate(DomainBrowser* owner) : m_browseLAN(false), m_started(false),
m_browser(0), m_owner(owner) {}
~DomainBrowserPrivate() { if (m_browser) avahi_domain_browser_free(m_browser); }
QStringList m_domains;
@@ -55,7 +57,7 @@ public:
bool m_started;
AvahiDomainBrowser* m_browser;
DomainBrowser* m_owner;
-};
+};
void DomainBrowserPrivate::customEvent(QCustomEvent* event)
{
@@ -66,7 +68,7 @@ void DomainBrowserPrivate::customEvent(QCustomEvent* event)
}
}
-
+
DomainBrowser::DomainBrowser(QObject *parent) : QObject(parent)
{
d = new DomainBrowserPrivate(this);
@@ -100,7 +102,8 @@ void DomainBrowser::startBrowse()
if (ServiceBrowser::isAvailable()!=ServiceBrowser::Working) return;
QStringList::const_iterator itEnd = d->m_domains.end();
for (QStringList::const_iterator it=d->m_domains.begin(); it!=itEnd; ++it ) emit domainAdded(*it);
- if (d->m_browseLAN)
+#ifdef HAVE_DNSSD
+ if (d->m_browseLAN)
#ifdef AVAHI_API_0_6
d->m_browser = avahi_domain_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
"local.", AVAHI_DOMAIN_BROWSER_BROWSE, (AvahiLookupFlags)0, domains_callback, this);
@@ -108,6 +111,7 @@ void DomainBrowser::startBrowse()
d->m_browser = avahi_domain_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
"local.", AVAHI_DOMAIN_BROWSER_BROWSE, domains_callback, this);
#endif
+#endif
}
void DomainBrowser::gotNewDomain(const QString& domain)
@@ -128,7 +132,7 @@ void DomainBrowser::domainListChanged(int message,int)
if (message!=KIPCDomainsChanged) return;
bool was_started = d->m_started;
- if (d->m_browser) {
+ if (d->m_browser) {
avahi_domain_browser_free(d->m_browser); // LAN query
d->m_browser=0;
}
@@ -163,6 +167,7 @@ bool DomainBrowser::isRunning() const
void DomainBrowser::virtual_hook(int, void*)
{}
+#ifdef HAVE_DNSSD
#ifdef AVAHI_API_0_6
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
AvahiLookupResultFlags,void* context)
@@ -173,11 +178,11 @@ void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBr
{
QObject *obj = reinterpret_cast<QObject*>(context);
AddRemoveEvent* arev=new AddRemoveEvent((event==AVAHI_BROWSER_NEW) ? AddRemoveEvent::Add :
- AddRemoveEvent::Remove, QString::null, QString::null,
+ AddRemoveEvent::Remove, QString::null, QString::null,
DNSToDomain(replyDomain));
QApplication::postEvent(obj, arev);
}
-
+#endif
}
#include "domainbrowser.moc"