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