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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 */ 00022 00023 #include "qdbusserver.h" 00024 #include "qdbusconnection_p.h" 00025 00026 QDBusServer::QDBusServer(const QString &addr, QObject *parent) 00027 : QObject(parent) 00028 { 00029 d = new QDBusConnectionPrivate(this); 00030 00031 if (addr.isEmpty()) 00032 return; 00033 00034 d->setServer(dbus_server_listen(addr.toUtf8().constData(), &d->error)); 00035 } 00036 00037 bool QDBusServer::isConnected() const 00038 { 00039 return d->server && dbus_server_get_is_connected(d->server); 00040 } 00041 00042 QDBusError QDBusServer::lastError() const 00043 { 00044 return d->lastError; 00045 } 00046 00047 QString QDBusServer::address() const 00048 { 00049 QString addr; 00050 if (d->server) { 00051 char *c = dbus_server_get_address(d->server); 00052 addr = QString::fromUtf8(c); 00053 dbus_free(c); 00054 } 00055 00056 return addr; 00057 } 00058 00059 #include "qdbusserver.moc"
1.4.6