--- kdebase-3.5.9/kioslave/media/mediamanager/halbackend.cpp~ 2008-02-21 19:56:50 +0300 +++ kdebase-3.5.9/kioslave/media/mediamanager/halbackend.cpp 2008-02-22 14:47:36 +0300 @@ -239,6 +239,12 @@ void HALBackend::AddDevice(const char *u if ( driveUdi.isNull() ) // no storage - no fun return; + /* We don't list floppy volumes because we list floppy drives */ + if ((libhal_device_get_property_QString(m_halContext, driveUdi.ascii(), "storage.drive_type") == "floppy") || + (libhal_device_get_property_QString(m_halContext, driveUdi.ascii(), "storage.drive_type") == "zip") || + (libhal_device_get_property_QString(m_halContext, driveUdi.ascii(), "storage.drive_type") == "jaz")) + return; + // if the device is locked do not act upon it if (libhal_device_get_property_bool(m_halContext, driveUdi.ascii(), "info.locked", NULL)) allowNotification=false; @@ -286,11 +292,8 @@ void HALBackend::AddDevice(const char *u allowNotification = false; /* Create medium */ Medium* medium = new Medium(udi, ""); - // if the storage has a volume, we ignore it - if ( setFloppyProperties(medium) ) - m_mediaList.addMedium(medium, allowNotification); - else - delete medium; + setFloppyProperties(medium); + m_mediaList.addMedium(medium, allowNotification); return; } @@ -638,25 +641,36 @@ bool HALBackend::setFloppyProperties(Med return false; QString drive_type = libhal_device_get_property_QString(m_halContext, udi, "storage.drive_type"); + LibHalVolume* halVolume = NULL; if (drive_type == "zip") { int numVolumes; char** volumes = libhal_drive_find_all_volumes(m_halContext, halDrive, &numVolumes); libhal_free_string_array(volumes); kdDebug(1219) << " found " << numVolumes << " volumes" << endl; - if (numVolumes) + if (numVolumes>0) { - libhal_drive_free(halDrive); - return false; + halVolume = libhal_volume_from_udi(m_halContext, volumes[0]); } } medium->setName( generateName(libhal_drive_get_device_file(halDrive)) ); medium->setLabel(i18n("Unknown Drive")); - // HAL hates floppies - so we have to do it twice ;( - medium->mountableState(libhal_drive_get_device_file(halDrive), QString::null, QString::null, false); - setFloppyMountState(medium); + if (halVolume) + { + medium->mountableState( + libhal_volume_get_device_file(halVolume), /* Device node */ + libhal_volume_get_mount_point(halVolume), /* Mount point */ + libhal_volume_get_fstype(halVolume), /* Filesystem type */ + libhal_volume_is_mounted(halVolume) ); /* Mounted ? */ + } + else + { + // HAL hates floppies - so we have to do it twice ;( + medium->mountableState(libhal_drive_get_device_file(halDrive), QString::null, QString::null, false); + setFloppyMountState(medium); + } if (drive_type == "floppy") { @@ -674,12 +688,21 @@ bool HALBackend::setFloppyProperties(Med medium->setMimeType("media/zip_unmounted"); medium->setLabel(i18n("Zip Drive")); } + else + { + char *name = libhal_drive_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy); + if (name) { + medium->setLabel( QString::fromUtf8(name) ); + free(name); + } + } /** @todo And mimtype for JAZ drives ? */ medium->setIconName(QString::null); libhal_drive_free(halDrive); + libhal_volume_free(halVolume); return true; }