If requested to navigate to an encrypted disk from the location bar or

CLI, offer the user the ability to unlock the disk and subsequently
navigate to the "media" folder. This mirrors the same functionality
introduced in Konqueror.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/16/head
Michele Calgaro 3 years ago
parent 859e6b70bb
commit e119eb28db
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -22,6 +22,7 @@
#include "urlnavigator.h"
#include <assert.h>
#include <dcopref.h>
#include <kurl.h>
#include <tqobjectlist.h>
#include <tqcombobox.h>
@ -39,6 +40,7 @@
#include <kurlcombobox.h>
#include <kurlcompletion.h>
#include <kbookmarkmanager.h>
#include <kstandarddirs.h>
#include "dolphin.h"
#include "dolphinsettings.h"
@ -117,7 +119,8 @@ void URLNavigator::setURL(const KURL& url)
{
TQString urlStr(url.prettyURL());
if (url.protocol() == "zip") {
if (url.protocol() == "zip")
{
bool stillInside = false;
if( KMimeType::findByPath( url.url(-1) )->is("application/x-zip") ||
KMimeType::findByPath( url.url(-1) )->is("application/x-jar") ) {
@ -180,6 +183,35 @@ void URLNavigator::setURL(const KURL& url)
urlStr = url.path();
}
}
else if (urlStr.startsWith("system:/media") || urlStr.startsWith("media:/"))
{
DCOPRef mediamanager("kded", "mediamanager");
DCOPReply reply = mediamanager.call("mimeType", urlStr );
if (reply.isValid())
{
TQString itemMimeType = reply;
if (itemMimeType.contains("encrypted"))
{
if (itemMimeType.contains("encrypted_locked"))
{
TQString lockingService = TDEGlobal::dirs()->findResource("data", "d3lphin/servicemenus/media_unlock.desktop");
if (!lockingService.isEmpty())
{
TQValueList<KDEDesktopMimeType::Service> serviceList = KDEDesktopMimeType::userDefinedServices(lockingService, url.isLocalFile());
if (serviceList.count() == 1)
{
KURL::List m_lstURLs;
m_lstURLs.append(url);
KDEDesktopMimeType::executeService(m_lstURLs, serviceList[0]);
}
}
}
setURL(KURL("system:/media"));
return;
}
}
}
if (urlStr.at(0) == '~') {

Loading…
Cancel
Save