diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-03-23 09:56:22 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-03-23 11:48:38 +0900 |
commit | 40ef766f02ea0e099a3fad77ed7eec519e2d5ec8 (patch) | |
tree | 2691377174181d81f7451ce83543ab83a5b057fc /tdeioslave/media/mounthelper | |
parent | d048506bb65a3f77102f07f54c7bfc16c80e003e (diff) | |
download | tdebase-40ef766f02ea0e099a3fad77ed7eec519e2d5ec8.tar.gz tdebase-40ef766f02ea0e099a3fad77ed7eec519e2d5ec8.zip |
tdeio media: add releaseHolders parameter to lock/lockByNode dcop calls.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdeioslave/media/mounthelper')
-rw-r--r-- | tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp | 41 | ||||
-rw-r--r-- | tdeioslave/media/mounthelper/tdeio_media_mounthelper.h | 2 |
2 files changed, 14 insertions, 29 deletions
diff --git a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp index bbfbaa6b2..706b5e13a 100644 --- a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp +++ b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp @@ -29,6 +29,7 @@ #include <kurl.h> #include <tdemessagebox.h> #include <dcopclient.h> +#include <dcopref.h> #include <tqtimer.h> #include <stdlib.h> #include <kdebug.h> @@ -45,7 +46,8 @@ const Medium MountHelper::findMedium(const TQString &device) { - DCOPReply reply = m_mediamanager.call("properties", device); + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("properties", device); if (!reply.isValid()) { m_errorStr = i18n("The TDE mediamanager is not running.\n"); @@ -57,7 +59,8 @@ const Medium MountHelper::findMedium(const TQString &device) void MountHelper::mount(const Medium &medium) { - DCOPReply reply = m_mediamanager.call("mount", medium.id()); + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("mount", medium.id()); TQStringVariantMap mountResult; if (reply.isValid()) { reply.get(mountResult); @@ -70,7 +73,8 @@ void MountHelper::mount(const Medium &medium) void MountHelper::unmount(const Medium &medium) { - DCOPReply reply = m_mediamanager.call("unmount", medium.id()); + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("unmount", medium.id()); TQStringVariantMap unmountResult; if (reply.isValid()) { reply.get(unmountResult); @@ -105,27 +109,8 @@ void MountHelper::unlock(const Medium &medium) void MountHelper::lock(const Medium &medium) { - if (medium.id().isEmpty()) - { - m_errorStr = i18n("Try to lock an unknown medium."); - errorAndExit(); - } - TQString device = medium.deviceNode(); - if (!medium.isEncrypted()) - { - m_errorStr = i18n("%1 is not an encrypted media.").arg(device); - errorAndExit(); - } - if (medium.needUnlocking()) - { - m_errorStr = i18n("%1 is already locked.").arg(device); - errorAndExit(); - } - - // Release children devices - releaseHolders(medium); - - DCOPReply reply = m_mediamanager.call("lock", medium.id()); + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("lock", medium.id(), true); TQStringVariantMap lockResult; if (reply.isValid()) { reply.get(lockResult); @@ -140,7 +125,8 @@ void MountHelper::lock(const Medium &medium) void MountHelper::eject(const Medium &medium) { #ifdef WITH_TDEHWLIB - DCOPReply reply = m_mediamanager.call("eject", medium.id()); + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("eject", medium.id()); TQStringVariantMap ejectResult; if (reply.isValid()) { reply.get(ejectResult); @@ -271,7 +257,7 @@ void MountHelper::openRealFolder(const Medium &medium) } } -MountHelper::MountHelper() : TDEApplication(), m_mediamanager("kded", "mediamanager") +MountHelper::MountHelper() : TDEApplication() { TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); m_errorStr = TQString::null; @@ -377,7 +363,8 @@ void MountHelper::errorAndExit() void MountHelper::slotSendPassword() { - DCOPReply reply = m_mediamanager.call("unlock", m_mediumId, m_dialog->getPassword()); + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("unlock", m_mediumId, m_dialog->getPassword()); TQStringVariantMap unlockResult; if (reply.isValid()) { reply.get(unlockResult); diff --git a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.h b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.h index eff02b1e1..540012ce3 100644 --- a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.h +++ b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.h @@ -25,7 +25,6 @@ #include <tdeapplication.h> #include <tqstring.h> #include <tdeio/job.h> -#include <dcopref.h> #include "medium.h" @@ -44,7 +43,6 @@ private: TQString m_errorStr; TQString m_mediumId; Dialog *m_dialog; - DCOPRef m_mediamanager; const Medium findMedium(const TQString &device); void error(); |