summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--konqueror/konq_mainwindow.cc23
-rw-r--r--libkonq/tdefileivi.cc25
2 files changed, 45 insertions, 3 deletions
diff --git a/konqueror/konq_mainwindow.cc b/konqueror/konq_mainwindow.cc
index 4ae1f63c1..ebd9ab8df 100644
--- a/konqueror/konq_mainwindow.cc
+++ b/konqueror/konq_mainwindow.cc
@@ -476,11 +476,9 @@ void KonqMainWindow::openURL( KonqView *_view, const KURL &_url,
const TQString &_serviceType, KonqOpenURLRequest& req,
bool trustedSource )
{
-#ifndef NDEBUG // needed for req.debug()
kdDebug(1202) << "KonqMainWindow::openURL : url = '" << _url << "' "
<< "serviceType='" << _serviceType << "' req=" << req.debug()
<< " view=" << _view << endl;
-#endif
KURL url( _url );
if (url.url().startsWith("$(")) {
@@ -543,6 +541,27 @@ void KonqMainWindow::openURL( KonqView *_view, const KURL &_url,
return;
}
+ // Default action for media encrypted disks is either lock or unlock based on current status
+ TQString lockingAction = TQString::null;
+ if (serviceType.contains("encrypted_locked")) {
+ lockingAction = "konqueror/servicemenus/media_unlock.desktop";
+ }
+ else if (serviceType.contains("encrypted_unlocked")) {
+ lockingAction = "konqueror/servicemenus/media_lock.desktop";
+ }
+ if (!lockingAction.isEmpty()) {
+ TQString lockingService = TDEGlobal::dirs()->findResource("data", lockingAction);
+ 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]);
+ return;
+ }
+ }
+ }
+
TQString nameFilter = detectNameFilter( url );
if ( !nameFilter.isEmpty() )
{
diff --git a/libkonq/tdefileivi.cc b/libkonq/tdefileivi.cc
index 4cbb6cdca..ad2d743a1 100644
--- a/libkonq/tdefileivi.cc
+++ b/libkonq/tdefileivi.cc
@@ -32,6 +32,8 @@
#include <kdebug.h>
#include <krun.h>
#include <kservice.h>
+#include <kmimetype.h> // for KDEDesktopMimeType
+#include <kstandarddirs.h>
#undef Bool
@@ -386,7 +388,28 @@ void KFileIVI::returnPressed()
if ( static_cast<KonqIconViewWidget*>(iconView())->isDesktop() ) {
KURL url = m_fileitem->url();
if (url.protocol() == "media") {
- (void) new KRun( url, m_fileitem->mode(), m_fileitem->isLocalFile() );
+ TQString mimetype = m_fileitem->mimetype();
+ TQString lockingAction = TQString::null;
+ if (mimetype.contains("encrypted_locked")) {
+ lockingAction = "konqueror/servicemenus/media_unlock.desktop";
+ }
+ else if (mimetype.contains("encrypted_unlocked")) {
+ lockingAction = "konqueror/servicemenus/media_lock.desktop";
+ }
+ if (!lockingAction.isEmpty()) {
+ TQString lockingService = TDEGlobal::dirs()->findResource("data", lockingAction);
+ if (!lockingService.isEmpty()) {
+ TQValueList<KDEDesktopMimeType::Service> serviceList = KDEDesktopMimeType::userDefinedServices(lockingService, m_fileitem->isLocalFile());
+ if (serviceList.count() == 1) {
+ KURL::List m_lstURLs;
+ m_lstURLs.append(m_fileitem->url());
+ KDEDesktopMimeType::executeService(m_lstURLs, serviceList[0]);
+ }
+ }
+ }
+ else {
+ (void) new KRun( url, m_fileitem->mode(), m_fileitem->isLocalFile() );
+ }
}
else {
// When clicking on a link to e.g. $HOME from the desktop, we want to open $HOME