summaryrefslogtreecommitdiffstats
path: root/kioslave/media
diff options
context:
space:
mode:
Diffstat (limited to 'kioslave/media')
-rw-r--r--kioslave/media/kfile-plugin/kfilemediaplugin.cpp2
-rw-r--r--kioslave/media/libmediacommon/medium.cpp9
-rw-r--r--kioslave/media/libmediacommon/medium.h36
-rw-r--r--kioslave/media/mediamanager/fstabbackend.cpp2
-rw-r--r--kioslave/media/mediamanager/halbackend.cpp8
-rw-r--r--kioslave/media/mediamanager/removablebackend.cpp2
-rw-r--r--kioslave/media/mediamanager/tdehardwarebackend.cpp24
-rw-r--r--kioslave/media/mounthelper/kio_media_mounthelper.cpp4
8 files changed, 49 insertions, 38 deletions
diff --git a/kioslave/media/kfile-plugin/kfilemediaplugin.cpp b/kioslave/media/kfile-plugin/kfilemediaplugin.cpp
index cd4a50a52..eff311b0d 100644
--- a/kioslave/media/kfile-plugin/kfilemediaplugin.cpp
+++ b/kioslave/media/kfile-plugin/kfilemediaplugin.cpp
@@ -169,7 +169,7 @@ const Medium KFileMediaPlugin::askMedium(KFileMetaInfo &info)
if ( !reply.isValid() )
{
- return Medium(TQString::null, TQString::null);
+ return Medium(TQString::null, TQString::null, TQString::null);
}
return Medium::create(reply);
diff --git a/kioslave/media/libmediacommon/medium.cpp b/kioslave/media/libmediacommon/medium.cpp
index ca618494e..031e56788 100644
--- a/kioslave/media/libmediacommon/medium.cpp
+++ b/kioslave/media/libmediacommon/medium.cpp
@@ -23,9 +23,10 @@
const TQString Medium::SEPARATOR = "---";
-Medium::Medium(const TQString &id, const TQString &name)
+Medium::Medium(const TQString id, TQString uuid, const TQString name)
{
m_properties+= id; /* ID */
+ m_properties+= uuid; /* UUID */
m_properties+= name; /* NAME */
m_properties+= name; /* LABEL */
m_properties+= TQString::null; /* USER_LABEL */
@@ -50,6 +51,7 @@ Medium::Medium(const TQString &id, const TQString &name)
Medium::Medium()
{
m_properties+= TQString::null; /* ID */
+ m_properties+= TQString::null; /* UUID */
m_properties+= TQString::null; /* NAME */
m_properties+= TQString::null; /* LABEL */
m_properties+= TQString::null; /* USER_LABEL */
@@ -76,6 +78,7 @@ const Medium Medium::create(const TQStringList &properties)
if ( properties.size() >= PROPERTIES_COUNT )
{
m.m_properties[ID] = properties[ID];
+ m.m_properties[UUID] = properties[UUID];
m.m_properties[NAME] = properties[NAME];
m.m_properties[LABEL] = properties[LABEL];
m.m_properties[USER_LABEL] = properties[USER_LABEL];
@@ -147,7 +150,7 @@ void Medium::setUserLabel(const TQString &label)
KConfig cfg("mediamanagerrc");
cfg.setGroup("UserLabels");
- TQString entry_name = m_properties[ID];
+ TQString entry_name = m_properties[UUID];
if ( label.isNull() )
{
@@ -166,7 +169,7 @@ void Medium::loadUserLabel()
KConfig cfg("mediamanagerrc");
cfg.setGroup("UserLabels");
- TQString entry_name = m_properties[ID];
+ TQString entry_name = m_properties[UUID];
if ( cfg.hasKey(entry_name) )
{
diff --git a/kioslave/media/libmediacommon/medium.h b/kioslave/media/libmediacommon/medium.h
index 78da6d09c..e45dccbfd 100644
--- a/kioslave/media/libmediacommon/medium.h
+++ b/kioslave/media/libmediacommon/medium.h
@@ -29,31 +29,33 @@ class Medium
public:
typedef TQValueList<Medium> MList;
- static const uint ID = 0;
- static const uint NAME = 1;
- static const uint LABEL = 2;
- static const uint USER_LABEL = 3;
- static const uint MOUNTABLE = 4;
- static const uint DEVICE_NODE = 5;
- static const uint MOUNT_POINT = 6;
- static const uint FS_TYPE = 7;
- static const uint MOUNTED = 8;
- static const uint BASE_URL = 9;
- static const uint MIME_TYPE = 10;
- static const uint ICON_NAME = 11;
- static const uint ENCRYPTED = 12;
- static const uint CLEAR_DEVICE_UDI = 13;
- static const uint HIDDEN = 14;
- static const uint PROPERTIES_COUNT = 15;
+ static const uint ID = 0;
+ static const uint UUID = 1;
+ static const uint NAME = 2;
+ static const uint LABEL = 3;
+ static const uint USER_LABEL = 4;
+ static const uint MOUNTABLE = 5;
+ static const uint DEVICE_NODE = 6;
+ static const uint MOUNT_POINT = 7;
+ static const uint FS_TYPE = 8;
+ static const uint MOUNTED = 9;
+ static const uint BASE_URL = 10;
+ static const uint MIME_TYPE = 11;
+ static const uint ICON_NAME = 12;
+ static const uint ENCRYPTED = 13;
+ static const uint CLEAR_DEVICE_UDI = 14;
+ static const uint HIDDEN = 15;
+ static const uint PROPERTIES_COUNT = 16;
static const TQString SEPARATOR;
- Medium(const TQString &id, const TQString &name);
+ Medium(const TQString id, TQString uuid, const TQString name);
static const Medium create(const TQStringList &properties);
static MList createList(const TQStringList &properties);
const TQStringList &properties() const { return m_properties; }
TQString id() const { return m_properties[ID]; }
+ TQString uuid() const { return m_properties[UUID]; }
TQString name() const { return m_properties[NAME]; }
TQString label() const { return m_properties[LABEL]; }
TQString userLabel() const { return m_properties[USER_LABEL]; }
diff --git a/kioslave/media/mediamanager/fstabbackend.cpp b/kioslave/media/mediamanager/fstabbackend.cpp
index 189f52aee..0ae99228e 100644
--- a/kioslave/media/mediamanager/fstabbackend.cpp
+++ b/kioslave/media/mediamanager/fstabbackend.cpp
@@ -281,7 +281,7 @@ void FstabBackend::handleFstabChange(bool allowNotification)
{
TQString name = generateName(dev, fs);
- Medium *m = new Medium(id, name);
+ Medium *m = new Medium(id, id, name);
m->mountableState(dev, mp, fs, false);
diff --git a/kioslave/media/mediamanager/halbackend.cpp b/kioslave/media/mediamanager/halbackend.cpp
index 575d7f729..ca0c4e26c 100644
--- a/kioslave/media/mediamanager/halbackend.cpp
+++ b/kioslave/media/mediamanager/halbackend.cpp
@@ -265,7 +265,7 @@ void HALBackend::AddDevice(const char *udi, bool allowNotification)
libhal_volume_free(halVolume);
/* Create medium */
- Medium* medium = new Medium(udi, "");
+ Medium* medium = new Medium(udi, udi, "");
setVolumeProperties(medium);
if ( isInFstab( medium ).isNull() )
@@ -304,7 +304,7 @@ void HALBackend::AddDevice(const char *udi, bool allowNotification)
if (! libhal_device_get_property_bool(m_halContext, udi, "storage.removable.media_available", NULL) )
allowNotification = false;
/* Create medium */
- Medium* medium = new Medium(udi, "");
+ Medium* medium = new Medium(udi, udi, "");
// if the storage has a volume, we ignore it
if ( setFloppyProperties(medium) )
m_mediaList.addMedium(medium, allowNotification);
@@ -322,7 +322,7 @@ void HALBackend::AddDevice(const char *udi, bool allowNotification)
)
{
/* Create medium */
- Medium* medium = new Medium(udi, "");
+ Medium* medium = new Medium(udi, udi, "");
setCameraProperties(medium);
m_mediaList.addMedium(medium, allowNotification);
return;
@@ -460,7 +460,7 @@ void HALBackend::ResetProperties(const char* mediumUdi, bool allowNotification)
}
}
- Medium* m = new Medium(mediumUdi, "");
+ Medium* m = new Medium(mediumUdi, mediumUdi, "");
if (libhal_device_query_capability(m_halContext, mediumUdi, "volume", NULL))
setVolumeProperties(m);
diff --git a/kioslave/media/mediamanager/removablebackend.cpp b/kioslave/media/mediamanager/removablebackend.cpp
index f307ee2f8..6b83ae1ea 100644
--- a/kioslave/media/mediamanager/removablebackend.cpp
+++ b/kioslave/media/mediamanager/removablebackend.cpp
@@ -62,7 +62,7 @@ bool RemovableBackend::plug(const TQString &devNode, const TQString &label)
if (!m_removableIds.contains(id))
{
- Medium *medium = new Medium(id, name);
+ Medium *medium = new Medium(id, id, name);
medium->mountableState(devNode, TQString::null,
TQString::null, false);
diff --git a/kioslave/media/mediamanager/tdehardwarebackend.cpp b/kioslave/media/mediamanager/tdehardwarebackend.cpp
index 65f287305..189d0015e 100644
--- a/kioslave/media/mediamanager/tdehardwarebackend.cpp
+++ b/kioslave/media/mediamanager/tdehardwarebackend.cpp
@@ -155,7 +155,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
}
else {
// Create medium
- Medium* medium = new Medium(sdevice->uniqueID(), "");
+ Medium* medium = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), "");
setVolumeProperties(medium);
// Do not list the LUKS backend device if it has been unlocked elsewhere
@@ -193,7 +193,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
) {
// Create medium
- Medium* medium = new Medium(sdevice->uniqueID(), "");
+ Medium* medium = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), "");
setVolumeProperties(medium);
// Insert medium into list
@@ -228,7 +228,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
}
else {
// Create medium
- Medium* medium = new Medium(sdevice->uniqueID(), "");
+ Medium* medium = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), "");
setFloppyProperties(medium);
@@ -256,7 +256,7 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification)
if (KProtocolInfo::isKnownProtocol( TQString("camera") ) )
{
// Create medium
- Medium* medium = new Medium(sdevice->uniqueID(), "");
+ Medium* medium = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), "");
setCameraProperties(medium);
m_mediaList.addMedium(medium, allowNotification);
@@ -305,7 +305,7 @@ void TDEBackend::ResetProperties(TDEStorageDevice * sdevice, bool allowNotificat
}
}
- Medium* m = new Medium(sdevice->uniqueID(), "");
+ Medium* m = new Medium(sdevice->uniqueID(), driveUDIFromDeviceUID(sdevice->uniqueID()), "");
// Keep these conditions in sync with ::AddDevice above, OR ELSE!!!
// BEGIN
@@ -1335,11 +1335,17 @@ TQString TDEBackend::driveUDIFromDeviceUID(TQString uuid) {
TQString ret;
if (sdevice) {
ret = sdevice->diskUUID();
- if (ret == "") {
- ret = sdevice->deviceNode();
+ if (ret != "") {
+ ret = "volume_uuid_" + ret;
}
- if (ret == "") {
- ret = sdevice->uniqueID();
+ else {
+ ret = sdevice->deviceNode();
+ if (ret != "") {
+ ret = "device_node_" + ret;
+ }
+ else {
+ ret = sdevice->uniqueID();
+ }
}
}
if (ret == "") {
diff --git a/kioslave/media/mounthelper/kio_media_mounthelper.cpp b/kioslave/media/mounthelper/kio_media_mounthelper.cpp
index 32aca6f8f..f184a9ad5 100644
--- a/kioslave/media/mounthelper/kio_media_mounthelper.cpp
+++ b/kioslave/media/mounthelper/kio_media_mounthelper.cpp
@@ -45,7 +45,7 @@ const Medium MountHelper::findMedium(const KURL &url)
DCOPReply reply = mediamanager.call( "properties", url.fileName() );
if ( !reply.isValid() ) {
m_errorStr = i18n("The TDE mediamanager is not running.")+"\n";
- return Medium(TQString::null, TQString::null);
+ return Medium(TQString::null, TQString::null, TQString::null);
}
const Medium& medium = Medium::create(reply);
if ( medium.id().isEmpty() ) {
@@ -53,7 +53,7 @@ const Medium MountHelper::findMedium(const KURL &url)
reply = mediamanager.call( "properties", url.prettyURL() );
if ( !reply.isValid() ) {
m_errorStr = i18n("Internal Error");
- return Medium(TQString::null, TQString::null);
+ return Medium(TQString::null, TQString::null, TQString::null);
}
return Medium::create(reply);
} else {