Minor fixes in udisks2 patch
This commit is contained in:
parent
c8f1a5d078
commit
34d2c6233c
|
@ -471,10 +471,10 @@ index 0000000..19cb70a
|
|||
+#endif // UDISKS2BLOCK_H
|
||||
diff --git a/solid/solid/backends/udisks2/udisksdevice.cpp b/solid/solid/backends/udisks2/udisksdevice.cpp
|
||||
new file mode 100644
|
||||
index 0000000..d70456d
|
||||
index 0000000..b888360
|
||||
--- /dev/null
|
||||
+++ b/solid/solid/backends/udisks2/udisksdevice.cpp
|
||||
@@ -0,0 +1,806 @@
|
||||
@@ -0,0 +1,834 @@
|
||||
+/*
|
||||
+ Copyright 2010 Michael Zanetti <mzanetti@kde.org>
|
||||
+ Copyright 2010-2012 Lukáš Tinkl <ltinkl@redhat.com>
|
||||
|
@ -571,8 +571,12 @@ index 0000000..d70456d
|
|||
+ : Solid::Ifaces::Device()
|
||||
+ , m_backend(DeviceBackend::backendForUDI(udi))
|
||||
+{
|
||||
+ connect(m_backend, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
+ connect(m_backend, SIGNAL(propertyChanged(QMap<QString,int>)), this, SIGNAL(propertyChanged(QMap<QString,int>)));
|
||||
+ if (m_backend) {
|
||||
+ connect(m_backend, SIGNAL(changed()), this, SIGNAL(changed()));
|
||||
+ connect(m_backend, SIGNAL(propertyChanged(QMap<QString,int>)), this, SIGNAL(propertyChanged(QMap<QString,int>)));
|
||||
+ } else {
|
||||
+ qDebug() << "Created invalid Device for udi" << udi;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+Device::~Device()
|
||||
|
@ -1103,7 +1107,11 @@ index 0000000..d70456d
|
|||
+
|
||||
+QString Device::udi() const
|
||||
+{
|
||||
+ return m_backend->udi;
|
||||
+ if (m_backend) {
|
||||
+ return m_backend->udi;
|
||||
+ }
|
||||
+
|
||||
+ return QString();
|
||||
+}
|
||||
+
|
||||
+QString Device::parentUdi() const
|
||||
|
@ -1122,27 +1130,47 @@ index 0000000..d70456d
|
|||
+
|
||||
+QVariant Device::prop(const QString &key) const
|
||||
+{
|
||||
+ return m_backend->prop(key);
|
||||
+ if (m_backend) {
|
||||
+ return m_backend->prop(key);
|
||||
+ }
|
||||
+
|
||||
+ return QVariant();
|
||||
+}
|
||||
+
|
||||
+bool Device::propertyExists(const QString &key) const
|
||||
+{
|
||||
+ return m_backend->propertyExists(key);
|
||||
+ if (m_backend) {
|
||||
+ return m_backend->propertyExists(key);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+QVariantMap Device::allProperties() const
|
||||
+{
|
||||
+ return m_backend->allProperties();
|
||||
+ if (m_backend) {
|
||||
+ return m_backend->allProperties();
|
||||
+ }
|
||||
+
|
||||
+ return QVariantMap();
|
||||
+}
|
||||
+
|
||||
+bool Device::hasInterface(const QString &name) const
|
||||
+{
|
||||
+ return m_backend->interfaces().contains(name);
|
||||
+ if (m_backend) {
|
||||
+ return m_backend->interfaces().contains(name);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+QStringList Device::interfaces() const
|
||||
+{
|
||||
+ return m_backend->interfaces();
|
||||
+ if (m_backend) {
|
||||
+ return m_backend->interfaces();
|
||||
+ }
|
||||
+
|
||||
+ return QStringList();
|
||||
+}
|
||||
+
|
||||
+QString Device::errorToString(const QString & error) const
|
||||
|
@ -1392,10 +1420,10 @@ index 0000000..90bb042
|
|||
+#endif // UDISKS2DEVICE_H
|
||||
diff --git a/solid/solid/backends/udisks2/udisksdevicebackend.cpp b/solid/solid/backends/udisks2/udisksdevicebackend.cpp
|
||||
new file mode 100644
|
||||
index 0000000..895a79c
|
||||
index 0000000..ffa98db
|
||||
--- /dev/null
|
||||
+++ b/solid/solid/backends/udisks2/udisksdevicebackend.cpp
|
||||
@@ -0,0 +1,203 @@
|
||||
@@ -0,0 +1,205 @@
|
||||
+/*
|
||||
+ Copyright 2010 Michael Zanetti <mzanetti@kde.org>
|
||||
+ Copyright 2010-2012 Lukáš Tinkl <ltinkl@redhat.com>
|
||||
|
@ -1435,6 +1463,9 @@ index 0000000..895a79c
|
|||
+DeviceBackend* DeviceBackend::backendForUDI(const QString& udi)
|
||||
+{
|
||||
+ DeviceBackend *backend = 0;
|
||||
+ if (udi.isEmpty()) {
|
||||
+ return backend;
|
||||
+ }
|
||||
+
|
||||
+ if (s_backends.contains(udi)) {
|
||||
+ backend = s_backends.value(udi);
|
||||
|
@ -1449,10 +1480,10 @@ index 0000000..895a79c
|
|||
+DeviceBackend::DeviceBackend(const QString& udi)
|
||||
+ : udi(udi)
|
||||
+{
|
||||
+ qDebug() << udi;
|
||||
+ qDebug() << "Creating backend for device" << udi;
|
||||
+ m_device = new QDBusInterface(UD2_DBUS_SERVICE, udi,
|
||||
+ QString(), // no interface, we aggregate them
|
||||
+ QDBusConnection::systemBus());
|
||||
+ QString(), // no interface, we aggregate them
|
||||
+ QDBusConnection::systemBus(), this);
|
||||
+
|
||||
+ if (m_device->isValid()) {
|
||||
+ QDBusConnection::systemBus().connect(UD2_DBUS_SERVICE, udi, DBUS_INTERFACE_PROPS, "PropertiesChanged", this,
|
||||
|
@ -1468,7 +1499,6 @@ index 0000000..895a79c
|
|||
+
|
||||
+DeviceBackend::~DeviceBackend()
|
||||
+{
|
||||
+ delete m_device;
|
||||
+}
|
||||
+
|
||||
+void DeviceBackend::initInterfaces()
|
||||
|
|
Loading…
Reference in New Issue