[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/kioslave/media
From:       Jakub Stachowski <qbast () go2 ! pl>
Date:       2005-07-21 18:12:22
Message-ID: 1121969542.824005.28171.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 437394 by qbast:

- Fix handling of usb-storage camera - only one item is created
with mimetype media/camera_(un)mounted
- Change label from "Camera" to usb.product retrieved from HAL
- Fixed popup window caption (/ was being changed to %2f)



 M  +25 -11    mediamanager/halbackend.cpp  
 M  +2 -1      medianotifier/notificationdialog.cpp  
 M  +1 -1      mimetypes/Makefile.am  
 A             mimetypes/camera_mounted.desktop  
 A             mimetypes/camera_unmounted.desktop  
 M  +1 -1      services/media_mount.desktop  
 M  +1 -1      services/media_safelyremove.desktop  


--- trunk/KDE/kdebase/kioslave/media/mediamanager/halbackend.cpp #437393:437394
@@ -231,8 +231,9 @@
 		}
 
 	/* Camera handled by gphoto2*/
-	if (libhal_device_query_capability(m_halContext, udi, "camera", NULL))
-
+	if (libhal_device_query_capability(m_halContext, udi, "camera", NULL) &&
+		libhal_device_property_exists(m_halContext, udi, "camera.libgphoto2_support", NULL) &&
+		hal_device_get_property_bool(m_halContext, udi, "camera.libgphoto2_support"))
 		{
 			/* Create medium */
 			Medium* medium = new Medium(udi, "");
@@ -350,6 +351,12 @@
 		libhal_volume_get_fstype(halVolume),			/* Filesystem type */
 		libhal_volume_is_mounted(halVolume) );			/* Mounted ? */
 
+	char* name = libhal_volume_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy);
+	QString volume_name = QString::fromUtf8(name);
+	QString media_name = volume_name;
+	medium->setLabel(media_name);
+	free(name);
+
 	QString mimeType;
 	if (libhal_volume_is_disc(halVolume))
 	{
@@ -404,6 +411,7 @@
 	else
 	{
 		mimeType = "media/hdd" + MOUNT_SUFFIX;
+		const char *physdev = hal_drive_get_physical_device_udi(halDrive);
 		if (libhal_drive_is_hotpluggable(halDrive))
 		{
 			mimeType = "media/removable" + MOUNT_SUFFIX;
@@ -425,7 +433,16 @@
 				medium->setIconName(QString::null); //FIXME need icon
 				break;
 			case LIBHAL_DRIVE_TYPE_CAMERA:
+				mimeType = "media/camera" + MOUNT_SUFFIX;
 				medium->setIconName("camera" + MOUNT_SUFFIX);
+				// get model from camera
+				if (physdev && libhal_device_query_capability(m_halContext, physdev, "camera", NULL)) 
+				{
+					if (libhal_device_property_exists(m_halContext, physdev, "usb_device.product", NULL))
+						medium->setLabel(hal_device_get_property_QString(m_halContext, physdev, "usb_device.product"));
+					else if (libhal_device_property_exists(m_halContext, physdev, "usb.product", NULL))
+						medium->setLabel(hal_device_get_property_QString(m_halContext, physdev, "usb.product"));
+				}
 				break;
 			case LIBHAL_DRIVE_TYPE_TAPE:
 				medium->setIconName(QString::null); //FIXME need icon
@@ -437,13 +454,6 @@
 	}
 	medium->setMimeType(mimeType);
 
-	char* name = libhal_volume_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy);
-	//char* name = libhal_drive_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy);
-	QString volume_name = QString::fromUtf8(name);
-	QString media_name = volume_name;
-	medium->setLabel(media_name);
-	free(name);
-
 	libhal_drive_free(halDrive);
 	libhal_volume_free(halVolume);
 }
@@ -545,8 +555,12 @@
 	medium->unmountableState("camera:/");
 	medium->setMimeType("media/gphoto2camera");
 	medium->setIconName(QString::null);
-	/** @todo find label */
-	medium->setLabel("Camera");
+	if (libhal_device_property_exists(m_halContext, udi, "usb_device.product", NULL))
+		medium->setLabel(hal_device_get_property_QString(m_halContext, udi, "usb_device.product"));
+	else if (libhal_device_property_exists(m_halContext, udi, "usb.product", NULL))
+		medium->setLabel(hal_device_get_property_QString(m_halContext, udi, "usb.product"));
+	else 
+		medium->setLabel(i18n("Camera"));
 }
 
 QString HALBackend::generateName(const QString &devNode)
--- trunk/KDE/kdebase/kioslave/media/medianotifier/notificationdialog.cpp #437393:437394
@@ -22,6 +22,7 @@
 #include <krun.h>
 #include <klocale.h>
 #include <kstandarddirs.h>
+#include <kio/global.h>
 #include <klistbox.h>
 #include <qlabel.h>
 #include <qcheckbox.h>
@@ -34,7 +35,7 @@
 	: KDialogBase( parent, name, false, i18n( "Medium Detected" ), Ok|Cancel|User1, Ok, true),
 	  m_medium(medium), m_settings( settings )
 {
-	setCaption( m_medium.name() );
+	setCaption( KIO::decodeFileName(m_medium.name()) );
 	clearWState( WState_Polished );
 
 	m_view = new NotificationDialogView( this );
--- trunk/KDE/kdebase/kioslave/media/mimetypes/Makefile.am #437393:437394
@@ -16,7 +16,7 @@
                 blankdvd.desktop \
                 svcd.desktop \
                 vcd.desktop\
-                gphoto2camera.desktop
+                gphoto2camera.desktop camera_mounted.desktop camera_unmounted.desktop
 
 
 EXTRA_DIST = $(mimetype_DATA)
--- trunk/KDE/kdebase/kioslave/media/services/media_mount.desktop #437393:437394
@@ -1,5 +1,5 @@
 [Desktop Entry]
-ServiceTypes=media/cdrom_unmounted,media/cdwriter_unmounted,media/dvd_unmounted,media/floppy5_unmounted,m \
edia/floppy_unmounted,media/hdd_unmounted,media/nfs_unmounted,media/removable_unmounted,media/smb_unmounted,media/zip_unmounted
 +ServiceTypes=media/cdrom_unmounted,media/cdwriter_unmounted,media/dvd_unmounted,media/floppy5_unmounted, \
media/floppy_unmounted,media/hdd_unmounted,media/nfs_unmounted,media/removable_unmounted,media/smb_unmounted,media/zip_unmounted,media/camera_unmounted
  Actions=MediaMount;
 X-KDE-Priority=TopLevel
 X-KDE-MediaNotifierHide=true
--- trunk/KDE/kdebase/kioslave/media/services/media_safelyremove.desktop #437393:437394
@@ -1,5 +1,5 @@
 [Desktop Entry]
-ServiceTypes=media/removable_mounted,media/removable_unmounted
+ServiceTypes=media/removable_mounted,media/removable_unmounted,media/camera_mounted,media/camera_unmounted
  Actions=MediaSafelyRemove;
 X-KDE-Priority=TopLevel
 X-KDE-MediaNotifierHide=true


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic