|
DBus-1-TQt
1.0
|
00001 /* qdbusserver.cpp 00002 * 00003 * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org> 00004 * 00005 * Licensed under the Academic Free License version 2.1 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 * USA. 00021 * 00022 */ 00023 00024 #include "tqdbusserver.h" 00025 #include "tqdbusconnection_p.h" 00026 00027 TQT_DBusServer::TQT_DBusServer(const TQString &addr, TQObject *parent) 00028 : TQObject(parent) 00029 { 00030 d = new TQT_DBusConnectionPrivate(this); 00031 00032 if (addr.isEmpty()) 00033 return; 00034 00035 d->setServer(dbus_server_listen(addr.utf8().data(), &d->error)); 00036 } 00037 00038 bool TQT_DBusServer::isConnected() const 00039 { 00040 return d->server && dbus_server_get_is_connected(d->server); 00041 } 00042 00043 TQT_DBusError TQT_DBusServer::lastError() const 00044 { 00045 return d->lastError; 00046 } 00047 00048 TQString TQT_DBusServer::address() const 00049 { 00050 TQString addr; 00051 if (d->server) { 00052 char *c = dbus_server_get_address(d->server); 00053 addr = TQString::fromUtf8(c); 00054 dbus_free(c); 00055 } 00056 00057 return addr; 00058 } 00059 00060 #include "tqdbusserver.moc"