[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/solid/solid/backends/hal
From:       Kevin Ottens <ervin () kde ! org>
Date:       2007-06-14 2:32:06
Message-ID: 1181788326.663123.10662.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 675343 by ervin:

Work around a bug in HAL preventing to call eject on an optical
drive containing a disc...


 M  +24 -2     halcdrom.cpp  


--- trunk/KDE/kdelibs/solid/solid/backends/hal/halcdrom.cpp #675342:675343
@@ -104,8 +104,30 @@
 
 Solid::OpticalDrive::EjectStatus Cdrom::eject()
 {
-    QDBusInterface drive("org.freedesktop.Hal", m_device->udi(),
-                         "org.freedesktop.Hal.Device.Storage",
+    QString udi = m_device->udi();
+    QString interface = "org.freedesktop.Hal.Device.Storage";
+
+    // HACK: Eject doesn't work on cdrom drives when there's a mounted disc,
+    // let's try to workaround this by calling a child volume...
+    if (m_device->property("storage.removable.media_available").toBool()) {
+        QDBusInterface manager("org.freedesktop.Hal",
+                               "/org/freedesktop/Hal/Manager",
+                               "org.freedesktop.Hal.Manager",
+                               QDBusConnection::systemBus());
+
+        QDBusReply<QStringList> reply = manager.call("FindDeviceStringMatch", "info.parent", udi);
+
+        if (reply.isValid())
+        {
+            QStringList udis = reply;
+            if (!udis.isEmpty()) {
+                udi = udis[0];
+                interface = "org.freedesktop.Hal.Device.Volume";
+            }
+        }
+    }
+
+    QDBusInterface drive("org.freedesktop.Hal", udi, interface,
                          QDBusConnection::systemBus());
 
     if (!drive.isValid()) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic