diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-11-28 13:17:42 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-11-28 13:17:42 -0600 |
commit | 2c1d4ad359e90360708cffe70c298b264b302e49 (patch) | |
tree | 02f179c7d5f201f39c3036190142fa95c2288641 /tdeioslave | |
parent | a7c3b934973a9435120596a6a577ab62e6fee348 (diff) | |
download | tdebase-2c1d4ad359e90360708cffe70c298b264b302e49.tar.gz tdebase-2c1d4ad359e90360708cffe70c298b264b302e49.zip |
Hide udev hidden devices via the hidden file mechanism
This resolves Bug 2211
Diffstat (limited to 'tdeioslave')
-rw-r--r-- | tdeioslave/media/libmediacommon/medium.cpp | 8 | ||||
-rw-r--r-- | tdeioslave/media/libmediacommon/medium.h | 25 | ||||
-rw-r--r-- | tdeioslave/media/mediaimpl.cpp | 4 | ||||
-rw-r--r-- | tdeioslave/media/mediamanager/tdehardwarebackend.cpp | 10 |
4 files changed, 35 insertions, 12 deletions
diff --git a/tdeioslave/media/libmediacommon/medium.cpp b/tdeioslave/media/libmediacommon/medium.cpp index ca526ea49..77e32ba0f 100644 --- a/tdeioslave/media/libmediacommon/medium.cpp +++ b/tdeioslave/media/libmediacommon/medium.cpp @@ -42,6 +42,7 @@ Medium::Medium(const TQString id, TQString uuid, const TQString name) m_properties+= "false"; /* ENCRYPTED */ m_properties+= TQString::null; /* CLEAR_DEVICE_UDI */ m_properties+= "false"; /* HIDDEN */ + m_properties+= "false"; /* SOFT_HIDDEN */ loadUserLabel(); @@ -67,6 +68,7 @@ Medium::Medium() m_properties+= TQString::null; /* ENCRYPTED */ m_properties+= TQString::null; /* CLEAR_DEVICE_UDI */ m_properties+= "false"; /* HIDDEN */ + m_properties+= "false"; /* SOFT_HIDDEN */ m_halmounted = false; } @@ -94,6 +96,7 @@ const Medium Medium::create(const TQStringList &properties) m.m_properties[ENCRYPTED] = properties[ENCRYPTED]; m.m_properties[CLEAR_DEVICE_UDI] = properties[CLEAR_DEVICE_UDI]; m.m_properties[HIDDEN] = properties[HIDDEN]; + m.m_properties[SOFT_HIDDEN] = properties[SOFT_HIDDEN]; } return m; @@ -145,6 +148,11 @@ void Medium::setHidden(bool state) m_properties[HIDDEN] = ( state ? "true" : "false" ); } +void Medium::setSoftHidden(bool state) +{ + m_properties[SOFT_HIDDEN] = ( state ? "true" : "false" ); +} + void Medium::setUserLabel(const TQString &label) { TDEConfig cfg("mediamanagerrc"); diff --git a/tdeioslave/media/libmediacommon/medium.h b/tdeioslave/media/libmediacommon/medium.h index e45dccbfd..bf465fd09 100644 --- a/tdeioslave/media/libmediacommon/medium.h +++ b/tdeioslave/media/libmediacommon/medium.h @@ -45,7 +45,8 @@ public: 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 uint SOFT_HIDDEN = 16; + static const uint PROPERTIES_COUNT = 17; static const TQString SEPARATOR; Medium(const TQString id, TQString uuid, const TQString name); @@ -67,29 +68,31 @@ public: TQString baseURL() const { return m_properties[BASE_URL]; } TQString mimeType() const { return m_properties[MIME_TYPE]; } TQString iconName() const { return m_properties[ICON_NAME]; } - bool isEncrypted() const { return m_properties[ENCRYPTED]=="true"; }; - TQString clearDeviceUdi() const { return m_properties[CLEAR_DEVICE_UDI]; }; - bool hidden() const { return m_properties[HIDDEN]=="true"; }; + bool isEncrypted() const { return m_properties[ENCRYPTED]=="true"; }; + TQString clearDeviceUdi() const { return m_properties[CLEAR_DEVICE_UDI]; }; + bool hidden() const { return m_properties[HIDDEN]=="true"; }; + bool softHidden() const { return m_properties[SOFT_HIDDEN]=="true"; }; bool needMounting() const; - bool needDecryption() const; + bool needDecryption() const; KURL prettyBaseURL() const; TQString prettyLabel() const; void setName(const TQString &name); void setLabel(const TQString &label); void setUserLabel(const TQString &label); - void setEncrypted(bool state); - void setHidden(bool state); + void setEncrypted(bool state); + void setHidden(bool state); + void setSoftHidden(bool state); bool mountableState(bool mounted); void mountableState(const TQString &deviceNode, const TQString &mountPoint, const TQString &fsType, bool mounted); - void mountableState(const TQString &deviceNode, - const TQString &clearDeviceUdi, - const TQString &mountPoint, - const TQString &fsType, bool mounted); + void mountableState(const TQString &deviceNode, + const TQString &clearDeviceUdi, + const TQString &mountPoint, + const TQString &fsType, bool mounted); void unmountableState(const TQString &baseURL = TQString::null); void setMimeType(const TQString &mimeType); diff --git a/tdeioslave/media/mediaimpl.cpp b/tdeioslave/media/mediaimpl.cpp index e00cedccd..7b22a5d22 100644 --- a/tdeioslave/media/mediaimpl.cpp +++ b/tdeioslave/media/mediaimpl.cpp @@ -424,6 +424,10 @@ void MediaImpl::createMediumEntry(TDEIO::UDSEntry& entry, addAtom(entry, TDEIO::UDS_MIME_TYPE, 0, medium.mimeType()); addAtom(entry, TDEIO::UDS_GUESSED_MIME_TYPE, 0, "inode/directory"); + if (medium.softHidden()) { + addAtom(entry, TDEIO::UDS_HIDDEN , true); + } + if (!medium.iconName().isEmpty()) { addAtom(entry, TDEIO::UDS_ICON_NAME, 0, medium.iconName()); diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index 56eab25b2..a7cbb2260 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -161,7 +161,7 @@ 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 + * e.g. the raw partition of a device mapper volume */ else if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsedByDevice)) { // @@ -181,6 +181,14 @@ void TDEBackend::AddDevice(TDEStorageDevice * sdevice, bool allowNotification) } } + // Hide udev hidden devices by default but allow the user to override if desired via Show Hidden Files + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Hidden)) { + medium->setSoftHidden(true); + } + else { + medium->setSoftHidden(false); + } + // Insert medium into list m_mediaList.addMedium(medium, allowNotification); |