1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 /* server.h: Qt wrapper for DBusServer
4 * Copyright (C) 2003 Zack Rusin <zack@kde.org>
6 * Licensed under the Academic Free License version 2.0
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "connection.h"
26 #include "integrator.h"
27 using DBusQt::Internal::Integrator;
32 struct Server::Private {
33 Private() : integrator( 0 ), server( 0 )
36 Integrator *integrator;
41 Server::Server( const QString& addr, QObject *parent )
46 if ( !addr.isEmpty() ) {
56 bool Server::isConnected() const
58 return dbus_server_get_is_connected( d->server );
61 void Server::disconnect()
63 dbus_server_disconnect( d->server );
66 QString Server::address() const
69 return dbus_server_get_address( d->server );
72 void Server::listen( const QString& addr )
79 void Server::init( const QString& addr )
81 d->server = dbus_server_listen( addr.ascii(), &d->error );
82 d->integrator = new Integrator( d->server, this );
83 connect( d->integrator, SIGNAL(newConnection(Connection*)),
84 SIGNAL(newConnection(Connection*)) );