File indexing completed on 2024-05-12 11:32:33
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-or-later 0003 SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com> 0004 SPDX-FileCopyrightText: 2018 Alexander Semke <alexander.semke@web.de> 0005 */ 0006 0007 #include "rserver.h" 0008 0009 #include <QApplication> 0010 #include <QDBusConnection> 0011 #include <QDBusError> 0012 #include <QDebug> 0013 #include <QTextStream> 0014 0015 int main(int argc, char **argv) 0016 { 0017 QApplication app(argc, argv); 0018 0019 if (!QDBusConnection::sessionBus().isConnected()) { 0020 qWarning() << "Can't connect to the D-Bus session bus.\n" 0021 "To start it, run: eval `dbus-launch --auto-syntax`"; 0022 return 1; 0023 } 0024 0025 const QString &serviceName = 0026 QString::fromLatin1("org.kde.Cantor.R-%1").arg(app.applicationPid()); 0027 0028 if (!QDBusConnection::sessionBus().registerService(serviceName)) { 0029 qWarning() << QDBusConnection::sessionBus().lastError().message(); 0030 return 2; 0031 } 0032 0033 RServer server; 0034 QDBusConnection::sessionBus().registerObject( 0035 QLatin1String("/"), 0036 &server 0037 ); 0038 0039 return app.exec(); 0040 }