mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
solid: unmount optical drives conditionally
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
b77a8b70fd
commit
49637b249d
1 changed files with 8 additions and 2 deletions
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "udevopticaldrive.h"
|
#include "udevopticaldrive.h"
|
||||||
|
#include "kmountpoint.h"
|
||||||
|
|
||||||
#include <QDBusInterface>
|
#include <QDBusInterface>
|
||||||
#include <QDBusReply>
|
#include <QDBusReply>
|
||||||
|
@ -64,8 +65,13 @@ OpticalDrive::~OpticalDrive()
|
||||||
bool OpticalDrive::eject()
|
bool OpticalDrive::eject()
|
||||||
{
|
{
|
||||||
// cdio fails to unmount unless current user is root
|
// cdio fails to unmount unless current user is root
|
||||||
QDBusInterface soliduiserver("org.kde.kded", "/modules/soliduiserver", "org.kde.SolidUiServer");
|
const KMountPoint::List mountpoints = KMountPoint::currentMountPoints();
|
||||||
soliduiserver.call("unmountUdi", m_device->udi());
|
const QString devname(m_device->deviceProperty("DEVNAME"));
|
||||||
|
const KMountPoint::Ptr mp = mountpoints.findByDevice(devname);
|
||||||
|
if (mp && !mp->mountPoint().isEmpty()) {
|
||||||
|
QDBusInterface soliduiserver("org.kde.kded", "/modules/soliduiserver", "org.kde.SolidUiServer");
|
||||||
|
soliduiserver.call("unmountUdi", m_device->udi());
|
||||||
|
}
|
||||||
|
|
||||||
emit ejectRequested(m_device->udi());
|
emit ejectRequested(m_device->udi());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue