summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media/mediamanager/mediamanager.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-03-27 20:01:48 +0900
committerMichele Calgaro <[email protected]>2022-03-27 20:01:48 +0900
commit4974727d50923a4393e5f0daddf4694c6e082a84 (patch)
tree97b2bc694bab23db107f132188ebed4fc46ac3da /tdeioslave/media/mediamanager/mediamanager.cpp
parent88d92af3c14c0b0b9149440c1b5d38e8fb7cbd79 (diff)
downloadtdebase-4974727d50923a4393e5f0daddf4694c6e082a84.tar.gz
tdebase-4974727d50923a4393e5f0daddf4694c6e082a84.zip
Add 'safeRemove' and 'safeRemoveByNode' to mediamanager DCOP interface.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdeioslave/media/mediamanager/mediamanager.cpp')
-rw-r--r--tdeioslave/media/mediamanager/mediamanager.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp
index dba4c1150..f8c2a574b 100644
--- a/tdeioslave/media/mediamanager/mediamanager.cpp
+++ b/tdeioslave/media/mediamanager/mediamanager.cpp
@@ -288,6 +288,20 @@ TQStringVariantMap MediaManager::eject(const TQString &uid)
return result;
}
+TQStringVariantMap MediaManager::safeRemove(const TQString &uid)
+{
+#ifdef COMPILE_TDEHARDWAREBACKEND
+ if (m_tdebackend)
+ {
+ return m_tdebackend->safeRemove(uid);
+ }
+#endif
+ TQStringVariantMap result;
+ result["errStr"] = i18n("Feature only available with the TDE hardware backend");
+ result["result"] = false;
+ return result;
+}
+
TQStringVariantMap MediaManager::mountByNode(const TQString &deviceNode)
{
const Medium *medium = m_mediaList.findByNode(deviceNode);
@@ -348,6 +362,18 @@ TQStringVariantMap MediaManager::ejectByNode(const TQString &deviceNode)
return eject(medium->id());
}
+TQStringVariantMap MediaManager::safeRemoveByNode(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 safeRemove(medium->id());
+}
+
TQString MediaManager::mimeType(const TQString &name)
{
const Medium *m = getMediumByName(name);