Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37884863
en ru br
Репозитории ALT
5.1: 3.5.10-alt20.M51.2
4.1: 3.5.10-alt16.M41.1
4.0: 3.5.9-alt1.M40.1
3.0: 3.4.1-alt12
+updates:3.4.1-alt12.1.M30
+backports:3.5.6-alt7.0.M30
www.altlinux.org/Changes

Группа :: Графические оболочки/KDE
Пакет: kdebase

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: kdebase-3.5.9-alt-mediamanager-floppy-list-fallback.patch
Скачать


--- 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;
 }
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin