diff options
Diffstat (limited to 'tdeioslave/media/mediamanager')
-rw-r--r-- | tdeioslave/media/mediamanager/halbackend.cpp | 22 | ||||
-rw-r--r-- | tdeioslave/media/mediamanager/tdehardwarebackend.cpp | 60 |
2 files changed, 39 insertions, 43 deletions
diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp index 9c1382bf8..b0cf54b6e 100644 --- a/tdeioslave/media/mediamanager/halbackend.cpp +++ b/tdeioslave/media/mediamanager/halbackend.cpp @@ -40,15 +40,13 @@ #include <kstandarddirs.h> #include <kprocess.h> -#define MOUNT_SUFFIX (medium->isEncrypted() ? \ +#define MOUNT_MEDIA_SUFFIX (medium->isEncrypted() ? \ (TQString("_encrypted") + (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt) ? "_unlocked" : "_locked")) : \ (medium->isMounted() ? TQString("_mounted") : TQString("_unmounted"))) -#define MOUNT_ICON_SUFFIX (medium->isMounted() ? TQString("_mount") : TQString("_unmount")) - #define MOUNTED_ICON_SUFFIX (medium->isEncrypted() ? \ (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt) ? "-unlocked" : "-locked") : \ - (medium->isMounted() ? TQString("-mounted") : TQString(""))) + (medium->isMounted() ? TQString("-mounted") : TQString("-unmounted"))) /* Static instance of this class, for static HAL callbacks */ static HALBackend* s_HALBackend; @@ -562,7 +560,7 @@ void HALBackend::setVolumeProperties(Medium* medium) TQString mimeType; if (libhal_volume_is_disc(halVolume)) { - mimeType = "media/cdrom" + MOUNT_SUFFIX; + mimeType = "media/cdrom" + MOUNT_MEDIA_SUFFIX; LibHalVolumeDiscType discType = libhal_volume_get_disc_type(halVolume); if ((discType == LIBHAL_VOLUME_DISC_TYPE_CDROM) || @@ -574,7 +572,7 @@ void HALBackend::setVolumeProperties(Medium* medium) medium->unmountableState(""); } else - mimeType = "media/cdwriter" + MOUNT_SUFFIX; + mimeType = "media/cdwriter" + MOUNT_MEDIA_SUFFIX; if ((discType == LIBHAL_VOLUME_DISC_TYPE_DVDROM) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRAM) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDR) || (discType == LIBHAL_VOLUME_DISC_TYPE_DVDRW) || @@ -585,7 +583,7 @@ void HALBackend::setVolumeProperties(Medium* medium) medium->unmountableState(""); } else - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (libhal_volume_disc_has_audio(halVolume) && !libhal_volume_disc_has_data(halVolume)) { @@ -609,11 +607,11 @@ void HALBackend::setVolumeProperties(Medium* medium) } else { - mimeType = "media/hdd" + MOUNT_SUFFIX; + mimeType = "media/hdd" + MOUNT_MEDIA_SUFFIX; medium->setIconName(TQString::null); // reset icon if (libhal_drive_is_hotpluggable(halDrive)) { - mimeType = "media/removable" + MOUNT_SUFFIX; + mimeType = "media/removable" + MOUNT_MEDIA_SUFFIX; medium->needMounting(); switch (libhal_drive_get_type(halDrive)) { case LIBHAL_DRIVE_TYPE_COMPACT_FLASH: @@ -630,7 +628,7 @@ void HALBackend::setVolumeProperties(Medium* medium) break; case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER: { - medium->setIconName("ipod" + MOUNT_ICON_SUFFIX); + medium->setIconName("ipod" + MOUNTED_ICON_SUFFIX); if (libhal_device_get_property_QString(m_halContext, driveUdi.latin1(), "info.product") == "iPod" && KProtocolInfo::isKnownProtocol( TQString("ipod") ) ) @@ -642,7 +640,7 @@ void HALBackend::setVolumeProperties(Medium* medium) } case LIBHAL_DRIVE_TYPE_CAMERA: { - mimeType = "media/camera" + MOUNT_SUFFIX; + mimeType = "media/camera" + MOUNT_MEDIA_SUFFIX; const char *physdev = libhal_drive_get_physical_device_udi(halDrive); // get model from camera if (physdev && libhal_device_query_capability(m_halContext, physdev, "camera", NULL)) @@ -663,7 +661,7 @@ void HALBackend::setVolumeProperties(Medium* medium) if (medium->isMounted() && TQFile::exists(medium->mountPoint() + "/dcim")) { - mimeType = "media/camera" + MOUNT_SUFFIX; + mimeType = "media/camera" + MOUNT_MEDIA_SUFFIX; } } } diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index c16be644c..ab03629bc 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -37,15 +37,13 @@ #include "dialog.h" -#define MOUNT_SUFFIX (medium->isEncrypted() ? \ +#define MOUNT_MEDIA_SUFFIX (medium->isEncrypted() ? \ (TQString("_encrypted") + (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt) ? "_unlocked" : "_locked")) : \ (medium->isMounted() ? TQString("_mounted") : TQString("_unmounted"))) -#define MOUNT_ICON_SUFFIX (medium->isMounted() ? TQString("_mount") : TQString("_unmount")) - #define MOUNTED_ICON_SUFFIX (medium->isEncrypted() ? \ (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt) ? "-unlocked" : "-locked") : \ - (medium->isMounted() ? TQString("-mounted") : TQString(""))) + (medium->isMounted() ? TQString("-mounted") : TQString("-unmounted"))) /* Constructor */ TDEBackend::TDEBackend(MediaList &list, TQObject* parent) @@ -517,13 +515,13 @@ void TDEBackend::setVolumeProperties(Medium* medium) // This device is a CD drive of some sort // Default - mimeType = "media/cdrom" + MOUNT_SUFFIX; + mimeType = "media/cdrom" + MOUNT_MEDIA_SUFFIX; if (useDefaultLabel) { diskLabel = i18n("%1 Removable Device").arg(sdevice->deviceFriendlySize()); } if (sdevice->isDiskOfType(TDEDiskDeviceType::CDROM)) { - mimeType = "media/cdrom" + MOUNT_SUFFIX; + mimeType = "media/cdrom" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankcd"; medium->unmountableState(""); @@ -532,7 +530,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::CDR)) { - mimeType = "media/cd-r" + MOUNT_SUFFIX; + mimeType = "media/cd-r" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankcd"; medium->unmountableState(""); @@ -541,7 +539,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::CDRW)) { - mimeType = "media/cd-rw" + MOUNT_SUFFIX; + mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankcd"; medium->unmountableState(""); @@ -550,7 +548,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::CDMO)) { - mimeType = "media/cd-rw" + MOUNT_SUFFIX; + mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankcd"; medium->unmountableState(""); @@ -559,7 +557,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::CDMRRW)) { - mimeType = "media/cd-rw" + MOUNT_SUFFIX; + mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankcd"; medium->unmountableState(""); @@ -568,7 +566,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::CDMRRWW)) { - mimeType = "media/cd-rw" + MOUNT_SUFFIX; + mimeType = "media/cd-rw" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankcd"; medium->unmountableState(""); @@ -577,7 +575,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDROM)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -586,7 +584,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDRAM)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -595,7 +593,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDR)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -604,7 +602,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDRW)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -613,7 +611,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDRDL)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -622,7 +620,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDRWDL)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -631,7 +629,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDPLUSR)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -640,7 +638,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDPLUSRW)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -649,7 +647,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDPLUSRDL)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -658,7 +656,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::DVDPLUSRWDL)) { - mimeType = "media/dvd" + MOUNT_SUFFIX; + mimeType = "media/dvd" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankdvd"; medium->unmountableState(""); @@ -667,7 +665,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::BDROM)) { - mimeType = "media/bluray" + MOUNT_SUFFIX; + mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankbd"; medium->unmountableState(""); @@ -676,7 +674,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::BDR)) { - mimeType = "media/bluray" + MOUNT_SUFFIX; + mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankbd"; medium->unmountableState(""); @@ -685,7 +683,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::BDRW)) { - mimeType = "media/bluray" + MOUNT_SUFFIX; + mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankbd"; medium->unmountableState(""); @@ -694,7 +692,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::HDDVDROM)) { - mimeType = "media/bluray" + MOUNT_SUFFIX; + mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankhddvd"; medium->unmountableState(""); @@ -703,7 +701,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::HDDVDR)) { - mimeType = "media/bluray" + MOUNT_SUFFIX; + mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankhddvd"; medium->unmountableState(""); @@ -712,7 +710,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) } if (sdevice->isDiskOfType(TDEDiskDeviceType::HDDVDRW)) { - mimeType = "media/bluray" + MOUNT_SUFFIX; + mimeType = "media/bluray" + MOUNT_MEDIA_SUFFIX; if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Blank)) { mimeType = "media/blankhddvd"; medium->unmountableState(""); @@ -742,7 +740,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) // This device is a hard or flash disk of some kind // Default - mimeType = "media/hdd" + MOUNT_SUFFIX; + mimeType = "media/hdd" + MOUNT_MEDIA_SUFFIX; if (useDefaultLabel) { diskLabel = i18n("%1 Fixed Disk (%2)").arg(sdevice->deviceFriendlySize(), sdevice->deviceNode()); } @@ -750,7 +748,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) if (sdevice->isDiskOfType(TDEDiskDeviceType::USB) || sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable) || sdevice->checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) { - mimeType = "media/removable" + MOUNT_SUFFIX; + mimeType = "media/removable" + MOUNT_MEDIA_SUFFIX; if (useDefaultLabel) { diskLabel = i18n("%1 Removable Device").arg(sdevice->deviceFriendlySize()); } @@ -769,7 +767,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) medium->setIconName("media-flash-sd_mmc" + MOUNTED_ICON_SUFFIX); } if (sdevice->isDiskOfType(TDEDiskDeviceType::MediaDevice)) { - medium->setIconName("ipod" + MOUNT_ICON_SUFFIX); + medium->setIconName("ipod" + MOUNTED_ICON_SUFFIX); if (sdevice->vendorModel().upper().contains("IPOD") && KProtocolInfo::isKnownProtocol( TQString("ipod") ) ) { medium->unmountableState( "ipod:/" ); medium->mountableState(!sdevice->mountPath().isNull()); @@ -779,7 +777,7 @@ void TDEBackend::setVolumeProperties(Medium* medium) medium->setIconName("media-tape" + MOUNTED_ICON_SUFFIX); } if (medium->isMounted() && TQFile::exists(medium->mountPoint() + "/dcim")) { - mimeType = "media/camera" + MOUNT_SUFFIX; + mimeType = "media/camera" + MOUNT_MEDIA_SUFFIX; } } |