summaryrefslogtreecommitdiffstats
path: root/src/dolphinview.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-03-01 16:13:17 +0900
committerMichele Calgaro <[email protected]>2021-03-01 16:13:17 +0900
commit306e44e43eb1fd5b9ba66bfd345e9e6c5fca47cc (patch)
treefa7270b550c52a8f1123c40a86ef1fd935383834 /src/dolphinview.cpp
parente775a64c14d68c33a1aa11e378da955200493ecb (diff)
downloaddolphin-306e44e43eb1fd5b9ba66bfd345e9e6c5fca47cc.tar.gz
dolphin-306e44e43eb1fd5b9ba66bfd345e9e6c5fca47cc.zip
Encrypted disks will be locked/unlocked (based on their status) when
executed from the storage media location. This mirrors the functionality previously added in Konqueror. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/dolphinview.cpp')
-rw-r--r--src/dolphinview.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 5b0a310..577e546 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -22,6 +22,7 @@
#include <tqlayout.h>
#include <kurl.h>
+#include <kstandarddirs.h>
#include <tdelocale.h>
#include <tdeio/netaccess.h>
#include <tdeio/renamedlg.h>
@@ -691,7 +692,39 @@ void DolphinView::updateURL()
return;
}
- if (fileItem->isDir()) {
+ if (fileItem->isDir())
+ {
+ TQString itemMimeType = fileItem->mimetype();
+ if (itemMimeType.contains("encrypted_locked") || itemMimeType.contains("encrypted_unlocked"))
+ {
+ // Default action for media encrypted disks is either lock or unlock based on current status
+ TQString lockingAction = TQString::null;
+ if (itemMimeType.contains("encrypted_locked"))
+ {
+ lockingAction = "d3lphin/servicemenus/media_unlock.desktop";
+ }
+ else if (itemMimeType.contains("encrypted_unlocked"))
+ {
+ lockingAction = "d3lphin/servicemenus/media_lock.desktop";
+ }
+ if (!lockingAction.isEmpty())
+ {
+ TQString lockingService = TDEGlobal::dirs()->findResource("data", lockingAction);
+ if (!lockingService.isEmpty())
+ {
+ TQValueList<KDEDesktopMimeType::Service> serviceList = KDEDesktopMimeType::userDefinedServices(lockingService, fileItem->url().isLocalFile());
+ if (serviceList.count() == 1)
+ {
+ KURL::List m_lstURLs;
+ m_lstURLs.append(fileItem->url());
+ KDEDesktopMimeType::executeService(m_lstURLs, serviceList[0]);
+ Dolphin::mainWin().refreshViews();
+ return;
+ }
+ }
+ }
+ }
+
// Prefer the local path over the URL. This assures that the
// volume space information is correct. Assuming that the URL is media:/sda1,
// and the local path is /windows/C: For the URL the space info is related