2013-07-03 02:52:44 +01:00
|
|
|
/**
|
2013-06-27 01:13:16 +01:00
|
|
|
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License or (at your option) version 3 or any later version
|
|
|
|
* accepted by the membership of KDE e.V. (or its successor approved
|
|
|
|
* by the membership of KDE e.V.), which shall act as a proxy
|
|
|
|
* defined in Section 14 of version 3 of the license.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2013-07-03 02:52:44 +01:00
|
|
|
#include "dbusinterfaces.h"
|
2013-06-27 01:13:16 +01:00
|
|
|
|
2015-06-25 20:19:23 +01:00
|
|
|
QString DaemonDbusInterface::activatedService() {
|
2015-02-24 06:12:45 +00:00
|
|
|
static const QString service = "org.kde.kdeconnect";
|
|
|
|
QDBusConnection::sessionBus().interface()->startService(service);
|
|
|
|
return service;
|
|
|
|
}
|
|
|
|
|
2013-06-27 01:13:16 +01:00
|
|
|
DaemonDbusInterface::DaemonDbusInterface(QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDaemonInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect", QDBusConnection::sessionBus(), parent)
|
2013-07-03 02:52:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DaemonDbusInterface::~DaemonDbusInterface()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-07-03 02:52:44 +01:00
|
|
|
DeviceDbusInterface::DeviceDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
|
2015-06-24 19:57:02 +01:00
|
|
|
, m_id(id)
|
2013-06-27 01:13:16 +01:00
|
|
|
{
|
2015-06-13 00:28:36 +01:00
|
|
|
connect(this, &OrgKdeKdeconnectDeviceInterface::pairingChanged, this, &DeviceDbusInterface::pairingChangedProxy);
|
2013-08-21 17:25:44 +01:00
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DeviceDbusInterface::~DeviceDbusInterface()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-06-24 19:57:02 +01:00
|
|
|
QString DeviceDbusInterface::id() const
|
|
|
|
{
|
|
|
|
return m_id;
|
|
|
|
}
|
|
|
|
|
2015-06-13 00:28:36 +01:00
|
|
|
void DeviceDbusInterface::pluginCall(const QString &plugin, const QString &method)
|
|
|
|
{
|
|
|
|
QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+id()+'/'+plugin, "org.kde.kdeconnect.device."+plugin, method);
|
|
|
|
QDBusConnection::sessionBus().asyncCall(msg);
|
|
|
|
}
|
|
|
|
|
2013-08-21 17:25:44 +01:00
|
|
|
DeviceBatteryDbusInterface::DeviceBatteryDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceBatteryInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DeviceBatteryDbusInterface::~DeviceBatteryDbusInterface()
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceNotificationsInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+id, QDBusConnection::sessionBus(), parent)
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
|
2014-01-16 11:13:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-08-21 17:25:44 +01:00
|
|
|
NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, QDBusConnection::sessionBus(), parent)
|
2013-08-21 17:25:44 +01:00
|
|
|
{
|
|
|
|
|
2014-01-06 20:56:51 +00:00
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
NotificationDbusInterface::~NotificationDbusInterface()
|
2014-01-16 11:13:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-06 20:56:51 +00:00
|
|
|
SftpDbusInterface::SftpDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceSftpInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/sftp", QDBusConnection::sessionBus(), parent)
|
2014-01-06 20:56:51 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-01-16 11:28:48 +00:00
|
|
|
SftpDbusInterface::~SftpDbusInterface()
|
2014-01-16 11:13:17 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2015-06-18 03:01:01 +01:00
|
|
|
|
|
|
|
MprisDbusInterface::MprisDbusInterface(const QString& id, QObject* parent)
|
2015-06-25 20:19:23 +01:00
|
|
|
: OrgKdeKdeconnectDeviceMprisremoteInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/" + id + "/mprisremote", QDBusConnection::sessionBus(), parent)
|
2015-06-18 03:01:01 +01:00
|
|
|
{
|
|
|
|
connect(this, &OrgKdeKdeconnectDeviceMprisremoteInterface::propertiesChanged, this, &MprisDbusInterface::propertiesChangedProxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
MprisDbusInterface::~MprisDbusInterface()
|
|
|
|
{
|
|
|
|
}
|