summaryrefslogtreecommitdiffstats
path: root/tdeioslave
diff options
context:
space:
mode:
Diffstat (limited to 'tdeioslave')
-rw-r--r--tdeioslave/media/mediamanager/tdehardwarebackend.cpp76
1 files changed, 41 insertions, 35 deletions
diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
index deaaf08e7..d974d0867 100644
--- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
+++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
@@ -152,7 +152,13 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
&& !(sdevice->isDiskOfType(TDEDiskDeviceType::CDAudio))
&& !(sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank))
) {
- //
+ //
+ }
+ /* We also don't display devices that underlie other devices;
+ /* e.g. the raw partition of a device mapper volume
+ */
+ else if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsedByDevice)) {
+ //
}
else {
// Create medium
@@ -168,7 +174,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
medium->setHidden(false);
}
}
-
+
// Insert medium into list
m_mediaList.addMedium(medium, allowNotification);
@@ -211,7 +217,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
// Create medium
Medium* medium = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), "");
setVolumeProperties(medium);
-
+
// Insert medium into list
m_mediaList.addMedium(medium, allowNotification);
@@ -240,7 +246,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
&& !(sdevice->isDiskOfType(TDEDiskDeviceType::Floppy))
&& !(sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank))
) {
- //
+ //
}
else {
// Create medium
@@ -386,7 +392,7 @@ void TDEBackend::ResetProperties(TDEStorageDevice * sdevice, bool allowNotificat
&& !(sdevice->isDiskOfType(TDEDiskDeviceType::Floppy))
&& !(sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank))
) {
- //
+ //
}
else {
// Do not list the LUKS backend device if it has been unlocked elsewhere
@@ -536,7 +542,7 @@ void TDEBackend::setVolumeProperties(Medium* medium)
diskLabel = i18n("Blank Mount Ranier CD-RW-W");
}
}
-
+
if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDROM)) {
mimeType = "media/dvd" + MOUNT_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
@@ -545,7 +551,7 @@ void TDEBackend::setVolumeProperties(Medium* medium)
diskLabel = i18n("Blank DVD-ROM");
}
}
-
+
if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDRAM)) {
mimeType = "media/dvd" + MOUNT_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
@@ -680,7 +686,7 @@ void TDEBackend::setVolumeProperties(Medium* medium)
diskLabel = i18n("Blank HDDVD-RW");
}
}
-
+
if (sdevice->isDiskOfType(TDEDiskDeviceType::CDAudio)) {
mimeType = "media/audiocd";
medium->unmountableState("audiocd:/?device=" + sdevice->deviceNode());
@@ -696,7 +702,7 @@ void TDEBackend::setVolumeProperties(Medium* medium)
if (sdevice->isDiskOfType(TDEDiskDeviceType::BDVideo)) {
mimeType = "media/bdvideo";
}
-
+
medium->setIconName(TQString::null);
}
else {
@@ -784,7 +790,7 @@ bool TDEBackend::setFloppyProperties(Medium* medium)
else {
medium->setEncrypted(false);
}
-
+
// USAGE: mountableState(Device node, Mount point, Filesystem type, Mounted ?)
medium->mountableState(sdevice->deviceNode(), sdevice->mountPath(), sdevice->fileSystemName(), !sdevice->mountPath().isNull());
}
@@ -819,11 +825,11 @@ bool TDEBackend::setFloppyProperties(Medium* medium)
}
medium->setLabel(diskLabel);
}
-
+
/** @todo Mimetype for JAZ drives ? */
-
+
medium->setIconName(TQString::null);
-
+
return true;
}
@@ -867,7 +873,7 @@ void TDEBackend::setFloppyMountState( Medium *medium )
KMountPoint::List mtab = KMountPoint::currentMountPoints();
KMountPoint::List::iterator it = mtab.begin();
KMountPoint::List::iterator end = mtab.end();
-
+
TQString fstype;
TQString mountpoint;
for (; it!=end; ++it) {
@@ -1104,36 +1110,36 @@ bool TDEBackend::setMountoptions(const TQString &name, const TQStringList &optio
TQString drive_udi = driveUDIFromDeviceUID(medium->id());
kdDebug(1219) << "setMountoptions " << name << " " << options << endl;
-
+
TDEConfig config("mediamanagerrc");
config.setGroup(drive_udi);
-
+
TQMap<TQString,TQString> valids = MediaManagerUtils::splitOptions(options);
-
+
const char *names[] = { "use_defaults", "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", 0 };
for (int index = 0; names[index]; ++index) {
if (valids.contains(names[index])) {
config.writeEntry(names[index], valids[names[index]] == "true");
}
}
-
+
if (valids.contains("shortname")) {
config.writeEntry("shortname", valids["shortname"]);
}
-
+
if (valids.contains("journaling")) {
config.writeEntry("journaling", valids["journaling"]);
}
-
+
if (!mountoptions(name).contains(TQString("mountpoint=%1").arg(valids["mountpoint"]))) {
config.writeEntry("mountpoint", valids["mountpoint"]);
}
-
+
if (valids.contains("automount")) {
config.setGroup(drive_udi);
config.writeEntry("automount", valids["automount"]);
}
-
+
return true;
}
@@ -1152,14 +1158,14 @@ TQString TDEBackend::mount(const Medium *medium)
if (medium->isMounted()) {
return TQString(); // that was easy
}
-
+
TQString mountPoint = isInFstab(medium);
if (!mountPoint.isNull())
{
struct mount_job_data data;
data.completed = false;
data.medium = medium;
-
+
TDEIO::Job *job = TDEIO::mount( false, 0, medium->deviceNode(), mountPoint );
connect(job, TQT_SIGNAL( result (TDEIO::Job *)), TQT_SLOT( slotResult( TDEIO::Job *)));
mount_jobs[job] = &data;
@@ -1170,7 +1176,7 @@ TQString TDEBackend::mount(const Medium *medium)
}
// Return the error message (if any) to the caller
return (data.error) ? data.errorMessage : TQString::null;
-
+
}
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
@@ -1181,9 +1187,9 @@ TQString TDEBackend::mount(const Medium *medium)
}
TQString diskLabel;
-
+
TQMap<TQString,TQString> valids = MediaManagerUtils::splitOptions(mountoptions(medium->id()));
-
+
TQString mount_point = valids["mountpoint"];
if (mount_point.startsWith("/media/")) {
diskLabel = mount_point.mid(7);
@@ -1196,7 +1202,7 @@ TQString TDEBackend::mount(const Medium *medium)
diskLabel = medium->label() + " (" + node + ")";
diskLabel.replace("/", "_");
}
-
+
TQString qerror = i18n("Cannot mount encrypted drives!");
if (!medium->isEncrypted()) {
@@ -1228,7 +1234,7 @@ TQString TDEBackend::mount(const Medium *medium)
m_decryptDialog = new Dialog(sdevice->deviceNode(), iconName);
m_decryptDialog->show();
-
+
connect(m_decryptDialog, TQT_SIGNAL (user1Clicked()), this, TQT_SLOT (slotPasswordReady()));
connect(m_decryptDialog, TQT_SIGNAL (cancelClicked()), this, TQT_SLOT (slotPasswordCancel()));
connect(this, TQT_SIGNAL (signalDecryptionPasswordError(TQString)), m_decryptDialog, TQT_SLOT (slotDialogError(TQString)));
@@ -1316,18 +1322,18 @@ TQString TDEBackend::mount(const TQString &_udi)
if (!medium) {
return i18n("No such medium: %1").arg(_udi);
}
-
+
return mount(medium);
}
TQString TDEBackend::unmount(const TQString &_udi)
{
const Medium* medium = m_mediaList.findById(_udi);
-
+
if ( !medium ) {
return i18n("No such medium: %1").arg(_udi);
}
-
+
if (!medium->isMounted()) {
return TQString(); // that was easy
}
@@ -1338,7 +1344,7 @@ TQString TDEBackend::unmount(const TQString &_udi)
struct mount_job_data data;
data.completed = false;
data.medium = medium;
-
+
TDEIO::Job *job = TDEIO::unmount( medium->mountPoint(), false );
connect(job, TQT_SIGNAL( result (TDEIO::Job *)), TQT_SLOT( slotResult( TDEIO::Job *)));
mount_jobs[job] = &data;
@@ -1501,7 +1507,7 @@ TQString TDEBackend::listUsingProcesses(const Medium* medium)
while (!is.atEnd()) {
tmp = is.readLine();
tmp = TQStyleSheet::escape(tmp) + "\n";
-
+
proclist += tmp;
if (counter++ > 10) {
proclist += "...";
@@ -1542,7 +1548,7 @@ TQString TDEBackend::killUsingProcesses(const Medium* medium)
while (!is.atEnd()) {
tmp = is.readLine();
tmp = TQStyleSheet::escape(tmp) + "\n";
-
+
proclist += tmp;
if (counter++ > 10) {
proclist += "...";