Rename DbusHelper => DBusHelper
This commit is contained in:
parent
c64058132b
commit
0d7c504cf0
26 changed files with 68 additions and 68 deletions
|
@ -167,7 +167,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
} else if(parser.isSet(QStringLiteral("refresh"))) {
|
||||
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 {
|
||||
|
||||
QString device = parser.value(QStringLiteral("device"));
|
||||
|
@ -200,7 +200,7 @@ int main(int argc, char** argv)
|
|||
QStringLiteral("org.kde.kdeconnect.device.share"), QStringLiteral("shareUrls"));
|
||||
|
||||
msg.setArguments(QVariantList() << QVariant(urls));
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
|
||||
for (const QString& url : qAsConst(urls)) {
|
||||
QTextStream(stdout) << i18n("Shared %1", url) << endl;
|
||||
|
@ -208,7 +208,7 @@ int main(int argc, char** argv)
|
|||
} 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"));
|
||||
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;
|
||||
} else if(parser.isSet(QStringLiteral("pair"))) {
|
||||
DeviceDbusInterface dev(device);
|
||||
|
@ -251,22 +251,22 @@ int main(int argc, char** argv)
|
|||
QString message = parser.value(QStringLiteral("ping-msg"));
|
||||
msg.setArguments(QVariantList() << message);
|
||||
}
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
} else if(parser.isSet(QStringLiteral("send-sms"))) {
|
||||
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"));
|
||||
msg.setArguments({ parser.value(QStringLiteral("destination")), parser.value(QStringLiteral("send-sms"))});
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
} else {
|
||||
QTextStream(stderr) << i18n("error: should specify the SMS's recipient by passing --destination <phone number>");
|
||||
return 1;
|
||||
}
|
||||
} 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"));
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
} 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"));
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
} else if(parser.isSet(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"));
|
||||
|
@ -277,13 +277,13 @@ int main(int argc, char** argv)
|
|||
while (!in.atEnd()) {
|
||||
QByteArray line = in.readLine(); // sanitize to ASCII-codes > 31?
|
||||
msg.setArguments({QString::fromLatin1(line), -1, false, false, false});
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
}
|
||||
in.close();
|
||||
}
|
||||
} else {
|
||||
msg.setArguments({seq, -1, false, false, false});
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
}
|
||||
} else if(parser.isSet(QStringLiteral("list-notifications"))) {
|
||||
NotificationsModel notifications;
|
||||
|
|
|
@ -108,8 +108,8 @@ void Daemon::init()
|
|||
|
||||
//Register on DBus
|
||||
qDBusRegisterMetaType< QMap<QString,QString> >();
|
||||
DbusHelper::sessionBus().registerService(QStringLiteral("org.kde.kdeconnect"));
|
||||
DbusHelper::sessionBus().registerObject(QStringLiteral("/modules/kdeconnect"), this, QDBusConnection::ExportScriptableContents);
|
||||
DBusHelper::sessionBus().registerService(QStringLiteral("org.kde.kdeconnect"));
|
||||
DBusHelper::sessionBus().registerObject(QStringLiteral("/modules/kdeconnect"), this, QDBusConnection::ExportScriptableContents);
|
||||
|
||||
NotificationServerInfo::instance().init();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <QRegularExpressionMatch>
|
||||
#endif
|
||||
|
||||
namespace DbusHelper {
|
||||
namespace DBusHelper {
|
||||
|
||||
#ifdef USE_PRIVATE_DBUS
|
||||
class DBusInstancePrivate
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#define KDECONNECT_SESSION_DBUS_LAUNCHD_ENV "DBUS_LAUNCHD_SESSION_BUS_SOCKET"
|
||||
|
||||
namespace DbusHelper {
|
||||
namespace DBusHelper {
|
||||
void KDECONNECTCORE_EXPORT filterNonExportableCharacters(QString& s);
|
||||
|
||||
#ifdef USE_PRIVATE_DBUS
|
||||
|
|
|
@ -87,7 +87,7 @@ Device::Device(QObject* parent, const QString& id)
|
|||
d->m_deviceType = str2type(info.deviceType);
|
||||
|
||||
//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
|
||||
d->m_allPlugins = PluginLoader::instance()->getPluginList().toSet();
|
||||
|
@ -106,7 +106,7 @@ Device::Device(QObject* parent, const NetworkPacket& identityPacket, DeviceLink*
|
|||
addLink(identityPacket, dl);
|
||||
|
||||
//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);
|
||||
|
||||
|
@ -199,7 +199,7 @@ void Device::reloadPlugins()
|
|||
d->m_plugins = newPluginMap;
|
||||
d->m_pluginsByIncomingCapability = newPluginsByIncomingCapability;
|
||||
|
||||
QDBusConnection bus = DbusHelper::sessionBus();
|
||||
QDBusConnection bus = DBusHelper::sessionBus();
|
||||
for (KdeConnectPlugin* plugin : qAsConst(d->m_plugins)) {
|
||||
//TODO: see how it works in Android (only done once, when created)
|
||||
plugin->connected();
|
||||
|
|
|
@ -295,7 +295,7 @@ void KdeConnectConfig::generateCertificate(const QString& certPath)
|
|||
bool error = false;
|
||||
|
||||
QString uuid = QUuid::createUuid().toString();
|
||||
DbusHelper::filterNonExportableCharacters(uuid);
|
||||
DBusHelper::filterNonExportableCharacters(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.
|
||||
|
|
|
@ -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_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()
|
||||
|
@ -79,7 +79,7 @@ void KdeConnectPluginConfig::set(const QString& key, const QVariant& value)
|
|||
{
|
||||
d->m_config->setValue(key, value);
|
||||
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)
|
||||
|
@ -91,7 +91,7 @@ void KdeConnectPluginConfig::setList(const QString& key, const QVariantList& lis
|
|||
}
|
||||
d->m_config->endArray();
|
||||
d->m_config->sync();
|
||||
DbusHelper::sessionBus().send(d->m_signal);
|
||||
DBusHelper::sessionBus().send(d->m_signal);
|
||||
}
|
||||
|
||||
void KdeConnectPluginConfig::slotConfigChanged()
|
||||
|
|
|
@ -157,7 +157,7 @@ bool NetworkPacket::unserialize(const QByteArray& a, NetworkPacket* np)
|
|||
if (np->m_body.contains(QStringLiteral("deviceId")))
|
||||
{
|
||||
QString deviceId = np->get<QString>(QStringLiteral("deviceId"));
|
||||
DbusHelper::filterNonExportableCharacters(deviceId);
|
||||
DBusHelper::filterNonExportableCharacters(deviceId);
|
||||
np->set(QStringLiteral("deviceId"), deviceId);
|
||||
}
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
||||
QDBusPendingReply<QStringList> reply = DbusHelper::sessionBus().asyncCall(query);
|
||||
QDBusPendingReply<QStringList> reply = DBusHelper::sessionBus().asyncCall(query);
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, reply, watcher] {
|
||||
watcher->deleteLater();
|
||||
|
|
|
@ -139,7 +139,7 @@ int main(int argc, char* argv[])
|
|||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
#ifdef USE_PRIVATE_DBUS
|
||||
DbusHelper::launchDBusDaemon();
|
||||
DBusHelper::launchDBusDaemon();
|
||||
#endif
|
||||
|
||||
QCommandLineParser parser;
|
||||
|
@ -154,7 +154,7 @@ int main(int argc, char* argv[])
|
|||
QStringLiteral("/MainApplication"),
|
||||
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
|
||||
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);
|
||||
|
|
|
@ -94,7 +94,7 @@ void SendFileItemAction::sendFile()
|
|||
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"));
|
||||
msg.setArguments(QVariantList() << url.toString());
|
||||
DbusHelper::sessionBus().call(msg);
|
||||
DBusHelper::sessionBus().call(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"));
|
||||
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);
|
||||
|
|
|
@ -59,7 +59,7 @@ int main(int argc, char** argv)
|
|||
|
||||
#ifdef Q_OS_MAC
|
||||
// Unset launchctl env, avoid block
|
||||
DbusHelper::macosUnsetLaunchctlEnv();
|
||||
DBusHelper::macosUnsetLaunchctlEnv();
|
||||
|
||||
// Start kdeconnectd
|
||||
QProcess kdeconnectdProcess;
|
||||
|
@ -151,7 +151,7 @@ int main(int argc, char** argv)
|
|||
QStringLiteral("/MainApplication"),
|
||||
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
|
||||
QStringLiteral("quit"));
|
||||
DbusHelper::sessionBus().call(message);
|
||||
DBusHelper::sessionBus().call(message);
|
||||
QCoreApplication::quit(); // Close this application
|
||||
});
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
QString DaemonDbusInterface::activatedService() {
|
||||
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()) {
|
||||
qWarning() << "error activating kdeconnectd:" << reply.error();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ QString DaemonDbusInterface::activatedService() {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ DaemonDbusInterface::~DaemonDbusInterface()
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
connect(this, &OrgKdeKdeconnectDeviceInterface::trustedChanged, this, &DeviceDbusInterface::trustedChangedProxy);
|
||||
|
@ -64,11 +64,11 @@ QString DeviceDbusInterface::id() const
|
|||
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);
|
||||
DbusHelper::sessionBus().asyncCall(msg);
|
||||
DBusHelper::sessionBus().asyncCall(msg);
|
||||
}
|
||||
|
||||
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)
|
||||
: 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)
|
||||
: 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)
|
||||
{
|
||||
|
||||
|
@ -102,7 +102,7 @@ NotificationDbusInterface::~NotificationDbusInterface()
|
|||
}
|
||||
|
||||
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)
|
||||
: 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)
|
||||
: 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);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ MprisDbusInterface::~MprisDbusInterface()
|
|||
}
|
||||
|
||||
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)
|
||||
: 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);
|
||||
Q_ASSERT(isValid());
|
||||
|
@ -154,7 +154,7 @@ LockDeviceDbusInterface::~LockDeviceDbusInterface()
|
|||
}
|
||||
|
||||
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):
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -178,20 +178,20 @@ RemoteKeyboardDbusInterface::RemoteKeyboardDbusInterface(const QString& deviceId
|
|||
RemoteKeyboardDbusInterface::~RemoteKeyboardDbusInterface() = default;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ DevicesModel::DevicesModel(QObject* parent)
|
|||
this, &DevicesModel::deviceRemoved);
|
||||
|
||||
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::serviceUnregistered, this, &DevicesModel::clearDevices);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ NotificationsModel::NotificationsModel(QObject* parent)
|
|||
this, &NotificationsModel::anyDismissableChanged);
|
||||
|
||||
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::serviceUnregistered, this, &NotificationsModel::clearNotifications);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ RemoteCommandsModel::RemoteCommandsModel(QObject* parent)
|
|||
this, &RemoteCommandsModel::rowsChanged);
|
||||
|
||||
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::serviceUnregistered, this, &RemoteCommandsModel::clearCommands);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ RemoteSinksModel::RemoteSinksModel(QObject* parent)
|
|||
this, &RemoteSinksModel::rowsChanged);
|
||||
|
||||
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::serviceUnregistered, this, &RemoteSinksModel::refreshSinkList);
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ bool LockDevicePlugin::receivePacket(const NetworkPacket & np)
|
|||
OrgFreedesktopScreenSaverInterface* LockDevicePlugin::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())
|
||||
qCWarning(KDECONNECT_PLUGIN_LOCKREMOTE) << "Couldn't connect to the ScreenSaver interface";
|
||||
}
|
||||
|
|
|
@ -52,13 +52,13 @@ MprisControlPlugin::MprisControlPlugin(QObject* parent, const QVariantList& args
|
|||
: KdeConnectPlugin(parent, args)
|
||||
, 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?
|
||||
connect(DbusHelper::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged);
|
||||
connect(DBusHelper::sessionBus().interface(), &QDBusConnectionInterface::serviceOwnerChanged, this, &MprisControlPlugin::serviceOwnerChanged);
|
||||
|
||||
//Add existing interfaces
|
||||
const QStringList services = DbusHelper::sessionBus().interface()->registeredServiceNames().value();
|
||||
const QStringList services = DBusHelper::sessionBus().interface()->registeredServiceNames().value();
|
||||
for (const QString& service : services) {
|
||||
// The string doesn't matter, it just needs to be empty/non-empty
|
||||
serviceOwnerChanged(service, QLatin1String(""), QStringLiteral("1"));
|
||||
|
@ -100,7 +100,7 @@ void MprisControlPlugin::addPlayer(const QString& service)
|
|||
uniqueName = identity + QLatin1String(" [") + QString::number(i) + QLatin1Char(']');
|
||||
}
|
||||
|
||||
MprisPlayer player(service, mediaPlayerObjectPath, DbusHelper::sessionBus());
|
||||
MprisPlayer player(service, mediaPlayerObjectPath, DBusHelper::sessionBus());
|
||||
|
||||
playerList.insert(uniqueName, player);
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ void NotificationsDbusInterface::addNotification(Notification* noti)
|
|||
m_notifications[publicId] = noti;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ void NotificationsDbusInterface::removeNotification(const QString& internalId)
|
|||
}
|
||||
|
||||
//Deleting the notification will unregister it automatically
|
||||
//DbusHelper::sessionBus().unregisterObject(mDevice->dbusPath()+"/notifications/"+publicId);
|
||||
//DBusHelper::sessionBus().unregisterObject(mDevice->dbusPath()+"/notifications/"+publicId);
|
||||
noti->deleteLater();
|
||||
|
||||
Q_EMIT notificationRemoved(publicId);
|
||||
|
|
|
@ -77,7 +77,7 @@ bool PauseMusicPlugin::receivePacket(const NetworkPacket& np)
|
|||
|
||||
if (pause) {
|
||||
//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) {
|
||||
if (iface.startsWith(QLatin1String("org.mpris.MediaPlayer2"))) {
|
||||
QDBusInterface mprisInterface(iface, QStringLiteral("/org/mpris/MediaPlayer2"), QStringLiteral("org.mpris.MediaPlayer2.Player"));
|
||||
|
|
|
@ -132,7 +132,7 @@ void RunCommandConfig::save()
|
|||
|
||||
if (key.isEmpty()) {
|
||||
key = QUuid::createUuid().toString();
|
||||
DbusHelper::filterNonExportableCharacters(key);
|
||||
DBusHelper::filterNonExportableCharacters(key);
|
||||
}
|
||||
QJsonObject entry;
|
||||
entry[QStringLiteral("name")] = name;
|
||||
|
|
|
@ -48,7 +48,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
|
|||
{
|
||||
qRegisterMetaTypeStreamOperators<NotifyingApplication>("NotifyingApplication");
|
||||
|
||||
bool ret = DbusHelper::sessionBus()
|
||||
bool ret = DBusHelper::sessionBus()
|
||||
.registerObject(QStringLiteral("/org/freedesktop/Notifications"),
|
||||
this,
|
||||
QDBusConnection::ExportScriptableContents);
|
||||
|
@ -56,7 +56,7 @@ NotificationsListener::NotificationsListener(KdeConnectPlugin* aPlugin)
|
|||
qCWarning(KDECONNECT_PLUGIN_SENDNOTIFICATION)
|
||||
<< "Error registering notifications listener for device"
|
||||
<< m_plugin->device()->name() << ":"
|
||||
<< DbusHelper::sessionBus().lastError();
|
||||
<< DBusHelper::sessionBus().lastError();
|
||||
else
|
||||
qCDebug(KDECONNECT_PLUGIN_SENDNOTIFICATION)
|
||||
<< "Registered notifications listener for device"
|
||||
|
@ -80,7 +80,7 @@ NotificationsListener::~NotificationsListener()
|
|||
QStringLiteral("org.freedesktop.DBus"));
|
||||
QDBusMessage res = iface.call(QStringLiteral("RemoveMatch"),
|
||||
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()
|
||||
|
|
|
@ -34,12 +34,12 @@ class PrivateDBusTest : public QObject
|
|||
public:
|
||||
PrivateDBusTest()
|
||||
{
|
||||
DbusHelper::launchDBusDaemon();
|
||||
DBusHelper::launchDBusDaemon();
|
||||
}
|
||||
|
||||
~PrivateDBusTest()
|
||||
{
|
||||
DbusHelper::closeDBusDaemon();
|
||||
DBusHelper::closeDBusDaemon();
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
|
@ -53,7 +53,7 @@ private Q_SLOTS:
|
|||
*/
|
||||
void PrivateDBusTest::testConnectionWithPrivateDBus()
|
||||
{
|
||||
QDBusConnection conn = DbusHelper::sessionBus();
|
||||
QDBusConnection conn = DBusHelper::sessionBus();
|
||||
|
||||
QVERIFY2(conn.isConnected(), "Connection not established");
|
||||
QVERIFY2(conn.name() == QStringLiteral(KDECONNECT_PRIVATE_DBUS_NAME),
|
||||
|
@ -65,7 +65,7 @@ void PrivateDBusTest::testConnectionWithPrivateDBus()
|
|||
*/
|
||||
void PrivateDBusTest::testServiceRegistrationWithPrivateDBus()
|
||||
{
|
||||
QDBusConnection conn = DbusHelper::sessionBus();
|
||||
QDBusConnection conn = DBusHelper::sessionBus();
|
||||
QVERIFY2(conn.isConnected(), "DBus not connected");
|
||||
|
||||
QDBusConnectionInterface *bus = conn.interface();
|
||||
|
@ -82,7 +82,7 @@ void PrivateDBusTest::testServiceRegistrationWithPrivateDBus()
|
|||
*/
|
||||
void PrivateDBusTest::testMethodCallWithPrivateDBus()
|
||||
{
|
||||
QDBusConnection conn = DbusHelper::sessionBus();
|
||||
QDBusConnection conn = DBusHelper::sessionBus();
|
||||
QVERIFY2(conn.isConnected(), "DBus not connected");
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
msg.setArguments({ url.toString() });
|
||||
blockOnReply(DbusHelper::sessionBus().asyncCall(msg));
|
||||
blockOnReply(DBusHelper::sessionBus().asyncCall(msg));
|
||||
return 0;
|
||||
} else {
|
||||
QTextStream(stderr) << (i18n("Couldn't share %1", url.toString())) << endl;
|
||||
|
|
Loading…
Reference in a new issue