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/mediamanager.cpp | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'tdeioslave/media/mediamanager/mediamanager.cpp') diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp index ef6721999..6f498ffc8 100644 --- a/tdeioslave/media/mediamanager/mediamanager.cpp +++ b/tdeioslave/media/mediamanager/mediamanager.cpp @@ -355,6 +355,54 @@ TQStringVariantMap MediaManager::undecrypt(const TQString &uid) #endif } +TQStringVariantMap MediaManager::mountByNode(const TQString &deviceNode) +{ + const Medium *medium = m_mediaList.findByNode(deviceNode); + if (!medium) { + TQStringVariantMap result; + result["errStr"] = i18n("No such medium: %1").arg(deviceNode); + result["result"] = false; + return result; + } + return mount(medium->id()); +} + +TQStringVariantMap MediaManager::unmountByNode(const TQString &deviceNode) +{ + const Medium *medium = m_mediaList.findByNode(deviceNode); + if (!medium) { + TQStringVariantMap result; + result["errStr"] = i18n("No such medium: %1").arg(deviceNode); + result["result"] = false; + return result; + } + return unmount(medium->id()); +} + +TQStringVariantMap MediaManager::decryptByNode(const TQString &deviceNode, const TQString &password) +{ + const Medium *medium = m_mediaList.findByNode(deviceNode); + if (!medium) { + TQStringVariantMap result; + result["errStr"] = i18n("No such medium: %1").arg(deviceNode); + result["result"] = false; + return result; + } + return decrypt(medium->id(), password); +} + +TQStringVariantMap MediaManager::undecryptByNode(const TQString &deviceNode) +{ + const Medium *medium = m_mediaList.findByNode(deviceNode); + if (!medium) { + TQStringVariantMap result; + result["errStr"] = i18n("No such medium: %1").arg(deviceNode); + result["result"] = false; + return result; + } + return undecrypt(medium->id()); +} + TQString MediaManager::nameForLabel(const TQString &label) { const TQPtrList media = m_mediaList.list(); -- cgit v1.2.1