diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-06-02 15:45:44 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2019-07-08 10:33:34 +0900 |
commit | b4754b0e6fc213e0880947cb2c01dfab834fa264 (patch) | |
tree | 3086eb9f5c497c4d8fd9c747f0b8c2922bcb330b /tdeioslave/media/mediamanager/mediamanager.cpp | |
parent | e44487e1b855106ddf00ade92a25493e11589ca1 (diff) | |
download | tdebase-b4754b0e6fc213e0880947cb2c01dfab834fa264.tar.gz tdebase-b4754b0e6fc213e0880947cb2c01dfab834fa264.zip |
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 <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdeioslave/media/mediamanager/mediamanager.cpp')
-rw-r--r-- | tdeioslave/media/mediamanager/mediamanager.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
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<Medium> media = m_mediaList.list(); |