refs #198 , made DBus address static, so it can be used elsewhere in the settings

This commit is contained in:
Klaus Basan
2014-04-01 12:13:48 +02:00
parent 2a0514fff9
commit 6327c3a1cb
2 changed files with 16 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ namespace BlackCore
CDBusServer::CDBusServer(const QString &address, QObject *parent) : CDBusServer::CDBusServer(const QString &address, QObject *parent) :
QObject(parent), m_busServer(CDBusServer::isP2P(address) ? address : "unix:tmpdir=/tmp" , parent), m_serverMode(CDBusServer::SERVERMODE_P2P) QObject(parent), m_busServer(CDBusServer::isP2P(address) ? address : "unix:tmpdir=/tmp" , parent), m_serverMode(CDBusServer::SERVERMODE_P2P)
{ {
if (address.isEmpty() || address.toLower() == "session") if (address.isEmpty() || address.toLower() == CDBusServer::sessionDBusServer())
{ {
// we use a session bus connection instead of a real P2P connection // we use a session bus connection instead of a real P2P connection
this->m_serverMode = CDBusServer::SERVERMODE_SESSIONBUS; this->m_serverMode = CDBusServer::SERVERMODE_SESSIONBUS;
@@ -33,7 +33,7 @@ namespace BlackCore
} }
this->newConnection(con); this->newConnection(con);
} }
else if (address.toLower() == "system") else if (address.toLower() == CDBusServer::systemDBusServer())
{ {
// we use a system bus connection instead of a real P2P connection // we use a system bus connection instead of a real P2P connection
this->m_serverMode = CDBusServer::SERVERMODE_SYSTEMBUS; this->m_serverMode = CDBusServer::SERVERMODE_SYSTEMBUS;

View File

@@ -102,6 +102,20 @@ namespace BlackCore
return defaultConnection; return defaultConnection;
} }
//! \brief Denotes a session DBus server
static const QString &sessionDBusServer()
{
static QString session("session");
return session;
}
//! \brief Denotes a session DBus server
static const QString &systemDBusServer()
{
static QString system("system");
return system;
}
private slots: private slots:
//! \brief Called when a new DBus client has connected //! \brief Called when a new DBus client has connected