summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-03-07 16:18:25 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-03-07 16:20:00 +0900
commite119eb28db6f5113b3082c0a46db2f487e5dda90 (patch)
tree93c220f0d7a78e3b64c529c6230195422f4ee3c7
parent859e6b70bb80e1736e36c406b7e24dcadc31f67c (diff)
downloaddolphin-e119eb28db6f5113b3082c0a46db2f487e5dda90.tar.gz
dolphin-e119eb28db6f5113b3082c0a46db2f487e5dda90.zip
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>
-rw-r--r--src/urlnavigator.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/urlnavigator.cpp b/src/urlnavigator.cpp
index 47eab75..725c062 100644
--- a/src/urlnavigator.cpp
+++ b/src/urlnavigator.cpp
@@ -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) == '~') {