diff options
author | Michele Calgaro <[email protected]> | 2019-06-01 21:55:11 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2019-07-08 10:33:33 +0900 |
commit | e44487e1b855106ddf00ade92a25493e11589ca1 (patch) | |
tree | c19755d458f464a6440813b6a97d29404b59257a /tdeioslave/media/mediamanager/mediamanager.cpp | |
parent | 7d2c7f0621177487fcc3953921788f7cafc509af (diff) | |
download | tdebase-e44487e1b855106ddf00ade92a25493e11589ca1.tar.gz tdebase-e44487e1b855106ddf00ade92a25493e11589ca1.zip |
Improved media manager dcop interface for mount/unmount/decrypt/undecrypt methods by returning more information.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdeioslave/media/mediamanager/mediamanager.cpp')
-rw-r--r-- | tdeioslave/media/mediamanager/mediamanager.cpp | 163 |
1 files changed, 103 insertions, 60 deletions
diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp index b08c37794..ef6721999 100644 --- a/tdeioslave/media/mediamanager/mediamanager.cpp +++ b/tdeioslave/media/mediamanager/mediamanager.cpp @@ -240,76 +240,119 @@ bool MediaManager::setMountoptions(const TQString &name, const TQStringList &opt #endif // COMPILE_HALBACKEND } -TQString MediaManager::mount(const TQString &name) +TQStringVariantMap MediaManager::mount(const TQString &uid) { -#ifdef COMPILE_HALBACKEND - if (!m_halbackend) - return i18n("Feature only available with HAL"); - return m_halbackend->mount(name); -#else // COMPILE_HALBACKEND - #ifdef COMPILE_TDEHARDWAREBACKEND - if (!m_tdebackend) - return i18n("Feature only available with the TDE hardware backend"); - return m_tdebackend->mount(name); - #else // COMPILE_TDEHARDWAREBACKEND - if ( !m_fstabbackend ) // lying :) - return i18n("Feature only available with HAL or TDE hardware backend"); - return m_fstabbackend->mount( name ); - #endif // COMPILE_TDEHARDWAREBACKEND -#endif // COMPILE_HALBACKEND + TQStringVariantMap result; +#ifdef COMPILE_TDEHARDWAREBACKEND + if (!m_tdebackend) { + result["errStr"] = i18n("Feature only available with the TDE hardware backend"); + result["result"] = false; + return result; + } + return m_tdebackend->mount(uid); +#elif defined COMPILE_HALBACKEND + if (!m_halbackend) { + result["errStr"] = i18n("Feature only available with HAL"); + result["result"] = false; + return result; + } + return m_halbackend->mount(uid); +#else + if (!m_fstabbackend) { + result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); + result["result"] = false; + return result; + } + return m_fstabbackend->mount(uid); +#endif } -TQString MediaManager::unmount(const TQString &name) +TQStringVariantMap MediaManager::unmount(const TQString &uid) { -#ifdef COMPILE_HALBACKEND - if (!m_halbackend) - return i18n("Feature only available with HAL"); - return m_halbackend->unmount(name); -#else // COMPILE_HALBACKEND - #ifdef COMPILE_TDEHARDWAREBACKEND - if (!m_tdebackend) - return i18n("Feature only available with HAL or TDE hardware backend"); - return m_tdebackend->unmount(name); - #else // COMPILE_TDEHARDWAREBACKEND - if ( !m_fstabbackend ) // lying :) - return i18n("Feature only available with HAL or TDE hardware backend"); - return m_fstabbackend->unmount( name ); - #endif // COMPILE_TDEHARDWAREBACKEND -#endif // COMPILE_HALBACKEND + TQStringVariantMap result; +#ifdef COMPILE_TDEHARDWAREBACKEND + if (!m_tdebackend) { + result["errStr"] = i18n("Feature only available with the TDE hardware backend"); + result["result"] = false; + return result; + } + return m_tdebackend->unmount(uid); +#elif defined COMPILE_HALBACKEND + if (!m_halbackend) { + result["errStr"] = i18n("Feature only available with HAL"); + result["result"] = false; + return result; + } + return m_halbackend->unmount(uid); +#else + if (!m_fstabbackend) { + result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); + result["result"] = false; + return result; + } + return m_fstabbackend->unmount(uid); +#endif } -TQString MediaManager::decrypt(const TQString &name, const TQString &password) +TQStringVariantMap MediaManager::decrypt(const TQString &uid, const TQString &password) { -#ifdef COMPILE_HALBACKEND - if (!m_halbackend) - return i18n("Feature only available with HAL"); - return m_halbackend->decrypt(name, password); -#else // COMPILE_HALBACKEND -// #ifdef COMPILE_TDEHARDWAREBACKEND -// if (!m_tdebackend) -// return i18n("Feature only available with HAL or TDE hardware backend"); -// return m_tdebackend->decrypt(name, password); -// #else // COMPILE_TDEHARDWAREBACKEND - return i18n("Feature only available with HAL"); -// #endif // COMPILE_TDEHARDWAREBACKEND -#endif // COMPILE_HALBACKEND + TQStringVariantMap result; +/* +#ifdef COMPILE_TDEHARDWAREBACKEND + if (!m_tdebackend) { + result["errStr"] = i18n("Feature only available with the TDE hardware backend"); + result["result"] = false; + return result; + } + return m_tdebackend->decrypt(uid, password); +#elif defined COMPILE_HALBACKEND +*/ +#if defined COMPILE_HALBACKEND + if (!m_halbackend) { + result["errStr"] = i18n("Feature only available with HAL"); + result["result"] = false; + return result; + } + return m_halbackend->decrypt(uid, password); + +#else +// if (!m_fstabbackend) { + result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); + result["result"] = false; + return result; +// } +// return m_fstabbackend->decrypt(uid, password); +#endif } -TQString MediaManager::undecrypt(const TQString &name) +TQStringVariantMap MediaManager::undecrypt(const TQString &uid) { -#ifdef COMPILE_HALBACKEND - if (!m_halbackend) - return i18n("Feature only available with HAL"); - return m_halbackend->undecrypt(name); -#else // COMPILE_HALBACKEND -// #ifdef COMPILE_TDEHARDWAREBACKEND -// if (!m_tdebackend) -// return i18n("Feature only available with HAL or TDE hardware backend"); -// return m_tdebackend->undecrypt(name); -// #else // COMPILE_TDEHARDWAREBACKEND - return i18n("Feature only available with HAL"); -// #endif // COMPILE_TDEHARDWAREBACKEND -#endif // COMPILE_HALBACKEND + TQStringVariantMap result; +/* +#ifdef COMPILE_TDEHARDWAREBACKEND + if (!m_tdebackend) { + result["errStr"] = i18n("Feature only available with the TDE hardware backend"); + result["result"] = false; + return result; + } + return m_tdebackend->undecrypt(uid); +#elif defined COMPILE_HALBACKEND +*/ +#if defined COMPILE_HALBACKEND + if (!m_halbackend) { + result["errStr"] = i18n("Feature only available with HAL"); + result["result"] = false; + return result; + } + return m_halbackend->undecrypt(uid); +#else +// if (!m_fstabbackend) { + result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); + result["result"] = false; + return result; +// } +// return m_fstabbackend->undecrypt(uid); +#endif } TQString MediaManager::nameForLabel(const TQString &label) |