From 306e44e43eb1fd5b9ba66bfd345e9e6c5fca47cc Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 1 Mar 2021 16:13:17 +0900 Subject: 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 --- src/dolphinview.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/dolphinview.cpp') 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 #include +#include #include #include #include @@ -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 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 -- cgit v1.2.3