From b4754b0e6fc213e0880947cb2c01dfab834fa264 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 2 Jun 2019 15:45:44 +0900 Subject: Extended media manager dcop interface by adding functions to mount/unmount/decrypt/undecrypt a medium by device node (for example /dev/sdc). Signed-off-by: Michele Calgaro --- tdeioslave/media/mediamanager/medialist.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tdeioslave/media/mediamanager/medialist.cpp') diff --git a/tdeioslave/media/mediamanager/medialist.cpp b/tdeioslave/media/mediamanager/medialist.cpp index d9c4f0eb3..fa7aef5f5 100644 --- a/tdeioslave/media/mediamanager/medialist.cpp +++ b/tdeioslave/media/mediamanager/medialist.cpp @@ -52,6 +52,15 @@ const Medium *MediaList::findByName(const TQString &name) const return m_nameMap[name]; } +const Medium *MediaList::findByNode(const TQString &node) const +{ + kdDebug(1219) << "MediaList::findByNode(" << node << ")" << endl; + + if ( !m_nodeMap.contains(node) ) return 0L; + + return m_nodeMap[node]; +} + const Medium *MediaList::findByClearUdi(const TQString &name) { kdDebug(1219) << "MediaList::findByClearUdi(" << name << ")" << endl; @@ -64,7 +73,6 @@ const Medium *MediaList::findByClearUdi(const TQString &name) return 0L; } - TQString MediaList::addMedium(Medium *medium, bool allowNotification) { kdDebug(1219) << "MediaList::addMedium(@" << medium->id() << ")" << endl; @@ -75,6 +83,12 @@ TQString MediaList::addMedium(Medium *medium, bool allowNotification) m_nameMap[name] = medium; } + TQString node = medium->deviceNode(); + if (!m_nodeMap.contains(node)) + { + m_nodeMap[node] = medium; + } + TQString id = medium->id(); if (m_idMap.contains(id)) { @@ -101,6 +115,7 @@ bool MediaList::removeMedium(const TQString &id, bool allowNotification) Medium *medium = m_idMap[id]; m_idMap.remove(id); m_nameMap.remove(medium->name()); + m_nodeMap.remove(medium->deviceNode()); TQString name = medium->name(); m_media.remove(medium); -- cgit v1.2.1