summaryrefslogtreecommitdiffstats
path: root/tdeioslave
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-06-10 15:00:20 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-10-17 10:48:27 +0800
commit3676cf129d85151dd430633847e3c289327405d5 (patch)
tree5ef29a2767f54ad7b642a75355bff277e47c9449 /tdeioslave
parent11beb5658031277ef94a1506a6668ff32b1ea111 (diff)
downloadtdebase-3676cf129d85151dd430633847e3c289327405d5.tar.gz
tdebase-3676cf129d85151dd430633847e3c289327405d5.zip
tdeioslave media: added initial support for unlocking/locking of encrypted devices.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'tdeioslave')
-rw-r--r--tdeioslave/media/mediamanager/halbackend.cpp2
-rw-r--r--tdeioslave/media/mediamanager/mediamanager.cpp6
-rw-r--r--tdeioslave/media/mediamanager/tdehardwarebackend.cpp89
-rw-r--r--tdeioslave/media/mediamanager/tdehardwarebackend.h4
-rw-r--r--tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp189
-rw-r--r--tdeioslave/media/mounthelper/unlockdialog.ui2
-rw-r--r--tdeioslave/media/services/CMakeLists.txt3
-rw-r--r--tdeioslave/media/services/Makefile.am2
-rw-r--r--tdeioslave/media/services/media_lock.desktop11
-rw-r--r--tdeioslave/media/services/media_unlock.desktop (renamed from tdeioslave/media/services/media_decrypt.desktop)0
10 files changed, 209 insertions, 99 deletions
diff --git a/tdeioslave/media/mediamanager/halbackend.cpp b/tdeioslave/media/mediamanager/halbackend.cpp
index 157f89212..b6f35c997 100644
--- a/tdeioslave/media/mediamanager/halbackend.cpp
+++ b/tdeioslave/media/mediamanager/halbackend.cpp
@@ -1417,7 +1417,6 @@ void HALBackend::slotResult(TDEIO::Job *job)
if (job->error() == TDEIO::ERR_COULD_NOT_UNMOUNT) {
TQString proclist(listUsingProcesses(medium));
- qerror = "<qt>";
qerror += "<p>" + i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and "
"currently mounted at <b>%4</b> could not be unmounted. ").arg(
"system:/media/" + medium->name(),
@@ -1430,7 +1429,6 @@ void HALBackend::slotResult(TDEIO::Job *job)
if (!proclist.isEmpty()) {
qerror += proclist;
}
- qerror += "</qt>";
} else if (job->error()) {
qerror = job->errorText();
}
diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp
index 7a8262eec..38e433bfe 100644
--- a/tdeioslave/media/mediamanager/mediamanager.cpp
+++ b/tdeioslave/media/mediamanager/mediamanager.cpp
@@ -297,7 +297,6 @@ TQStringVariantMap MediaManager::unmount(const TQString &uid)
TQStringVariantMap MediaManager::unlock(const TQString &uid, const TQString &password)
{
TQStringVariantMap result;
-/*
#ifdef COMPILE_TDEHARDWAREBACKEND
if (!m_tdebackend) {
result["errStr"] = i18n("Feature only available with the TDE hardware backend");
@@ -306,8 +305,6 @@ TQStringVariantMap MediaManager::unlock(const TQString &uid, const TQString &pas
}
return m_tdebackend->unlock(uid, password);
#elif defined COMPILE_HALBACKEND
-*/
-#if defined COMPILE_HALBACKEND
if (!m_halbackend) {
result["errStr"] = i18n("Feature only available with HAL");
result["result"] = false;
@@ -328,7 +325,6 @@ TQStringVariantMap MediaManager::unlock(const TQString &uid, const TQString &pas
TQStringVariantMap MediaManager::lock(const TQString &uid)
{
TQStringVariantMap result;
-/*
#ifdef COMPILE_TDEHARDWAREBACKEND
if (!m_tdebackend) {
result["errStr"] = i18n("Feature only available with the TDE hardware backend");
@@ -337,8 +333,6 @@ TQStringVariantMap MediaManager::lock(const TQString &uid)
}
return m_tdebackend->lock(uid);
#elif defined COMPILE_HALBACKEND
-*/
-#if defined COMPILE_HALBACKEND
if (!m_halbackend) {
result["errStr"] = i18n("Feature only available with HAL");
result["result"] = false;
diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
index c399d280d..f0c432a37 100644
--- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
+++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp
@@ -1441,7 +1441,7 @@ TQStringVariantMap TDEBackend::unmount(const TQString &id)
// Failed as BUSY
TQString processesUsingDev = listUsingProcesses(medium);
if (!processesUsingDev.isNull()) {
- if (KMessageBox::warningYesNo(0, i18n("<qt>The device <b>%1</b> (%2) named <b>'%3'</b> and currently "
+ if (KMessageBox::warningYesNo(0, i18n("The device <b>%1</b> (%2) named <b>'%3'</b> and currently "
"mounted at <b>%4</b> can not be unmounted at this time.<p>%5<p><b>Would you like to forcibly "
"terminate these processes?</b><br><i>All unsaved data would be lost</i>").arg("system:/media/" +
medium->name()).arg(medium->deviceNode()).arg(medium->prettyLabel()).arg(medium->prettyBaseURL().pathOrURL())
@@ -1480,6 +1480,91 @@ TQStringVariantMap TDEBackend::unmount(const TQString &id)
return result;
}
+TQStringVariantMap TDEBackend::unlock(const TQString &id, const TQString &password)
+{
+ kdDebug(1219) << "TDEBackend::unlock for id " << id << endl;
+
+ TQStringVariantMap result;
+
+ const Medium* medium = m_mediaList.findById(id);
+ if (!medium) {
+ result["errStr"] = i18n("No such medium: %1").arg(id);
+ result["result"] = false;
+ return result;
+ }
+
+ if (!medium->isEncrypted() || !medium->clearDeviceUdi().isNull()) {
+ result["result"] = true;
+ return result;
+ }
+
+ TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
+ TDEStorageDevice *sdevice = hwdevices->findDiskByUID(medium->id());
+ if (!sdevice) {
+ result["errStr"] = i18n("Internal error. Couldn't find medium.");
+ result["result"] = false;
+ return result;
+ }
+
+ TQStringVariantMap unlockResult = sdevice->unlockDevice(password);
+ if (unlockResult["result"].toBool() == false) {
+ TQString qerror = i18n("Unable to unlock the device.");
+ TQString errStr = unlockResult.contains("errStr") ? unlockResult["errStr"].toString() : TQString::null;
+ if (!errStr.isEmpty()) {
+ qerror.append(i18n("<p>Technical details:<br>").append(errStr));
+ result["errStr"] = qerror;
+ result["result"] = false;
+ return result;
+ }
+ }
+
+ result["result"] = unlockResult["unlockedDevice"];
+ result["result"] = true;
+ return result;
+}
+
+TQStringVariantMap TDEBackend::lock(const TQString &id)
+{
+ kdDebug(1219) << "TDEBackend::lock for id " << id << endl;
+
+ TQStringVariantMap result;
+
+ const Medium* medium = m_mediaList.findById(id);
+ if (!medium) {
+ result["errStr"] = i18n("No such medium: %1").arg(id);
+ result["result"] = false;
+ return result;
+ }
+
+ if (!medium->isEncrypted() || !medium->clearDeviceUdi().isNull()) {
+ result["result"] = true;
+ return result;
+ }
+
+ TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
+ TDEStorageDevice *sdevice = hwdevices->findDiskByUID(medium->id());
+ if (!sdevice) {
+ result["errStr"] = i18n("Internal error. Couldn't find medium.");
+ result["result"] = false;
+ return result;
+ }
+
+ TQStringVariantMap lockResult = sdevice->lockDevice();
+ if (lockResult["result"].toBool() == false) {
+ TQString qerror = i18n("Unable to lock the device.");
+ TQString errStr = lockResult.contains("errStr") ? lockResult["errStr"].toString() : TQString::null;
+ if (!errStr.isEmpty()) {
+ qerror.append(i18n("<p>Technical details:<br>").append(errStr));
+ result["errStr"] = qerror;
+ result["result"] = false;
+ return result;
+ }
+ }
+
+ result["result"] = true;
+ return result;
+}
+
void TDEBackend::slotResult(TDEIO::Job *job)
{
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
@@ -1491,7 +1576,6 @@ void TDEBackend::slotResult(TDEIO::Job *job)
if (job->error() == TDEIO::ERR_COULD_NOT_UNMOUNT) {
TQString proclist(listUsingProcesses(medium));
- qerror = "<qt>";
qerror += "<p>" + i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and "
"currently mounted at <b>%4</b> could not be unmounted. ").arg(
"system:/media/" + medium->name(),
@@ -1504,7 +1588,6 @@ void TDEBackend::slotResult(TDEIO::Job *job)
if (!proclist.isEmpty()) {
qerror += proclist;
}
- qerror += "</qt>";
} else if (job->error()) {
qerror = job->errorText();
}
diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.h b/tdeioslave/media/mediamanager/tdehardwarebackend.h
index 5c6ce1260..fd81e9a3e 100644
--- a/tdeioslave/media/mediamanager/tdehardwarebackend.h
+++ b/tdeioslave/media/mediamanager/tdehardwarebackend.h
@@ -71,8 +71,8 @@ public:
TQStringVariantMap mount(const TQString &id);
TQStringVariantMap mount(const Medium *medium);
TQStringVariantMap unmount(const TQString &id);
-// TQStringVariantMap unlock(const TQString &id, const TQString &password);
-// TQStringVariantMap lock(const TQString &id);
+ TQStringVariantMap unlock(const TQString &id, const TQString &password);
+ TQStringVariantMap lock(const TQString &id);
private:
/**
diff --git a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp
index 65b53a0f4..f02c93c84 100644
--- a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp
+++ b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp
@@ -45,16 +45,16 @@ const Medium MountHelper::findMedium(const KURL &url)
DCOPRef mediamanager("kded", "mediamanager");
// Try filename first
- DCOPReply reply = mediamanager.call( "properties", url.fileName() );
- if ( !reply.isValid() ) {
+ DCOPReply reply = mediamanager.call("properties", url.fileName());
+ if (!reply.isValid()) {
m_errorStr = i18n("The TDE mediamanager is not running.")+"\n";
return Medium(TQString::null, TQString::null, TQString::null);
}
const Medium& medium = Medium::create(reply);
- if ( medium.id().isEmpty() ) {
+ if (medium.id().isEmpty()) {
// Try full URL now
- reply = mediamanager.call( "properties", url.prettyURL() );
- if ( !reply.isValid() ) {
+ reply = mediamanager.call("properties", url.prettyURL());
+ if (!reply.isValid()) {
m_errorStr = i18n("Internal Error");
return Medium(TQString::null, TQString::null, TQString::null);
}
@@ -72,20 +72,19 @@ MountHelper::MountHelper() : TDEApplication()
KURL url(args->url(0));
const Medium medium = findMedium(url);
-
if (medium.id().isEmpty())
{
if (m_errorStr.isEmpty()) {
m_errorStr+= i18n("%1 cannot be found.").arg(url.prettyURL());
}
- TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
return;
}
if (!medium.isMountable() && !args->isSet("e") && !args->isSet("s"))
{
m_errorStr = i18n("%1 is not a mountable media.").arg(url.prettyURL());
- TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
return;
}
@@ -94,12 +93,48 @@ MountHelper::MountHelper() : TDEApplication()
m_isCdrom = medium.mimeType().find("dvd") != -1 || medium.mimeType().find("cd") != -1;
- if (args->isSet("d"))
+ if (args->isSet("m"))
+ {
+ // Mount drive
+ DCOPRef mediamanager("kded", "mediamanager");
+ DCOPReply reply = mediamanager.call("mount", medium.id());
+ TQStringVariantMap mountResult;
+ if (reply.isValid()) {
+ reply.get(mountResult);
+ }
+ if (mountResult.contains("result") && mountResult["result"].toBool()) {
+ ::exit(0);
+ }
+ else {
+ m_errorStr = mountResult.contains("errStr") ? mountResult["errStr"].toString() : i18n("Unknown mount error.");
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
+ }
+ }
+ else if (args->isSet("u"))
+ {
+ // Unmount drive
+ DCOPRef mediamanager("kded", "mediamanager");
+ DCOPReply reply = mediamanager.call("unmount", medium.id());
+ TQStringVariantMap unmountResult;
+ if (reply.isValid()) {
+ reply.get(unmountResult);
+ }
+ if (unmountResult.contains("result") && unmountResult["result"].toBool()) {
+ ::exit(0);
+ }
+ else {
+ m_errorStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : i18n("Unknown unmount error.");
+ kdDebug() << "medium unmount " << m_errorStr << endl;
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
+ }
+ }
+ else if (args->isSet("k"))
{
+ // Unlock drive
if (!medium.isEncrypted())
{
m_errorStr = i18n("%1 is not an encrypted media.").arg(url.prettyURL());
- TQTimer::singleShot(0, this, TQT_SLOT(error()) );
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
return;
}
if (!medium.needDecryption())
@@ -115,34 +150,38 @@ MountHelper::MountHelper() : TDEApplication()
TQString mime = medium.mimeType();
iconName = KMimeType::mimeType(mime)->icon(mime, false);
}
-
m_mediumId = medium.id();
dialog = new Dialog(url.prettyURL(), iconName);
+ connect(dialog, TQT_SIGNAL(user1Clicked()), this, TQT_SLOT(slotSendPassword()));
+ connect(dialog, TQT_SIGNAL(cancelClicked()), this, TQT_SLOT(slotCancel()));
+ connect(this, TQT_SIGNAL(signalPasswordError(TQString)), dialog, TQT_SLOT(slotDialogError(TQString)));
dialog->show();
-
- connect(dialog, TQT_SIGNAL (user1Clicked()), this, TQT_SLOT (slotSendPassword()));
- connect(dialog, TQT_SIGNAL (cancelClicked()), this, TQT_SLOT (slotCancel()));
- connect(this, TQT_SIGNAL (signalPasswordError(TQString)), dialog, TQT_SLOT (slotDialogError(TQString)));
}
- else if (args->isSet("u"))
+ else if (args->isSet("l"))
{
- DCOPRef mediamanager("kded", "mediamanager");
- DCOPReply reply = mediamanager.call("unmount", medium.id());
- TQStringVariantMap unmountResult;
- if (reply.isValid()) {
- reply.get(unmountResult);
- }
- if (unmountResult.contains("result") && unmountResult["result"].toBool()) {
+ // Lock drive
+ DCOPRef mediamanager("kded", "mediamanager");
+ DCOPReply reply = mediamanager.call("lock", medium.id());
+ TQStringVariantMap lockResult;
+ if (reply.isValid()) {
+ reply.get(lockResult);
+ }
+ if (lockResult.contains("result") && lockResult["result"].toBool()) {
::exit(0);
}
else {
- m_errorStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : i18n("Unknown unmount error.");
- kdDebug() << "medium unmount " << m_errorStr << endl;
- error();
- }
+ m_errorStr = lockResult.contains("errStr") ? lockResult["errStr"].toString() : i18n("Unknown lock error.");
+ kdDebug() << "medium lock " << m_errorStr << endl;
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
+ }
}
- else if (args->isSet("s") || args->isSet("e"))
+ else if (args->isSet("e"))
{
+ invokeEject(device, true);
+ }
+ else if (args->isSet("s"))
+ {
+ // Safely remove drive
DCOPRef mediamanager("kded", "mediamanager");
/*
@@ -157,11 +196,11 @@ MountHelper::MountHelper() : TDEApplication()
TQStringVariantMap unmountResult;
if (medium.isMounted())
{
- DCOPReply reply = mediamanager.call( "unmount", medium.id());
+ DCOPReply reply = mediamanager.call("unmount", medium.id());
if (reply.isValid()) {
reply.get(unmountResult);
- if (unmountResult["result"].toBool()) {
- reply.get(m_errorStr);
+ if (unmountResult.contains("result") && !unmountResult["result"].toBool()) {
+ m_errorStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : i18n("Unknown unmount error.");
}
}
}
@@ -170,38 +209,26 @@ MountHelper::MountHelper() : TDEApplication()
if (unmountResult.contains("result") && unmountResult["result"].toBool() &&
medium.isEncrypted() && !medium.clearDeviceUdi().isNull())
{
- DCOPReply reply = mediamanager.call( "undecrypt", medium.id());
+ DCOPReply reply = mediamanager.call("lock", medium.id());
if (reply.isValid()) {
- TQStringVariantMap undecryptResult;
- reply.get(undecryptResult);
- if (undecryptResult["result"].toBool()) {
- reply.get(m_errorStr);
+ TQStringVariantMap lockResult;
+ reply.get(lockResult);
+ if (lockResult.contains("result") && !lockResult["result"].toBool()) {
+ m_errorStr = lockResult.contains("errStr") ? lockResult["errStr"].toString() : i18n("Unknown lock error.");
}
}
}
- if (m_errorStr.isNull()) {
+ if (m_errorStr.isEmpty()) {
invokeEject(device, true);
}
else {
- error();
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
}
}
else
{
- DCOPRef mediamanager("kded", "mediamanager");
- DCOPReply reply = mediamanager.call("mount", medium.id());
- TQStringVariantMap mountResult;
- if (reply.isValid()) {
- reply.get(mountResult);
- }
- if (mountResult.contains("result") && mountResult["result"].toBool()) {
- ::exit(0);
- }
- else {
- m_errorStr = mountResult.contains("errStr") ? mountResult["errStr"].toString() : i18n("Unknown mount error.");
- error();
- }
+ TDECmdLineArgs::usage();
}
}
@@ -212,7 +239,7 @@ void MountHelper::invokeEject(const TQString &device, bool quiet)
TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
TDEGenericDevice *hwdevice = hwdevices->findByDeviceNode(device);
if (hwdevice->type() == TDEGenericDeviceType::Disk) {
- TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice);
+ TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice);
if (sdevice->ejectDrive()) {
// Success!
::exit(0);
@@ -228,28 +255,21 @@ void MountHelper::invokeEject(const TQString &device, bool quiet)
*proc << "-q";
}
*proc << device;
- connect( proc, TQT_SIGNAL(processExited(TDEProcess *)),
- this, TQT_SLOT( ejectFinished(TDEProcess *) ) );
+ connect(proc, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(ejectFinished(TDEProcess*)));
proc->start();
}
-void MountHelper::ejectFinished(TDEProcess* proc)
+void MountHelper::ejectFinished(TDEProcess *proc)
{
- /*
- * If eject failed, report the error stored in m_errorStr
- */
+ //If eject failed, report the error stored in m_errorStr
if (proc->normalExit() && proc->exitStatus() == 0) {
::exit(0);
- } else {
- if (m_errorStr.isEmpty()) {
- if (m_isCdrom)
- m_errorStr = i18n("The device was successfully unmounted, but the tray could not be opened");
- else
- m_errorStr = i18n("The device was successfully unmounted, but could not be ejected");
+ }
+ else {
+ if (!m_errorStr.isEmpty()) {
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
}
-//X Comment this because the error is useless as long as the unmount is successful.
-//X TQTimer::singleShot(0, this, TQT_SLOT(error()));
- ::exit(0);
+ ::exit(0);
}
}
@@ -269,19 +289,19 @@ void MountHelper::slotSendPassword()
{
DCOPRef mediamanager("kded", "mediamanager");
- DCOPReply reply = mediamanager.call( "decrypt", m_mediumId, dialog->getPassword() );
- TQStringVariantMap decryptResult;
+ DCOPReply reply = mediamanager.call("unlock", m_mediumId, dialog->getPassword());
+ TQStringVariantMap unlockResult;
if (reply.isValid()) {
- reply.get(decryptResult);
+ reply.get(unlockResult);
}
- if (decryptResult.contains("result") && decryptResult["result"].toBool()) {
+ if (unlockResult.contains("result") && unlockResult["result"].toBool()) {
::exit(0);
}
else {
- m_errorStr = decryptResult.contains("errStr") ? decryptResult["errStr"].toString() : i18n("Unknown decrypt error.");
- kdDebug() << "medium decrypt " << m_errorStr << endl;
+ m_errorStr = unlockResult.contains("errStr") ? unlockResult["errStr"].toString() : i18n("Unknown unlock error.");
+ kdDebug() << "medium unlock " << m_errorStr << endl;
emit signalPasswordError(m_errorStr);
- error();
+ TQTimer::singleShot(0, this, TQT_SLOT(error()));
}
}
@@ -292,12 +312,13 @@ void MountHelper::slotCancel()
static TDECmdLineOptions options[] =
{
- { "d", I18N_NOOP("Decrypt given URL"), 0 },
+ { "m", I18N_NOOP("Mount given URL"), 0 },
{ "u", I18N_NOOP("Unmount given URL"), 0 },
- { "m", I18N_NOOP("Mount given URL (default)"), 0 },
- { "e", I18N_NOOP("Eject given URL via tdeeject"), 0},
- { "s", I18N_NOOP("Unmount and Eject given URL (necessary for some USB devices)"), 0},
- {"!+URL", I18N_NOOP("media:/ URL to mount/unmount/eject/remove"), 0 },
+ { "k", I18N_NOOP("Unlock given URL"), 0 },
+ { "l", I18N_NOOP("Lock given URL"), 0 },
+ { "e", I18N_NOOP("Eject given URL"), 0},
+ { "s", I18N_NOOP("Safely remove (unmount and eject) given URL"), 0},
+ {"!+URL", I18N_NOOP("media:/URL to mount/unmount/unlock/lock/eject/remove"), 0 },
TDECmdLineLastOption
};
@@ -308,13 +329,15 @@ int main(int argc, char **argv)
"tdeio_media_mounthelper", "tdeio_media_mounthelper",
"0.1");
- TDECmdLineArgs::addCmdLineOptions( options );
+ TDECmdLineArgs::addCmdLineOptions(options);
TDEGlobal::locale()->setMainCatalogue("tdeio_media");
TDEApplication::addCmdLineOptions();
+ if (TDECmdLineArgs::parsedArgs()->count()==0)
+ {
+ TDECmdLineArgs::usage();
+ }
- if (TDECmdLineArgs::parsedArgs()->count()==0) TDECmdLineArgs::usage();
- TDEApplication *app = new MountHelper();
-
+ TDEApplication *app = new MountHelper();
TDEStartupInfo::appStarted();
app->dcopClient()->attach();
return app->exec();
diff --git a/tdeioslave/media/mounthelper/unlockdialog.ui b/tdeioslave/media/mounthelper/unlockdialog.ui
index 99a46a9ac..3a5ccb620 100644
--- a/tdeioslave/media/mounthelper/unlockdialog.ui
+++ b/tdeioslave/media/mounthelper/unlockdialog.ui
@@ -107,7 +107,7 @@
</property>
<property name="text">
<string>&lt;p&gt;&lt;b&gt;%1&lt;/b&gt; is an encrypted storage device.&lt;/p&gt;
-&lt;p&gt;Please enter the password to decrypt the storage device.&lt;/p&gt;</string>
+&lt;p&gt;Please enter the password to unlock the storage device.&lt;/p&gt;</string>
</property>
<property name="alignment">
<set>WordBreak|AlignTop</set>
diff --git a/tdeioslave/media/services/CMakeLists.txt b/tdeioslave/media/services/CMakeLists.txt
index b550409ba..9b66bd7a8 100644
--- a/tdeioslave/media/services/CMakeLists.txt
+++ b/tdeioslave/media/services/CMakeLists.txt
@@ -13,7 +13,8 @@
tde_create_translated_desktop(
SOURCE
- media_decrypt.desktop media_mount.desktop media_unmount.desktop
+ media_mount.desktop media_unmount.desktop
+ media_unlock.desktop media_lock.desktop
media_eject.desktop media_safelyremove.desktop
DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus
PO_DIR tdeioslave-desktops
diff --git a/tdeioslave/media/services/Makefile.am b/tdeioslave/media/services/Makefile.am
index c744934f2..5dc9155c4 100644
--- a/tdeioslave/media/services/Makefile.am
+++ b/tdeioslave/media/services/Makefile.am
@@ -1,3 +1,3 @@
servicesdir = $(kde_datadir)/konqueror/servicemenus
-services_DATA = media_decrypt.desktop media_mount.desktop media_unmount.desktop media_eject.desktop media_safelyremove.desktop
+services_DATA = media_mount.desktop media_unmount.desktop media_unlock.desktop media_lock.desktop media_eject.desktop media_safelyremove.desktop
diff --git a/tdeioslave/media/services/media_lock.desktop b/tdeioslave/media/services/media_lock.desktop
new file mode 100644
index 000000000..0f99d166c
--- /dev/null
+++ b/tdeioslave/media/services/media_lock.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+X-TDE-ServiceTypes=media/removable_encrypted_unlocked,media/hdd_encrypted_unlocked,media/cdrom_encrypted_unlocked,media/cd-rw_encrypted_unlocked,media/dvd_encrypted_unlocked
+Actions=MediaLock;
+X-TDE-Priority=TopLevel
+X-TDE-MediaNotifierHide=true
+
+[Desktop Action MediaLock]
+Exec=tdeio_media_mounthelper -l %u
+Icon=encrypted
+Name=Lock
+
diff --git a/tdeioslave/media/services/media_decrypt.desktop b/tdeioslave/media/services/media_unlock.desktop
index ee48f2e63..ee48f2e63 100644
--- a/tdeioslave/media/services/media_decrypt.desktop
+++ b/tdeioslave/media/services/media_unlock.desktop