summaryrefslogtreecommitdiffstats
path: root/libkonq
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2019-09-15 14:30:27 +0900
committerMichele Calgaro <[email protected]>2020-10-17 10:48:31 +0800
commitb75b318e1422ca73280b79b297b93e98c31d1a2a (patch)
tree0bc8ca81497265701634f4b5256bb95daf8f188b /libkonq
parent8f12bba779b41d43243bed43a0878dcac85fff44 (diff)
downloadtdebase-b75b318e1422ca73280b79b297b93e98c31d1a2a.tar.gz
tdebase-b75b318e1422ca73280b79b297b93e98c31d1a2a.zip
konqueror & kdesktop: default action for a media encrypted disk is
either lock or unlock based on the current locking status. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'libkonq')
-rw-r--r--libkonq/tdefileivi.cc25
1 files changed, 24 insertions, 1 deletions
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