summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media/mediamanager
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2019-08-24 18:25:55 +0900
committerMichele Calgaro <[email protected]>2020-10-17 10:48:28 +0800
commitd34f23f403e82f352e4c5d4e20966bcba2bec8c6 (patch)
treea1c02a3f85d2cf018f279bca095d5012702701e5 /tdeioslave/media/mediamanager
parentebc4784c4fddeb307f4bc2ab83b4189312f24f3b (diff)
downloadtdebase-d34f23f403e82f352e4c5d4e20966bcba2bec8c6.tar.gz
tdebase-d34f23f403e82f352e4c5d4e20966bcba2bec8c6.zip
tdeioslave media: clean up code related to medium mountable state in preparation for further work.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdeioslave/media/mediamanager')
-rw-r--r--tdeioslave/media/mediamanager/fstabbackend.cpp12
-rw-r--r--tdeioslave/media/mediamanager/halbackend.cpp82
-rw-r--r--tdeioslave/media/mediamanager/medialist.cpp44
-rw-r--r--tdeioslave/media/mediamanager/removablebackend.cpp7
-rw-r--r--tdeioslave/media/mediamanager/tdehardwarebackend.cpp106
5 files changed, 164 insertions, 87 deletions
diff --git a/tdeioslave/media/mediamanager/fstabbackend.cpp b/tdeioslave/media/mediamanager/fstabbackend.cpp
index 8eca21771..acd1dced2 100644
--- a/tdeioslave/media/mediamanager/fstabbackend.cpp
+++ b/tdeioslave/media/mediamanager/fstabbackend.cpp
@@ -220,7 +220,11 @@ void FstabBackend::handleMtabChange(bool allowNotification)
Medium *m = new Medium(id, name);
- m->mountableState(dev, mp, fs, true);
+ m->setMountable(true);
+ m->setDeviceNode(dev);
+ m->setMountPoint(mp);
+ m->setFsType(fs);
+ m->setMounted(true);
TQString mime, icon, label;
guess(dev, mp, fs, true, mime, icon, label);
@@ -293,7 +297,11 @@ void FstabBackend::handleFstabChange(bool allowNotification)
Medium *m = new Medium(id, id, name);
- m->mountableState(dev, mp, fs, false);
+ m->setMountable(true);
+ m->setDeviceNode(dev);
+ m->setMountPoint(mp);
+ m->setFsType(fs);
+ m->setMounted(false);
TQString mime, icon, label;
guess(dev, mp, fs, false, mime, icon, label);
diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp
index b6f35c997..e05b5c3e8 100644
--- a/tdeioslave/media/mediamanager/halbackend.cpp
+++ b/tdeioslave/media/mediamanager/halbackend.cpp
@@ -516,28 +516,32 @@ void HALBackend::setVolumeProperties(Medium* medium)
}
if (halClearVolume)
- medium->mountableState(
- libhal_volume_get_device_file(halVolume), /* Device node */
- clearUdiString,
- libhal_volume_get_mount_point(halClearVolume), /* Mount point */
- libhal_volume_get_fstype(halClearVolume), /* Filesystem type */
- libhal_volume_is_mounted(halClearVolume) ); /* Mounted ? */
+ {
+ medium->setMountable(true);
+ medium->setDeviceNode(libhal_volume_get_device_file(halVolume));
+ medium->setClearDeviceUdi(clearUdiString);
+ medium->setMountPoint(libhal_volume_get_mount_point(halClearVolume));
+ medium->setFsType(libhal_volume_get_fstype(halClearVolume));
+ medium->setMounted(libhal_volume_is_mounted(halClearVolume));
+ }
else
- medium->mountableState(
- libhal_volume_get_device_file(halVolume), /* Device node */
- TQString::null,
- TQString::null, /* Mount point */
- TQString::null, /* Filesystem type */
- false ); /* Mounted ? */
+ {
+ medium->setMountable(true);
+ medium->setDeviceNode(libhal_volume_get_device_file(halVolume));
+ medium->setClearDeviceUdi(TQString::null);
+ medium->setMountPoint(TQString::null);
+ medium->setFsType(TQString::null);
+ medium->setMounted(false);
+ }
}
else
{
kdDebug(1219) << "HALBackend::setVolumeProperties : normal volume" << endl;
- medium->mountableState(
- libhal_volume_get_device_file(halVolume), /* Device node */
- TQString::fromUtf8(libhal_volume_get_mount_point(halVolume)), /* Mount point */
- libhal_volume_get_fstype(halVolume), /* Filesystem type */
- libhal_volume_is_mounted(halVolume) ); /* Mounted ? */
+ medium->setMountable(true);
+ medium->setDeviceNode(libhal_volume_get_device_file(halVolume));
+ medium->setMountPoint(TQString::fromUtf8(libhal_volume_get_mount_point(halVolume)));
+ medium->setFsType(libhal_volume_get_fstype(halVolume));
+ medium->setMounted(libhal_volume_is_mounted(halVolume));
}
@@ -570,7 +574,8 @@ void HALBackend::setVolumeProperties(Medium* medium)
if (libhal_volume_disc_is_blank(halVolume))
{
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
}
else
{
@@ -584,7 +589,8 @@ void HALBackend::setVolumeProperties(Medium* medium)
if (libhal_volume_disc_is_blank(halVolume))
{
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
}
else
{
@@ -609,7 +615,8 @@ void HALBackend::setVolumeProperties(Medium* medium)
if (libhal_volume_disc_has_audio(halVolume) && !libhal_volume_disc_has_data(halVolume))
{
mimeType = "media/audiocd";
- medium->unmountableState( "audiocd:/?device=" + TQString(libhal_volume_get_device_file(halVolume)) );
+ medium->setMountable(false);
+ medium->setBaseURL("audiocd:/?device=" + TQString(libhal_volume_get_device_file(halVolume)));
}
medium->setIconName(TQString::null);
@@ -653,12 +660,14 @@ void HALBackend::setVolumeProperties(Medium* medium)
case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER:
{
medium->setIconName("ipod" + MOUNTED_ICON_SUFFIX);
+ medium->setMountable(false);
if (libhal_device_get_property_QString(m_halContext, driveUdi.latin1(), "info.product") == "iPod" &&
- KProtocolInfo::isKnownProtocol( TQString("ipod") ) )
+ KProtocolInfo::isKnownProtocol( TQString("ipod") ) )
{
- medium->unmountableState( "ipod:/" );
- medium->mountableState( libhal_volume_is_mounted(halVolume) );
+ medium->setBaseURL("ipod:/");
+ medium->setMountable(true);
+ medium->setMounted(libhal_volume_is_mounted(halVolume));
}
break;
}
@@ -723,11 +732,11 @@ bool HALBackend::setFstabProperties( Medium *medium )
if ( fstype.isNull() )
fstype = "auto";
- medium->mountableState(
- medium->deviceNode(),
- mp, /* Mount point */
- fstype, /* Filesystem type */
- mounted ); /* Mounted ? */
+ medium->setMountable(true);
+ medium->setDeviceNode(medium->deviceNode());
+ medium->setMountPoint(mp);
+ medium->setFsType(fstype);
+ medium->setMounted(mounted);
return true;
}
@@ -768,7 +777,11 @@ bool HALBackend::setFloppyProperties(Medium* medium)
medium->setLabel(i18n("Unknown Drive"));
// HAL hates floppies - so we have to do it twice ;(
- medium->mountableState(libhal_drive_get_device_file(halDrive), TQString::null, TQString::null, false);
+ medium->setMountable(true);
+ medium->setDeviceNode(libhal_drive_get_device_file(halDrive));
+ medium->setMountPoint(TQString::null);
+ medium->setFsType(TQString::null);
+ medium->setMounted(false);
setFloppyMountState(medium);
if (drive_type == "floppy")
@@ -813,7 +826,11 @@ void HALBackend::setFloppyMountState( Medium *medium )
{
fstype = (*it)->mountType().isNull() ? (*it)->mountType() : "auto";
mountpoint = (*it)->mountPoint();
- medium->mountableState( medium->deviceNode(), mountpoint, fstype, true );
+ medium->setMountable(true);
+ medium->setDeviceNode(medium->deviceNode());
+ medium->setMountPoint(mountpoint);
+ medium->setFsType(fstype);
+ medium->setMounted(true);
return;
}
}
@@ -847,7 +864,8 @@ void HALBackend::setCameraProperties(Medium* medium)
libhal_free_string(cam);
/** @todo find the rest of this URL */
- medium->unmountableState(device);
+ medium->setMountable(false);
+ medium->setBaseURL(device);
medium->setMimeType("media/gphoto2camera");
medium->setIconName(TQString::null);
if (libhal_device_property_exists(m_halContext, udi, "usb_device.product", NULL))
@@ -1605,7 +1623,6 @@ TQStringVariantMap HALBackend::mount(const Medium *medium)
return result;
}
- medium->setHalMounted(true);
ResetProperties(medium->id().latin1());
result["result"] = true;
@@ -1812,7 +1829,6 @@ TQStringVariantMap HALBackend::unmount(const TQString &id)
dbus_message_unref (reply);
}
- medium->setHalMounted(false);
ResetProperties(medium->id().latin1());
while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;
diff --git a/tdeioslave/media/mediamanager/medialist.cpp b/tdeioslave/media/mediamanager/medialist.cpp
index b06824d0c..dc0a108d6 100644
--- a/tdeioslave/media/mediamanager/medialist.cpp
+++ b/tdeioslave/media/mediamanager/medialist.cpp
@@ -128,42 +128,42 @@ bool MediaList::changeMediumState(const Medium &medium, bool allowNotification)
{
kdDebug(1219) << "MediaList::changeMediumState(const Medium &) for id " << medium.id() << endl;
- if ( !m_idMap.contains(medium.id()) ) return false;
+ if (!m_idMap.contains(medium.id())) return false;
Medium *m = m_idMap[medium.id()];
- if ( medium.isMountable() )
+ m->setMountable(medium.isMountable());
+ if (medium.isMountable())
{
- TQString device_node = medium.deviceNode();
- TQString clear_device_udi = medium.clearDeviceUdi();
- TQString mount_point = medium.mountPoint();
- TQString fs_type = medium.fsType();
- bool mounted = medium.isMounted();
-
- m->mountableState( device_node, clear_device_udi, mount_point, fs_type, mounted );
+ m->setMountable(true);
+ m->setDeviceNode(medium.deviceNode());
+ m->setClearDeviceUdi(medium.clearDeviceUdi());
+ m->setMountPoint(medium.mountPoint());
+ m->setFsType(medium.fsType());
+ m->setMounted(medium.isMounted());
}
else
{
- m->unmountableState( medium.baseURL() );
+ m->setBaseURL(medium.baseURL());
}
-
if (!medium.mimeType().isEmpty())
{
- m->setMimeType( medium.mimeType() );
+ m->setMimeType(medium.mimeType());
}
if (!medium.iconName().isEmpty())
{
- m->setIconName( medium.iconName() );
+ m->setIconName(medium.iconName());
}
if (!medium.label().isEmpty())
{
- m->setLabel( medium.label() );
+ m->setLabel(medium.label());
}
m->setHidden(medium.hidden());
+ m->setSoftHidden(medium.softHidden());
emit mediumStateChanged(m->id(), m->name(), !m->needMounting(), allowNotification);
return true;
@@ -184,7 +184,8 @@ bool MediaList::changeMediumState(const TQString &id,
Medium *medium = m_idMap[id];
- medium->unmountableState( baseURL );
+ medium->setMountable(false);
+ medium->setBaseURL(baseURL);
if (!mimeType.isEmpty())
{
@@ -225,7 +226,11 @@ bool MediaList::changeMediumState(const TQString &id,
Medium *medium = m_idMap[id];
- medium->mountableState( deviceNode, mountPoint, fsType, mounted );
+ medium->setMountable(true);
+ medium->setDeviceNode(deviceNode);
+ medium->setMountPoint(mountPoint);
+ medium->setFsType(fsType);
+ medium->setMounted(mounted);
if (!mimeType.isEmpty())
{
@@ -262,7 +267,12 @@ bool MediaList::changeMediumState(const TQString &id, bool mounted,
Medium *medium = m_idMap[id];
- if ( !medium->mountableState( mounted ) ) return false;
+ medium->setMountable(true);
+ medium->setMounted(mounted);
+ if (medium->deviceNode().isEmpty() || !medium->isMountable())
+ {
+ return false;
+ }
if (!mimeType.isEmpty())
{
diff --git a/tdeioslave/media/mediamanager/removablebackend.cpp b/tdeioslave/media/mediamanager/removablebackend.cpp
index 54df3d6f1..dacb9b704 100644
--- a/tdeioslave/media/mediamanager/removablebackend.cpp
+++ b/tdeioslave/media/mediamanager/removablebackend.cpp
@@ -63,8 +63,11 @@ bool RemovableBackend::plug(const TQString &devNode, const TQString &label)
if (!m_removableIds.contains(id))
{
Medium *medium = new Medium(id, id, name);
- medium->mountableState(devNode, TQString::null,
- TQString::null, false);
+ medium->setMountable(true);
+ medium->setDeviceNode(devNode);
+ medium->setMountPoint(TQString::null);
+ medium->setFsType(TQString::null);
+ medium->setMounted(false);
TQStringList words = TQStringList::split(" ", label);
diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
index 45c58081d..dc780d455 100644
--- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
+++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
@@ -465,8 +465,11 @@ void TDEBackend::setVolumeProperties(Medium* medium)
medium->setEncrypted(false);
}
- // USAGE: mountableState(Device node, Mount point, Filesystem type, Mounted ?)
- medium->mountableState(sdevice->deviceNode(), sdevice->mountPath(), sdevice->fileSystemName(), !sdevice->mountPath().isNull());
+ medium->setMountable(true);
+ medium->setDeviceNode(sdevice->deviceNode());
+ medium->setMountPoint(sdevice->mountPath());
+ medium->setFsType(sdevice->fileSystemName());
+ medium->setMounted(!sdevice->mountPath().isEmpty());
TQString diskLabel = sdevice->diskLabel();
bool useDefaultLabel = diskLabel.isNull();
@@ -515,7 +518,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/cdrom" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank CD-ROM");
}
}
@@ -524,7 +528,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/cd-r" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank CD-R");
}
}
@@ -533,7 +538,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank CD-RW");
}
}
@@ -542,7 +548,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Magneto-Optical CD");
}
}
@@ -551,7 +558,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Mount Ranier CD-RW");
}
}
@@ -560,7 +568,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankcd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Mount Ranier CD-RW-W");
}
}
@@ -569,7 +578,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank DVD-ROM");
}
}
@@ -578,7 +588,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank DVD-RAM");
}
}
@@ -587,7 +598,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank DVD-R");
}
}
@@ -596,7 +608,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank DVD-RW");
}
}
@@ -605,7 +618,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Dual Layer DVD-R");
}
}
@@ -614,7 +628,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Dual Layer DVD-RW");
}
}
@@ -623,7 +638,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank DVD+R");
}
}
@@ -632,7 +648,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank DVD+RW");
}
}
@@ -641,7 +658,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Dual Layer DVD+R");
}
}
@@ -650,7 +668,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankdvd";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank Dual Layer DVD+RW");
}
}
@@ -659,7 +678,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankbluray";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank BLURAY-ROM");
}
}
@@ -668,7 +688,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankbluray";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank BLURAY-R");
}
}
@@ -677,7 +698,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankbluray";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank BLURAY-RW");
}
}
@@ -686,7 +708,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankbluray";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank HDDVD-ROM");
}
}
@@ -695,7 +718,8 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankbluray";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank HDDVD-R");
}
}
@@ -704,14 +728,16 @@ void TDEBackend::setVolumeProperties(Medium* medium)
mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX;
if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) {
mimeType = "media/blankbluray";
- medium->unmountableState("");
+ medium->setMountable(false);
+ medium->setBaseURL(TQString::null);
diskLabel = i18n("Blank HDDVD-RW");
}
}
if (sdevice->isDiskOfType(TDEDiskDeviceType::CDAudio)) {
mimeType = "media/audiocd";
- medium->unmountableState("audiocd:/?device=" + sdevice->deviceNode());
+ medium->setMountable(false);
+ medium->setBaseURL("audiocd:/?device=" + sdevice->deviceNode());
diskLabel = i18n("Audio CD");
}
@@ -759,9 +785,11 @@ void TDEBackend::setVolumeProperties(Medium* medium)
}
if (sdevice->isDiskOfType(TDEDiskDeviceType::MediaDevice)) {
medium->setIconName("ipod" + MOUNTED_ICON_SUFFIX);
- if (sdevice->vendorModel().upper().contains("IPOD") && KProtocolInfo::isKnownProtocol( TQString("ipod") ) ) {
- medium->unmountableState( "ipod:/" );
- medium->mountableState(!sdevice->mountPath().isNull());
+ medium->setMountable(false);
+ if (sdevice->vendorModel().upper().contains("IPOD") && KProtocolInfo::isKnownProtocol(TQString("ipod"))) {
+ medium->setBaseURL("ipod:/");
+ medium->setMountable(true);
+ medium->setMounted(!sdevice->mountPath().isEmpty());
}
}
if (sdevice->isDiskOfType(TDEDiskDeviceType::Tape)) {
@@ -801,15 +829,22 @@ bool TDEBackend::setFloppyProperties(Medium* medium)
medium->setEncrypted(false);
}
- // USAGE: mountableState(Device node, Mount point, Filesystem type, Mounted ?)
- medium->mountableState(sdevice->deviceNode(), sdevice->mountPath(), sdevice->fileSystemName(), !sdevice->mountPath().isNull());
+ medium->setMountable(true);
+ medium->setDeviceNode(sdevice->deviceNode());
+ medium->setMountPoint(sdevice->mountPath());
+ medium->setFsType(sdevice->fileSystemName());
+ medium->setMounted(!sdevice->mountPath().isEmpty());
}
if (sdevice->isDiskOfType(TDEDiskDeviceType::Floppy)) {
setFloppyMountState(medium);
// We don't use the routine above as floppy disks are extremely slow (we don't want them accessed at all during media listing)
- medium->mountableState(sdevice->deviceNode(), sdevice->mountPath(), sdevice->fileSystemName(), !sdevice->mountPath().isNull());
+ medium->setMountable(true);
+ medium->setDeviceNode(sdevice->deviceNode());
+ medium->setMountPoint(sdevice->mountPath());
+ medium->setFsType(sdevice->fileSystemName());
+ medium->setMounted(!sdevice->mountPath().isEmpty());
if (sdevice->mountPath().isNull()) {
medium->setMimeType("media/floppy_unmounted");
@@ -866,7 +901,8 @@ void TDEBackend::setCameraProperties(Medium* medium)
device.sprintf("camera://@[usb:%s,%s]/", devNode0.ascii(), devNode1.ascii());
}
- medium->unmountableState(device);
+ medium->setMountable(false);
+ medium->setBaseURL(device);
medium->setMimeType("media/gphoto2camera");
medium->setIconName(TQString::null);
@@ -890,7 +926,11 @@ void TDEBackend::setFloppyMountState( Medium *medium )
if ((*it)->mountedFrom() == medium->deviceNode() ) {
fstype = (*it)->mountType().isNull() ? (*it)->mountType() : "auto";
mountpoint = (*it)->mountPoint();
- medium->mountableState( medium->deviceNode(), mountpoint, fstype, true );
+ medium->setMountable(true);
+ medium->setDeviceNode(medium->deviceNode());
+ medium->setMountPoint(mountpoint);
+ medium->setFsType(fstype);
+ medium->setMounted(true);
return;
}
}