DBus-1-TQt  1.0
tqdbusserver.cpp
Go to the documentation of this file.
1 /* qdbusserver.cpp
2  *
3  * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
4  *
5  * Licensed under the Academic Free License version 2.1
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20  * USA.
21  *
22  */
23 
24 #include "tqdbusserver.h"
25 #include "tqdbusconnection_p.h"
26 
27 TQT_DBusServer::TQT_DBusServer(const TQString &addr, TQObject *parent)
28  : TQObject(parent)
29 {
30  d = new TQT_DBusConnectionPrivate(this);
31 
32  if (addr.isEmpty())
33  return;
34 
35  d->setServer(dbus_server_listen(addr.utf8().data(), &d->error));
36 }
37 
39 {
40  return d->server && dbus_server_get_is_connected(d->server);
41 }
42 
44 {
45  return d->lastError;
46 }
47 
48 TQString TQT_DBusServer::address() const
49 {
50  TQString addr;
51  if (d->server) {
52  char *c = dbus_server_get_address(d->server);
53  addr = TQString::fromUtf8(c);
54  dbus_free(c);
55  }
56 
57  return addr;
58 }
59 
60 #include "tqdbusserver.moc"
TQT_DBusConnectionPrivate * d
Definition: tqdbusserver.h:50
TQString address() const
TQT_DBusServer(const TQString &address, TQObject *parent=0)
TQT_DBusError lastError() const
Class for transporting D-Bus errors.
Definition: tqdbuserror.h:40
void setServer(DBusServer *server)
bool isConnected() const