|
|
@ -28,7 +28,6 @@
|
|
|
|
#include <tqregexp.h>
|
|
|
|
#include <tqregexp.h>
|
|
|
|
#include <tqpixmap.h>
|
|
|
|
#include <tqpixmap.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
#include <tqvariant.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "kdebug.h"
|
|
|
|
#include "kdebug.h"
|
|
|
|
#include "tdelocale.h"
|
|
|
|
#include "tdelocale.h"
|
|
|
@ -310,7 +309,7 @@ bool TDEStorageDevice::lockDriveMedia(bool lock) {
|
|
|
|
|
|
|
|
|
|
|
|
bool TDEStorageDevice::ejectDrive() {
|
|
|
|
bool TDEStorageDevice::ejectDrive() {
|
|
|
|
if (!(TDEGlobal::dirs()->findExe("udisksctl").isEmpty())) {
|
|
|
|
if (!(TDEGlobal::dirs()->findExe("udisksctl").isEmpty())) {
|
|
|
|
TDEStorageOpResult ejectResult = UDisks2EjectDrive(this);
|
|
|
|
TQStringVariantMap ejectResult = UDisks2EjectDrive(this);
|
|
|
|
if (ejectResult["result"].toBool()) {
|
|
|
|
if (ejectResult["result"].toBool()) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -320,7 +319,7 @@ bool TDEStorageDevice::ejectDrive() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!(TDEGlobal::dirs()->findExe("udisks").isEmpty())) {
|
|
|
|
if (!(TDEGlobal::dirs()->findExe("udisks").isEmpty())) {
|
|
|
|
TDEStorageOpResult ejectResult = UDisksEjectDrive(this);
|
|
|
|
TQStringVariantMap ejectResult = UDisksEjectDrive(this);
|
|
|
|
if (ejectResult["result"].toBool()) {
|
|
|
|
if (ejectResult["result"].toBool()) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -702,8 +701,8 @@ TQString TDEStorageDevice::mountPath() {
|
|
|
|
return TQString::null;
|
|
|
|
return TQString::null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDEStorageOpResult TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOptions mountOptions) {
|
|
|
|
TQStringVariantMap TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageMountOptions mountOptions) {
|
|
|
|
TDEStorageOpResult result;
|
|
|
|
TQStringVariantMap result;
|
|
|
|
|
|
|
|
|
|
|
|
// Check if device is already mounted
|
|
|
|
// Check if device is already mounted
|
|
|
|
TQString mountpath = mountPath();
|
|
|
|
TQString mountpath = mountPath();
|
|
|
@ -774,7 +773,7 @@ TDEStorageOpResult TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM
|
|
|
|
fileSystemType = mountOptions["filesystem"];
|
|
|
|
fileSystemType = mountOptions["filesystem"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDEStorageOpResult mountResult = UDisks2MountDrive(devNode, fileSystemType, optionString);
|
|
|
|
TQStringVariantMap mountResult = UDisks2MountDrive(devNode, fileSystemType, optionString);
|
|
|
|
if (mountResult["result"].toBool()) {
|
|
|
|
if (mountResult["result"].toBool()) {
|
|
|
|
// Update internal mount data
|
|
|
|
// Update internal mount data
|
|
|
|
TDEGlobal::hardwareDevices()->processModifiedMounts();
|
|
|
|
TDEGlobal::hardwareDevices()->processModifiedMounts();
|
|
|
@ -901,9 +900,9 @@ TDEStorageOpResult TDEStorageDevice::mountDevice(TQString mediaName, TDEStorageM
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDEStorageOpResult TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName,
|
|
|
|
TQStringVariantMap TDEStorageDevice::mountEncryptedDevice(TQString passphrase, TQString mediaName,
|
|
|
|
TDEStorageMountOptions mountOptions) {
|
|
|
|
TDEStorageMountOptions mountOptions) {
|
|
|
|
TDEStorageOpResult result;
|
|
|
|
TQStringVariantMap result;
|
|
|
|
|
|
|
|
|
|
|
|
// Check if device is already mounted
|
|
|
|
// Check if device is already mounted
|
|
|
|
TQString mountpath = mountPath();
|
|
|
|
TQString mountpath = mountPath();
|
|
|
@ -976,8 +975,8 @@ TDEStorageOpResult TDEStorageDevice::mountEncryptedDevice(TQString passphrase, T
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDEStorageOpResult TDEStorageDevice::unmountDevice() {
|
|
|
|
TQStringVariantMap TDEStorageDevice::unmountDevice() {
|
|
|
|
TDEStorageOpResult result;
|
|
|
|
TQStringVariantMap result;
|
|
|
|
|
|
|
|
|
|
|
|
// Check if device is already unmounted
|
|
|
|
// Check if device is already unmounted
|
|
|
|
TQString mountpoint = mountPath();
|
|
|
|
TQString mountpoint = mountPath();
|
|
|
@ -990,7 +989,7 @@ TDEStorageOpResult TDEStorageDevice::unmountDevice() {
|
|
|
|
TQString devNode = deviceNode();
|
|
|
|
TQString devNode = deviceNode();
|
|
|
|
|
|
|
|
|
|
|
|
// Try to use UDISKS v2 via DBUS, if available
|
|
|
|
// Try to use UDISKS v2 via DBUS, if available
|
|
|
|
TDEStorageOpResult unmountResult = UDisks2UnmountDrive(devNode, TQString::null);
|
|
|
|
TQStringVariantMap unmountResult = UDisks2UnmountDrive(devNode, TQString::null);
|
|
|
|
if (unmountResult["result"].toBool()) {
|
|
|
|
if (unmountResult["result"].toBool()) {
|
|
|
|
// Update internal mount data
|
|
|
|
// Update internal mount data
|
|
|
|
TDEGlobal::hardwareDevices()->processModifiedMounts();
|
|
|
|
TDEGlobal::hardwareDevices()->processModifiedMounts();
|
|
|
|