From 670690fd79441ec2856a77b344ad3d3619e9565a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 15 Apr 2013 13:02:18 -0500 Subject: [PATCH] Use the TDE HW library to eject devices This resolves Bug 1450 --- .../media/mounthelper/tdeio_media_mounthelper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp index 4dbb427f5..b07705373 100644 --- a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp +++ b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "dialog.h" #include "tdeio_media_mounthelper.h" @@ -186,6 +187,18 @@ MountHelper::MountHelper() : TDEApplication() void MountHelper::invokeEject(const TQString &device, bool quiet) { + // Try TDE HW library eject first... + TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); + TDEGenericDevice *hwdevice = hwdevices->findByDeviceNode(device); + if (hwdevice->type() == TDEGenericDeviceType::Disk) { + TDEStorageDevice* sdevice = static_cast(hwdevice); + if (sdevice->ejectDrive()) { + // Success! + ::exit(0); + } + } + + // Then fall back to kdeeject if needed TDEProcess *proc = new TDEProcess(TQT_TQOBJECT(this)); *proc << "kdeeject"; if (quiet)