Changeset View
Changeset View
Standalone View
Standalone View
plugins/mpriscontrol/mpriscontrolplugin.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 41 | MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args) | |||
---|---|---|---|---|---|
43 | , prevVolume(-1) | 43 | , prevVolume(-1) | ||
44 | { | 44 | { | ||
45 | m_watcher = new QDBusServiceWatcher(QString(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); | 45 | m_watcher = new QDBusServiceWatcher(QString(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); | ||
46 | 46 | | |||
47 | // TODO: QDBusConnectionInterface::serviceOwnerChanged is deprecated, maybe query org.freedesktop.DBus directly? | 47 | // TODO: QDBusConnectionInterface::serviceOwnerChanged is deprecated, maybe query org.freedesktop.DBus directly? | ||
48 | connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged); | 48 | connect(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged); | ||
49 | 49 | | |||
50 | //Add existing interfaces | 50 | //Add existing interfaces | ||
51 | QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); | 51 | const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); | ||
52 | Q_FOREACH (const QString& service, services) { | 52 | for (const QString& service : services) { | ||
53 | // The string doesn't matter, it just needs to be empty/non-empty | 53 | // The string doesn't matter, it just needs to be empty/non-empty | ||
54 | serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1")); | 54 | serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1")); | ||
55 | } | 55 | } | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | // Copied from the mpris2 dataengine in the plasma-workspace repository | 58 | // Copied from the mpris2 dataengine in the plasma-workspace repository | ||
59 | void MprisControlPlugin::serviceOwnerChanged(const QString& serviceName, const QString& oldOwner, const QString& newOwner) | 59 | void MprisControlPlugin::serviceOwnerChanged(const QString& serviceName, const QString& oldOwner, const QString& newOwner) | ||
60 | { | 60 | { | ||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |