fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / dnssd / avahi-publicservice_p.h
blobaa4efbd5eaf7f0f724f1b8b7053c43f370f3da48
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 #ifndef AVAHI_PUBLICSERVICE_P_H
22 #define AVAHI_PUBLICSERVICE_P_H
24 #include <QtCore/QStringList>
25 #include "servicebase_p.h"
26 #include <avahi-common/defs.h>
27 #include "publicservice.h"
28 #include "avahi_server_interface.h"
29 #include "avahi_entrygroup_interface.h"
31 #define K_D PublicServicePrivate* d=static_cast<PublicServicePrivate*>(this->d)
33 namespace DNSSD
36 class PublicServicePrivate : public QObject, public ServiceBasePrivate
38 Q_OBJECT
39 public:
40 PublicServicePrivate(PublicService* parent, const QString& name, const QString& type, const QString& domain, unsigned int port) :
41 QObject(), ServiceBasePrivate(name, type, domain, QString(), port), m_published(false), m_running(false), m_group(0),
42 m_server(0), m_collision(false), m_parent(parent)
44 ~PublicServicePrivate() {
45 if (m_group) m_group->Free();
46 delete m_group;
47 delete m_server;
50 bool m_published;
51 bool m_running;
52 org::freedesktop::Avahi::EntryGroup* m_group;
53 org::freedesktop::Avahi::Server* m_server;
54 bool m_collision;
55 QStringList m_subtypes;
56 PublicService* m_parent;
58 void commit()
60 if (!m_collision) m_group->Commit();
62 void stop();
63 bool fillEntryGroup();
64 void tryApply();
66 public Q_SLOTS:
67 void serverStateChanged(int,const QString&);
68 void groupStateChanged(int,const QString&);
73 #endif