Rename DbusHelper => DBusHelper

This commit is contained in:
Nicolas Fella 2019-08-14 17:36:19 +02:00
parent c64058132b
commit 0d7c504cf0
26 changed files with 68 additions and 68 deletions

View file

@ -167,7 +167,7 @@ int main(int argc, char** argv)
} }
} else if(parser.isSet(QStringLiteral("refresh"))) { } else if(parser.isSet(QStringLiteral("refresh"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect"), QStringLiteral("org.kde.kdeconnect.daemon"), QStringLiteral("forceOnNetworkChange"));
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else { } else {
QString device = parser.value(QStringLiteral("device")); QString device = parser.value(QStringLiteral("device"));
@ -200,7 +200,7 @@ int main(int argc, char** argv)
QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls")); QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls"));
msg.setArguments(QVariantList() << QVariant(urls)); msg.setArguments(QVariantList() << QVariant(urls));
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
for (const QString& url : qAsConst(urls)) { for (const QString& url : qAsConst(urls)) {
QTextStream(stdout) << i18n("Shared %1", url) << endl; QTextStream(stdout) << i18n("Shared %1", url) << endl;
@ -208,7 +208,7 @@ int main(int argc, char** argv)
} else if (parser.isSet(QStringLiteral("share-text"))) { } else if (parser.isSet(QStringLiteral("share-text"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareText")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareText"));
msg.setArguments(QVariantList() << parser.value(QStringLiteral("share-text"))); msg.setArguments(QVariantList() << parser.value(QStringLiteral("share-text")));
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
QTextStream(stdout) << i18n("Shared text: %1", parser.value(QStringLiteral("share-text"))) << endl; QTextStream(stdout) << i18n("Shared text: %1", parser.value(QStringLiteral("share-text"))) << endl;
} else if(parser.isSet(QStringLiteral("pair"))) { } else if(parser.isSet(QStringLiteral("pair"))) {
DeviceDbusInterface dev(device); DeviceDbusInterface dev(device);
@ -251,22 +251,22 @@ int main(int argc, char** argv)
QString message = parser.value(QStringLiteral("ping-msg")); QString message = parser.value(QStringLiteral("ping-msg"));
msg.setArguments(QVariantList() << message); msg.setArguments(QVariantList() << message);
} }
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("send-sms"))) { } else if(parser.isSet(QStringLiteral("send-sms"))) {
if (parser.isSet(QStringLiteral("destination"))) { if (parser.isSet(QStringLiteral("destination"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/sms"), QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/sms"), QStringLiteral("org.kde.kdeconnect.device.sms"), QStringLiteral("sendSms"));
msg.setArguments({ parser.value(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))}); msg.setArguments({ parser.value(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))});
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else { } else {
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>"); QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
return 1; return 1;
} }
} else if(parser.isSet(QStringLiteral("ring"))) { } else if(parser.isSet(QStringLiteral("ring"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/findmyphone"), QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/findmyphone"), QStringLiteral("org.kde.kdeconnect.device.findmyphone"), QStringLiteral("ring"));
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("photo"))) { } else if(parser.isSet(QStringLiteral("photo"))) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/photo"), QStringLiteral("org.kde.kdeconnect.device.photo"), QStringLiteral("requestPhoto"));
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} else if(parser.isSet(QStringLiteral("send-keys"))) { } else if(parser.isSet(QStringLiteral("send-keys"))) {
QString seq = parser.value(QStringLiteral("send-keys")); QString seq = parser.value(QStringLiteral("send-keys"));
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/remotekeyboard"), QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"), QStringLiteral("sendKeyPress")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/remotekeyboard"), QStringLiteral("org.kde.kdeconnect.device.remotekeyboard"), QStringLiteral("sendKeyPress"));
@ -277,13 +277,13 @@ int main(int argc, char** argv)
while (!in.atEnd()) { while (!in.atEnd()) {
QByteArray line = in.readLine(); // sanitize to ASCII-codes > 31? QByteArray line = in.readLine(); // sanitize to ASCII-codes > 31?
msg.setArguments({QString::fromLatin1(line), -1, false, false, false}); msg.setArguments({QString::fromLatin1(line), -1, false, false, false});
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} }
in.close(); in.close();
} }
} else { } else {
msg.setArguments({seq, -1, false, false, false}); msg.setArguments({seq, -1, false, false, false});
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
} }
} else if(parser.isSet(QStringLiteral("list-notifications"))) { } else if(parser.isSet(QStringLiteral("list-notifications"))) {
NotificationsModel notifications; NotificationsModel notifications;

View file

@ -108,8 +108,8 @@ void Daemon::init()
//Register on DBus //Register on DBus
qDBusRegisterMetaType< QMap<QString,QString> >(); qDBusRegisterMetaType< QMap<QString,QString> >();
DbusHelper::sessionBus().registerService(QStringLiteral("org.kde.kdeconnect")); DBusHelper::sessionBus().registerService(QStringLiteral("org.kde.kdeconnect"));
DbusHelper::sessionBus().registerObject(QStringLiteral("/modules/kdeconnect"), this, QDBusConnection::ExportScriptableContents); DBusHelper::sessionBus().registerObject(QStringLiteral("/modules/kdeconnect"), this, QDBusConnection::ExportScriptableContents);
NotificationServerInfo::instance().init(); NotificationServerInfo::instance().init();

View file

@ -36,7 +36,7 @@
#include <QRegularExpressionMatch> #include <QRegularExpressionMatch>
#endif #endif
namespace DbusHelper { namespace DBusHelper {
#ifdef USE_PRIVATE_DBUS #ifdef USE_PRIVATE_DBUS
class DBusInstancePrivate class DBusInstancePrivate

View file

@ -30,7 +30,7 @@
#define KDECONNECT_SESSION_DBUS_LAUNCHD_ENV "DBUS_LAUNCHD_SESSION_BUS_SOCKET" #define KDECONNECT_SESSION_DBUS_LAUNCHD_ENV "DBUS_LAUNCHD_SESSION_BUS_SOCKET"
namespace DbusHelper { namespace DBusHelper {
void KDECONNECTCORE_EXPORT filterNonExportableCharacters(QString& s); void KDECONNECTCORE_EXPORT filterNonExportableCharacters(QString& s);
#ifdef USE_PRIVATE_DBUS #ifdef USE_PRIVATE_DBUS

View file

@ -87,7 +87,7 @@ Device::Device(QObject* parent, const QString& id)
d->m_deviceType = str2type(info.deviceType); d->m_deviceType = str2type(info.deviceType);
//Register in bus //Register in bus
DbusHelper::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); DBusHelper::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
//Assume every plugin is supported until addLink is called and we can get the actual list //Assume every plugin is supported until addLink is called and we can get the actual list
d->m_allPlugins = PluginLoader::instance()->getPluginList().toSet(); d->m_allPlugins = PluginLoader::instance()->getPluginList().toSet();
@ -106,7 +106,7 @@ Device::Device(QObject* parent, const NetworkPacket& identityPacket, DeviceLink*
addLink(identityPacket, dl); addLink(identityPacket, dl);
//Register in bus //Register in bus
DbusHelper::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors); DBusHelper::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
connect(this, &Device::pairingError, this, &warn); connect(this, &Device::pairingError, this, &warn);
@ -199,7 +199,7 @@ void Device::reloadPlugins()
d->m_plugins = newPluginMap; d->m_plugins = newPluginMap;
d->m_pluginsByIncomingCapability = newPluginsByIncomingCapability; d->m_pluginsByIncomingCapability = newPluginsByIncomingCapability;
QDBusConnection bus = DbusHelper::sessionBus(); QDBusConnection bus = DBusHelper::sessionBus();
for (KdeConnectPlugin* plugin : qAsConst(d->m_plugins)) { for (KdeConnectPlugin* plugin : qAsConst(d->m_plugins)) {
//TODO: see how it works in Android (only done once, when created) //TODO: see how it works in Android (only done once, when created)
plugin->connected(); plugin->connected();

View file

@ -295,7 +295,7 @@ void KdeConnectConfig::generateCertificate(const QString& certPath)
bool error = false; bool error = false;
QString uuid = QUuid::createUuid().toString(); QString uuid = QUuid::createUuid().toString();
DbusHelper::filterNonExportableCharacters(uuid); DBusHelper::filterNonExportableCharacters(uuid);
qCDebug(KDECONNECT_CORE) << "My id:" << uuid; qCDebug(KDECONNECT_CORE) << "My id:" << uuid;
// FIXME: We only use QCA here to generate the cert and key, would be nice to get rid of it completely. // FIXME: We only use QCA here to generate the cert and key, would be nice to get rid of it completely.

View file

@ -43,7 +43,7 @@ KdeConnectPluginConfig::KdeConnectPluginConfig(const QString& deviceId, const QS
d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat); d->m_config = new QSettings(d->m_configDir.absoluteFilePath(QStringLiteral("config")), QSettings::IniFormat);
d->m_signal = QDBusMessage::createSignal(QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged")); d->m_signal = QDBusMessage::createSignal(QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"));
DbusHelper::sessionBus().connect(QLatin1String(""), QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged())); DBusHelper::sessionBus().connect(QLatin1String(""), QStringLiteral("/kdeconnect/") + deviceId + QStringLiteral("/") + pluginName, QStringLiteral("org.kde.kdeconnect.config"), QStringLiteral("configChanged"), this, SLOT(slotConfigChanged()));
} }
KdeConnectPluginConfig::~KdeConnectPluginConfig() KdeConnectPluginConfig::~KdeConnectPluginConfig()
@ -79,7 +79,7 @@ void KdeConnectPluginConfig::set(const QString& key, const QVariant& value)
{ {
d->m_config->setValue(key, value); d->m_config->setValue(key, value);
d->m_config->sync(); d->m_config->sync();
DbusHelper::sessionBus().send(d->m_signal); DBusHelper::sessionBus().send(d->m_signal);
} }
void KdeConnectPluginConfig::setList(const QString& key, const QVariantList& list) void KdeConnectPluginConfig::setList(const QString& key, const QVariantList& list)
@ -91,7 +91,7 @@ void KdeConnectPluginConfig::setList(const QString& key, const QVariantList& lis
} }
d->m_config->endArray(); d->m_config->endArray();
d->m_config->sync(); d->m_config->sync();
DbusHelper::sessionBus().send(d->m_signal); DBusHelper::sessionBus().send(d->m_signal);
} }
void KdeConnectPluginConfig::slotConfigChanged() void KdeConnectPluginConfig::slotConfigChanged()

View file

@ -157,7 +157,7 @@ bool NetworkPacket::unserialize(const QByteArray& a, NetworkPacket* np)
if (np->m_body.contains(QStringLiteral("deviceId"))) if (np->m_body.contains(QStringLiteral("deviceId")))
{ {
QString deviceId = np->get<QString>(QStringLiteral("deviceId")); QString deviceId = np->get<QString>(QStringLiteral("deviceId"));
DbusHelper::filterNonExportableCharacters(deviceId); DBusHelper::filterNonExportableCharacters(deviceId);
np->set(QStringLiteral("deviceId"), deviceId); np->set(QStringLiteral("deviceId"), deviceId);
} }

View file

@ -38,7 +38,7 @@ void NotificationServerInfo::init()
{ {
QDBusMessage query = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("/org/freedesktop/Notifications"), QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("GetCapabilities")); QDBusMessage query = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("/org/freedesktop/Notifications"), QStringLiteral("org.freedesktop.Notifications"), QStringLiteral("GetCapabilities"));
QDBusPendingReply<QStringList> reply = DbusHelper::sessionBus().asyncCall(query); QDBusPendingReply<QStringList> reply = DBusHelper::sessionBus().asyncCall(query);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, reply, watcher] { connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, reply, watcher] {
watcher->deleteLater(); watcher->deleteLater();

View file

@ -139,7 +139,7 @@ int main(int argc, char* argv[])
app.setQuitOnLastWindowClosed(false); app.setQuitOnLastWindowClosed(false);
#ifdef USE_PRIVATE_DBUS #ifdef USE_PRIVATE_DBUS
DbusHelper::launchDBusDaemon(); DBusHelper::launchDBusDaemon();
#endif #endif
QCommandLineParser parser; QCommandLineParser parser;
@ -154,7 +154,7 @@ int main(int argc, char* argv[])
QStringLiteral("/MainApplication"), QStringLiteral("/MainApplication"),
QStringLiteral("org.qtproject.Qt.QCoreApplication"), QStringLiteral("org.qtproject.Qt.QCoreApplication"),
QStringLiteral("quit")); QStringLiteral("quit"));
DbusHelper::sessionBus().call(message); //deliberately block until it's done, so we register the name after the app quits DBusHelper::sessionBus().call(message); //deliberately block until it's done, so we register the name after the app quits
} }
KDBusService dbusService(KDBusService::Unique); KDBusService dbusService(KDBusService::Unique);

View file

@ -94,7 +94,7 @@ void SendFileItemAction::sendFile()
for (const QUrl& url : urls) { for (const QUrl& url : urls) {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
msg.setArguments(QVariantList() << url.toString()); msg.setArguments(QVariantList() << url.toString());
DbusHelper::sessionBus().call(msg); DBusHelper::sessionBus().call(msg);
} }
} }

View file

@ -108,7 +108,7 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device->id() + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl")); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device->id() + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrl"));
msg.setArguments(QVariantList() << url.toString()); msg.setArguments(QVariantList() << url.toString());
DbusHelper::sessionBus().call(msg); DBusHelper::sessionBus().call(msg);
}); });
setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this); setWhenAvailable(device->hasPlugin(QStringLiteral("kdeconnect_share")), [sendFile](bool available) { sendFile->setVisible(available); }, this);

View file

@ -59,7 +59,7 @@ int main(int argc, char** argv)
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Unset launchctl env, avoid block // Unset launchctl env, avoid block
DbusHelper::macosUnsetLaunchctlEnv(); DBusHelper::macosUnsetLaunchctlEnv();
// Start kdeconnectd // Start kdeconnectd
QProcess kdeconnectdProcess; QProcess kdeconnectdProcess;
@ -151,7 +151,7 @@ int main(int argc, char** argv)
QStringLiteral("/MainApplication"), QStringLiteral("/MainApplication"),
QStringLiteral("org.qtproject.Qt.QCoreApplication"), QStringLiteral("org.qtproject.Qt.QCoreApplication"),
QStringLiteral("quit")); QStringLiteral("quit"));
DbusHelper::sessionBus().call(message); DBusHelper::sessionBus().call(message);
QCoreApplication::quit(); // Close this application QCoreApplication::quit(); // Close this application
}); });
#endif #endif

View file

@ -23,7 +23,7 @@
QString DaemonDbusInterface::activatedService() { QString DaemonDbusInterface::activatedService() {
static const QString service = QStringLiteral("org.kde.kdeconnect"); static const QString service = QStringLiteral("org.kde.kdeconnect");
auto reply = DbusHelper::sessionBus().interface()->startService(service); auto reply = DBusHelper::sessionBus().interface()->startService(service);
if (!reply.isValid()) { if (!reply.isValid()) {
qWarning() << "error activating kdeconnectd:" << reply.error(); qWarning() << "error activating kdeconnectd:" << reply.error();
} }
@ -31,7 +31,7 @@ QString DaemonDbusInterface::activatedService() {
} }
DaemonDbusInterface::DaemonDbusInterface(QObject* parent) DaemonDbusInterface::DaemonDbusInterface(QObject* parent)
: OrgKdeKdeconnectDaemonInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect"), DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDaemonInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect"), DBusHelper::sessionBus(), parent)
{ {
connect(this, &OrgKdeKdeconnectDaemonInterface::pairingRequestsChanged, this, &DaemonDbusInterface::pairingRequestsChangedProxy); connect(this, &OrgKdeKdeconnectDaemonInterface::pairingRequestsChanged, this, &DaemonDbusInterface::pairingRequestsChangedProxy);
} }
@ -42,7 +42,7 @@ DaemonDbusInterface::~DaemonDbusInterface()
} }
DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent) DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DBusHelper::sessionBus(), parent)
, m_id(id) , m_id(id)
{ {
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy); connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
@ -64,11 +64,11 @@ QString DeviceDbusInterface::id() const
void DeviceDbusInterface::pluginCall(const QString& plugin, const QString& method) void DeviceDbusInterface::pluginCall(const QString& plugin, const QString& method)
{ {
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") +id() + QStringLiteral("/") + plugin, QStringLiteral("org.kde.kdeconnect.device.") + plugin, method); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") +id() + QStringLiteral("/") + plugin, QStringLiteral("org.kde.kdeconnect.device.") + plugin, method);
DbusHelper::sessionBus().asyncCall(msg); DBusHelper::sessionBus().asyncCall(msg);
} }
DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent) DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DBusHelper::sessionBus(), parent)
{ {
} }
@ -79,7 +79,7 @@ DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface()
} }
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent) DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") +id, DBusHelper::sessionBus(), parent)
{ {
} }
@ -90,7 +90,7 @@ DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
} }
NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent) NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/notifications/") + notificationId, DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/notifications/") + notificationId, DBusHelper::sessionBus(), parent)
, id(notificationId) , id(notificationId)
{ {
@ -102,7 +102,7 @@ NotificationDbusInterface::~NotificationDbusInterface()
} }
DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString& deviceId, QObject* parent) DeviceConversationsDbusInterface::DeviceConversationsDbusInterface(const QString& deviceId, QObject* parent)
: OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId, DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceConversationsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId, DBusHelper::sessionBus(), parent)
{ {
} }
@ -113,7 +113,7 @@ DeviceConversationsDbusInterface::~DeviceConversationsDbusInterface()
} }
SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent) SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/sftp"), DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/sftp"), DBusHelper::sessionBus(), parent)
{ {
} }
@ -124,7 +124,7 @@ SftpDbusInterface::~SftpDbusInterface()
} }
MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent) MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/mprisremote"), DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/mprisremote"), DBusHelper::sessionBus(), parent)
{ {
connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy); connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
} }
@ -134,7 +134,7 @@ MprisDbusInterface::~MprisDbusInterface()
} }
RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent) RemoteControlDbusInterface::RemoteControlDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/remotecontrol"), DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceRemotecontrolInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/remotecontrol"), DBusHelper::sessionBus(), parent)
{ {
} }
@ -143,7 +143,7 @@ RemoteControlDbusInterface::~RemoteControlDbusInterface()
} }
LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent) LockDeviceDbusInterface::LockDeviceDbusInterface(const QString& id, QObject* parent)
: OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/lockdevice"), DbusHelper::sessionBus(), parent) : OrgKdeKdeconnectDeviceLockdeviceInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + id + QStringLiteral("/lockdevice"), DBusHelper::sessionBus(), parent)
{ {
connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy); connect(this, &OrgKdeKdeconnectDeviceLockdeviceInterface::lockedChanged, this, &LockDeviceDbusInterface::lockedChangedProxy);
Q_ASSERT(isValid()); Q_ASSERT(isValid());
@ -154,7 +154,7 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface()
} }
FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent): FindMyPhoneDeviceDbusInterface::FindMyPhoneDeviceDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/findmyphone"), DbusHelper::sessionBus(), parent) OrgKdeKdeconnectDeviceFindmyphoneInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/findmyphone"), DBusHelper::sessionBus(), parent)
{ {
} }
@ -163,14 +163,14 @@ FindMyPhoneDeviceDbusInterface::~FindMyPhoneDeviceDbusInterface()
} }
RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString& deviceId, QObject* parent): RemoteCommandsDbusInterface::RemoteCommandsDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotecommands"), DbusHelper::sessionBus(), parent) OrgKdeKdeconnectDeviceRemotecommandsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotecommands"), DBusHelper::sessionBus(), parent)
{ {
} }
RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default; RemoteCommandsDbusInterface::~RemoteCommandsDbusInterface() = default;
RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId, QObject* parent): RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotekeyboard"), DbusHelper::sessionBus(), parent) OrgKdeKdeconnectDeviceRemotekeyboardInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotekeyboard"), DBusHelper::sessionBus(), parent)
{ {
connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged); connect(this, &OrgKdeKdeconnectDeviceRemotekeyboardInterface::remoteStateChanged, this, &RemoteKeyboardDbusInterface::remoteStateChanged);
} }
@ -178,20 +178,20 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default; RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
SmsDbusInterface::SmsDbusInterface(const QString& deviceId, QObject* parent): SmsDbusInterface::SmsDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sms"), DbusHelper::sessionBus(), parent) OrgKdeKdeconnectDeviceSmsInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/sms"), DBusHelper::sessionBus(), parent)
{ {
} }
SmsDbusInterface::~SmsDbusInterface() = default; SmsDbusInterface::~SmsDbusInterface() = default;
ShareDbusInterface::ShareDbusInterface(const QString& deviceId, QObject* parent): ShareDbusInterface::ShareDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/share"), DbusHelper::sessionBus(), parent) OrgKdeKdeconnectDeviceShareInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/share"), DBusHelper::sessionBus(), parent)
{ {
} }
ShareDbusInterface::~ShareDbusInterface() = default; ShareDbusInterface::~ShareDbusInterface() = default;
RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent): RemoteSystemVolumeDbusInterface::RemoteSystemVolumeDbusInterface(const QString& deviceId, QObject* parent):
OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), DbusHelper::sessionBus(), parent) OrgKdeKdeconnectDeviceRemotesystemvolumeInterface(DaemonDbusInterface::activatedService(), QStringLiteral("/modules/kdeconnect/devices/") + deviceId + QStringLiteral("/remotesystemvolume"), DBusHelper::sessionBus(), parent)
{ {
} }

View file

@ -60,7 +60,7 @@ DevicesModel::DevicesModel(QObject* parent)
this, &DevicesModel::deviceRemoved); this, &DevicesModel::deviceRemoved);
QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(),
DbusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); DBusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &DevicesModel::refreshDeviceList); connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &DevicesModel::refreshDeviceList);
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &DevicesModel::clearDevices); connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &DevicesModel::clearDevices);

View file

@ -51,7 +51,7 @@ NotificationsModel::NotificationsModel(QObject* parent)
this, &NotificationsModel::anyDismissableChanged); this, &NotificationsModel::anyDismissableChanged);
QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(),
DbusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); DBusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &NotificationsModel::refreshNotificationList); connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &NotificationsModel::refreshNotificationList);
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &NotificationsModel::clearNotifications); connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &NotificationsModel::clearNotifications);
} }

View file

@ -37,7 +37,7 @@ RemoteCommandsModel::RemoteCommandsModel(QObject* parent)
this, &RemoteCommandsModel::rowsChanged); this, &RemoteCommandsModel::rowsChanged);
QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(),
DbusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); DBusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &RemoteCommandsModel::refreshCommandList); connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &RemoteCommandsModel::refreshCommandList);
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &RemoteCommandsModel::clearCommands); connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &RemoteCommandsModel::clearCommands);
} }

View file

@ -37,7 +37,7 @@ RemoteSinksModel::RemoteSinksModel(QObject* parent)
this, &RemoteSinksModel::rowsChanged); this, &RemoteSinksModel::rowsChanged);
QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(),
DbusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); DBusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &RemoteSinksModel::refreshSinkList); connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &RemoteSinksModel::refreshSinkList);
connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &RemoteSinksModel::refreshSinkList); connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &RemoteSinksModel::refreshSinkList);
} }

View file

@ -82,7 +82,7 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket & np)
OrgFreedesktopScreenSaverInterface* LockDevicePlugin::iface() OrgFreedesktopScreenSaverInterface* LockDevicePlugin::iface()
{ {
if (!m_iface) { if (!m_iface) {
m_iface = new OrgFreedesktopScreenSaverInterface(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/org/freedesktop/ScreenSaver"), DbusHelper::sessionBus()); m_iface = new OrgFreedesktopScreenSaverInterface(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/org/freedesktop/ScreenSaver"), DBusHelper::sessionBus());
if(!m_iface->isValid()) if(!m_iface->isValid())
qCWarning(KDECONNECT_PLUGIN_LOCKREMOTE) << "Couldn't connect to the ScreenSaver interface"; qCWarning(KDECONNECT_PLUGIN_LOCKREMOTE) << "Couldn't connect to the ScreenSaver interface";
} }

View file

@ -52,13 +52,13 @@ MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args
: KdeConnectPlugin(parent, args) : KdeConnectPlugin(parent, args)
, prevVolume(-1) , prevVolume(-1)
{ {
m_watcher = new QDBusServiceWatcher(QString(), DbusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); m_watcher = new QDBusServiceWatcher(QString(), DBusHelper::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
// TODO: QDBusConnectionInterface::serviceOwnerChanged is deprecated, maybe query org.freedesktop.DBus directly? // TODO: QDBusConnectionInterface::serviceOwnerChanged is deprecated, maybe query org.freedesktop.DBus directly?
connect(DbusHelper::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged); connect(DBusHelper::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged);
//Add existing interfaces //Add existing interfaces
const QStringList services = DbusHelper::sessionBus().interface()->registeredServiceNames().value(); const QStringList services = DBusHelper::sessionBus().interface()->registeredServiceNames().value();
for (const QString& service : services) { for (const QString& service : services) {
// The string doesn't matter, it just needs to be empty/non-empty // The string doesn't matter, it just needs to be empty/non-empty
serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1")); serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1"));
@ -100,7 +100,7 @@ void MprisControlPlugin::addPlayer(const QString& service)
uniqueName = identity + QLatin1String(" [") + QString::number(i) + QLatin1Char(']'); uniqueName = identity + QLatin1String(" [") + QString::number(i) + QLatin1Char(']');
} }
MprisPlayer player(service, mediaPlayerObjectPath, DbusHelper::sessionBus()); MprisPlayer player(service, mediaPlayerObjectPath, DBusHelper::sessionBus());
playerList.insert(uniqueName, player); playerList.insert(uniqueName, player);

View file

@ -118,7 +118,7 @@ void NotificationsDbusInterface::addNotification(Notification* noti)
m_notifications[publicId] = noti; m_notifications[publicId] = noti;
m_internalIdToPublicId[internalId] = publicId; m_internalIdToPublicId[internalId] = publicId;
DbusHelper::sessionBus().registerObject(m_device->dbusPath() + QStringLiteral("/notifications/") + publicId, noti, QDBusConnection::ExportScriptableContents); DBusHelper::sessionBus().registerObject(m_device->dbusPath() + QStringLiteral("/notifications/") + publicId, noti, QDBusConnection::ExportScriptableContents);
Q_EMIT notificationPosted(publicId); Q_EMIT notificationPosted(publicId);
} }
@ -140,7 +140,7 @@ void NotificationsDbusInterface::removeNotification(const QString& internalId)
} }
//Deleting the notification will unregister it automatically //Deleting the notification will unregister it automatically
//DbusHelper::sessionBus().unregisterObject(mDevice->dbusPath()+"/notifications/"+publicId); //DBusHelper::sessionBus().unregisterObject(mDevice->dbusPath()+"/notifications/"+publicId);
noti->deleteLater(); noti->deleteLater();
Q_EMIT notificationRemoved(publicId); Q_EMIT notificationRemoved(publicId);

View file

@ -77,7 +77,7 @@ bool PauseMusicPlugin::receivePacket(const NetworkPacket& np)
if (pause) { if (pause) {
//Search for interfaces currently playing //Search for interfaces currently playing
const QStringList interfaces = DbusHelper::sessionBus().interface()->registeredServiceNames().value(); const QStringList interfaces = DBusHelper::sessionBus().interface()->registeredServiceNames().value();
for (const QString& iface : interfaces) { for (const QString& iface : interfaces) {
if (iface.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) { if (iface.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player")); QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));

View file

@ -132,7 +132,7 @@ void RunCommandConfig::save()
if (key.isEmpty()) { if (key.isEmpty()) {
key = QUuid::createUuid().toString(); key = QUuid::createUuid().toString();
DbusHelper::filterNonExportableCharacters(key); DBusHelper::filterNonExportableCharacters(key);
} }
QJsonObject entry; QJsonObject entry;
entry[QStringLiteral("name")] = name; entry[QStringLiteral("name")] = name;

View file

@ -48,7 +48,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
{ {
qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication"); qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
bool ret = DbusHelper::sessionBus() bool ret = DBusHelper::sessionBus()
.registerObject(QStringLiteral("/org/freedesktop/Notifications"), .registerObject(QStringLiteral("/org/freedesktop/Notifications"),
this, this,
QDBusConnection::ExportScriptableContents); QDBusConnection::ExportScriptableContents);
@ -56,7 +56,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION) qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION)
<< "Error registering notifications listener for device" << "Error registering notifications listener for device"
<< m_plugin->device()->name() << ":" << m_plugin->device()->name() << ":"
<< DbusHelper::sessionBus().lastError(); << DBusHelper::sessionBus().lastError();
else else
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION) qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION)
<< "Registered notifications listener for device" << "Registered notifications listener for device"
@ -80,7 +80,7 @@ NotificationsListener::~NotificationsListener()
QStringLiteral("org.freedesktop.DBus")); QStringLiteral("org.freedesktop.DBus"));
QDBusMessage res = iface.call(QStringLiteral("RemoveMatch"), QDBusMessage res = iface.call(QStringLiteral("RemoveMatch"),
QStringLiteral("interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'")); QStringLiteral("interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'"));
DbusHelper::sessionBus().unregisterObject(QStringLiteral("/org/freedesktop/Notifications")); DBusHelper::sessionBus().unregisterObject(QStringLiteral("/org/freedesktop/Notifications"));
} }
void NotificationsListener::setTranslatedAppName() void NotificationsListener::setTranslatedAppName()

View file

@ -34,12 +34,12 @@ class PrivateDBusTest : public QObject
public: public:
PrivateDBusTest() PrivateDBusTest()
{ {
DbusHelper::launchDBusDaemon(); DBusHelper::launchDBusDaemon();
} }
~PrivateDBusTest() ~PrivateDBusTest()
{ {
DbusHelper::closeDBusDaemon(); DBusHelper::closeDBusDaemon();
} }
private Q_SLOTS: private Q_SLOTS:
@ -53,7 +53,7 @@ private Q_SLOTS:
*/ */
void PrivateDBusTest::testConnectionWithPrivateDBus() void PrivateDBusTest::testConnectionWithPrivateDBus()
{ {
QDBusConnection conn = DbusHelper::sessionBus(); QDBusConnection conn = DBusHelper::sessionBus();
QVERIFY2(conn.isConnected(), "Connection not established"); QVERIFY2(conn.isConnected(), "Connection not established");
QVERIFY2(conn.name() == QStringLiteral(KDECONNECT_PRIVATE_DBUS_NAME), QVERIFY2(conn.name() == QStringLiteral(KDECONNECT_PRIVATE_DBUS_NAME),
@ -65,7 +65,7 @@ void PrivateDBusTest::testConnectionWithPrivateDBus()
*/ */
void PrivateDBusTest::testServiceRegistrationWithPrivateDBus() void PrivateDBusTest::testServiceRegistrationWithPrivateDBus()
{ {
QDBusConnection conn = DbusHelper::sessionBus(); QDBusConnection conn = DBusHelper::sessionBus();
QVERIFY2(conn.isConnected(), "DBus not connected"); QVERIFY2(conn.isConnected(), "DBus not connected");
QDBusConnectionInterface *bus = conn.interface(); QDBusConnectionInterface *bus = conn.interface();
@ -82,7 +82,7 @@ void PrivateDBusTest::testServiceRegistrationWithPrivateDBus()
*/ */
void PrivateDBusTest::testMethodCallWithPrivateDBus() void PrivateDBusTest::testMethodCallWithPrivateDBus()
{ {
QDBusConnection conn = DbusHelper::sessionBus(); QDBusConnection conn = DBusHelper::sessionBus();
QVERIFY2(conn.isConnected(), "DBus not connected"); QVERIFY2(conn.isConnected(), "DBus not connected");
/* /*

View file

@ -110,7 +110,7 @@ int main(int argc, char** argv)
QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), action); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.kdeconnect"), QStringLiteral("/modules/kdeconnect/devices/") + device + QStringLiteral("/share"), QStringLiteral("org.kde.kdeconnect.device.share"), action);
msg.setArguments({ url.toString() }); msg.setArguments({ url.toString() });
blockOnReply(DbusHelper::sessionBus().asyncCall(msg)); blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
return 0; return 0;
} else { } else {
QTextStream(stderr) << (i18n("Couldn't share %1", url.toString())) << endl; QTextStream(stderr) << (i18n("Couldn't share %1", url.toString())) << endl;