diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-15 13:02:18 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-15 13:02:18 -0500 |
commit | 670690fd79441ec2856a77b344ad3d3619e9565a (patch) | |
tree | 846540cdd918f5ceb3d1e8f6ede1e7440898c146 /tdeioslave/media/mounthelper | |
parent | 41c013e06c430febb6a5353286573c968ca01440 (diff) | |
download | tdebase-670690fd79441ec2856a77b344ad3d3619e9565a.tar.gz tdebase-670690fd79441ec2856a77b344ad3d3619e9565a.zip |
Use the TDE HW library to eject devices
This resolves Bug 1450
Diffstat (limited to 'tdeioslave/media/mounthelper')
-rw-r--r-- | tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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 <kprocess.h> #include <tdestartupinfo.h> #include <kmimetype.h> +#include <tdehardwaredevices.h> #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<TDEStorageDevice*>(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) |