diff options
Diffstat (limited to 'tdeioslave/media/mediamanager')
-rw-r--r-- | tdeioslave/media/mediamanager/halbackend.cpp | 18 | ||||
-rw-r--r-- | tdeioslave/media/mediamanager/tdehardwarebackend.cpp | 88 |
2 files changed, 61 insertions, 45 deletions
diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp index 05cdae425..80d443392 100644 --- a/tdeioslave/media/mediamanager/halbackend.cpp +++ b/tdeioslave/media/mediamanager/halbackend.cpp @@ -48,6 +48,10 @@ (medium->isMounted() ? TQString("_mount") : TQString("_unmount")) + \ (medium->isEncrypted() ? (halClearVolume ? "_decrypt" : "_encrypt") : "" ) \ ) +#define MOUNTED_ICON_SUFFIX ( \ + (medium->isMounted() ? TQString("-mounted") : TQString("")) + \ + (medium->isEncrypted() ? (halClearVolume ? "-decrypted" : "-encrypted") : "" ) \ + ) /* Static instance of this class, for static HAL callbacks */ static HALBackend* s_HALBackend; @@ -616,16 +620,16 @@ void HALBackend::setVolumeProperties(Medium* medium) medium->needMounting(); switch (libhal_drive_get_type(halDrive)) { case LIBHAL_DRIVE_TYPE_COMPACT_FLASH: - medium->setIconName("compact_flash" + MOUNT_ICON_SUFFIX); + medium->setIconName("media-flash-compact_flash" + MOUNTED_ICON_SUFFIX); break; case LIBHAL_DRIVE_TYPE_MEMORY_STICK: - medium->setIconName("memory_stick" + MOUNT_ICON_SUFFIX); + medium->setIconName("media-flash-memory_stick" + MOUNTED_ICON_SUFFIX); break; case LIBHAL_DRIVE_TYPE_SMART_MEDIA: - medium->setIconName("smart_media" + MOUNT_ICON_SUFFIX); + medium->setIconName("media-flash-smart_media" + MOUNTED_ICON_SUFFIX); break; case LIBHAL_DRIVE_TYPE_SD_MMC: - medium->setIconName("sd_mmc" + MOUNT_ICON_SUFFIX); + medium->setIconName("media-flash-sd_mmc" + MOUNTED_ICON_SUFFIX); break; case LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER: { @@ -654,7 +658,7 @@ void HALBackend::setVolumeProperties(Medium* medium) break; } case LIBHAL_DRIVE_TYPE_TAPE: - medium->setIconName(TQString::null); //FIXME need icon + medium->setIconName("media-tape" + MOUNTED_ICON_SUFFIX); break; default: medium->setIconName(TQString::null); @@ -1035,9 +1039,9 @@ TQStringList HALBackend::mountoptions(const TQString &name) if (valids.contains("shortname")) { TQString svalue = config.readEntry("shortname", "lower").lower(); - if (svalue == "winnt") + if (svalue == "windows nt") result << "shortname=winnt"; - else if (svalue == "win95") + else if (svalue == "windows 95") result << "shortname=win95"; else if (svalue == "mixed") result << "shortname=mixed"; diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index a7cbb2260..4746f48cc 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -45,6 +45,10 @@ (medium->isMounted() ? TQString("_mount") : TQString("_unmount")) + \ (medium->isEncrypted() ? (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt) ? "_decrypt" : "_encrypt") : "" ) \ ) +#define MOUNTED_ICON_SUFFIX ( \ + (medium->isMounted() ? TQString("-mounted") : TQString("")) + \ + (medium->isEncrypted() ? (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt) ? "-decrypted" : "-encrypted") : "" ) \ + ) #define CHECK_FOR_AND_EXECUTE_AUTOMOUNT(udi, medium, allowNotification) { \ TQMap<TQString,TQString> options = MediaManagerUtils::splitOptions(mountoptions(udi)); \ @@ -146,6 +150,14 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) allowNotification = false; } + // Check if user wants the full popup to be suppressed + bool allowDialogNotification = allowNotification; + TDEConfig config("mediamanagerrc"); + config.setGroup("Global"); + if (!config.readBoolEntry("NotificationPopupsEnabled", false)) { + allowDialogNotification = false; + } + // Add volume block devices if (sdevice->isDiskOfType(TDEDiskDeviceType::HDD)) { /* We only list volumes that... @@ -163,7 +175,8 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) /* 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 if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsedByDevice) + || (sdevice->fileSystemUsage().upper() == "RAID")) { // } else { @@ -190,7 +203,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) } // Insert medium into list - m_mediaList.addMedium(medium, allowNotification); + m_mediaList.addMedium(medium, allowDialogNotification); kdDebug(1219) << "TDEBackend::AddDevice inserted hard medium for " << sdevice->uniqueID() << endl; @@ -233,7 +246,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) setVolumeProperties(medium); // Insert medium into list - m_mediaList.addMedium(medium, allowNotification); + m_mediaList.addMedium(medium, allowDialogNotification); kdDebug(1219) << "TDEBackend::AddDevice inserted optical medium for " << sdevice->uniqueID() << endl; @@ -248,6 +261,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) ) { if ((sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) && (!(sdevice->checkDiskStatus(TDEDiskDeviceStatus::Inserted)))) { allowNotification = false; + allowDialogNotification = false; } /* We only list volumes that... @@ -278,7 +292,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) } } - m_mediaList.addMedium(medium, allowNotification); + m_mediaList.addMedium(medium, allowDialogNotification); kdDebug(1219) << "TDEBackend::AddDevice inserted floppy medium for " << sdevice->uniqueID() << endl; @@ -294,7 +308,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) // Create medium Medium* medium = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), ""); setCameraProperties(medium); - m_mediaList.addMedium(medium, allowNotification); + m_mediaList.addMedium(medium, allowDialogNotification); kdDebug(1219) << "TDEBackend::AddDevice inserted camera medium for " << sdevice->uniqueID() << endl; @@ -728,43 +742,40 @@ void TDEBackend::setVolumeProperties(Medium* medium) diskLabel = i18n("%1 Fixed Disk (%2)").arg(sdevice->deviceFriendlySize(), sdevice->deviceNode()); } - if (sdevice->isDiskOfType(TDEDiskDeviceType::USB)) { + if (sdevice->isDiskOfType(TDEDiskDeviceType::USB) + || sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable) + || sdevice->checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) { mimeType = "media/removable" + MOUNT_SUFFIX; if (useDefaultLabel) { diskLabel = i18n("%1 Removable Device").arg(sdevice->deviceFriendlySize()); } + } - medium->needMounting(); - - if (sdevice->isDiskOfType(TDEDiskDeviceType::CompactFlash)) { - medium->setIconName("compact_flash" + MOUNT_ICON_SUFFIX); - } - if (sdevice->isDiskOfType(TDEDiskDeviceType::MemoryStick)) { - medium->setIconName("memory_stick" + MOUNT_ICON_SUFFIX); - } - if (sdevice->isDiskOfType(TDEDiskDeviceType::SmartMedia)) { - medium->setIconName("smart_media" + MOUNT_ICON_SUFFIX); - } - if (sdevice->isDiskOfType(TDEDiskDeviceType::SDMMC)) { - medium->setIconName("sd_mmc" + MOUNT_ICON_SUFFIX); - } - if (sdevice->isDiskOfType(TDEDiskDeviceType::MediaDevice)) { - medium->setIconName("ipod" + MOUNT_ICON_SUFFIX); - - if (sdevice->vendorModel().upper().contains("IPOD") && KProtocolInfo::isKnownProtocol( TQString("ipod") ) ) - { - medium->unmountableState( "ipod:/" ); - medium->mountableState(!sdevice->mountPath().isNull()); - } - } - if (sdevice->isDiskOfType(TDEDiskDeviceType::Tape)) { - medium->setIconName("magnetic_tape" + MOUNT_ICON_SUFFIX); - } - if (medium->isMounted() && TQFile::exists(medium->mountPoint() + "/dcim")) - { - mimeType = "media/camera" + MOUNT_SUFFIX; + if (sdevice->isDiskOfType(TDEDiskDeviceType::CompactFlash)) { + medium->setIconName("media-flash-compact_flash" + MOUNTED_ICON_SUFFIX); + } + if (sdevice->isDiskOfType(TDEDiskDeviceType::MemoryStick)) { + medium->setIconName("media-flash-memory_stick" + MOUNTED_ICON_SUFFIX); + } + if (sdevice->isDiskOfType(TDEDiskDeviceType::SmartMedia)) { + medium->setIconName("media-flash-smart_media" + MOUNTED_ICON_SUFFIX); + } + if (sdevice->isDiskOfType(TDEDiskDeviceType::SDMMC)) { + medium->setIconName("media-flash-sd_mmc" + MOUNTED_ICON_SUFFIX); + } + if (sdevice->isDiskOfType(TDEDiskDeviceType::MediaDevice)) { + medium->setIconName("ipod" + MOUNT_ICON_SUFFIX); + if (sdevice->vendorModel().upper().contains("IPOD") && KProtocolInfo::isKnownProtocol( TQString("ipod") ) ) { + medium->unmountableState( "ipod:/" ); + medium->mountableState(!sdevice->mountPath().isNull()); } } + if (sdevice->isDiskOfType(TDEDiskDeviceType::Tape)) { + medium->setIconName("media-tape" + MOUNTED_ICON_SUFFIX); + } + if (medium->isMounted() && TQFile::exists(medium->mountPoint() + "/dcim")) { + mimeType = "media/camera" + MOUNT_SUFFIX; + } } if (!medium->needMounting()) { @@ -1040,16 +1051,17 @@ TQStringList TDEBackend::mountoptions(const TQString &name) if (valids.contains("shortname")) { TQString svalue = config.readEntry("shortname", "lower").lower(); - if (svalue == "winnt") { + // If the user choose 'default', no shortname is added to the mount option list + if (svalue == "windows nt") { result << "shortname=winnt"; } - else if (svalue == "win95") { + else if (svalue == "windows 95") { result << "shortname=win95"; } else if (svalue == "mixed") { result << "shortname=mixed"; } - else { + else if (svalue == "lower"){ result << "shortname=lower"; } } |