diff options
| author | David Faure <[email protected]> | 2008-03-25 21:39:05 +0000 |
|---|---|---|
| committer | David Faure <[email protected]> | 2008-03-25 21:39:05 +0000 |
| commit | 6d425dcc662dceed364dbb336522779ec16f233f (patch) | |
| tree | f6d0a2a61dd7e6084aa0e954bc32a678642ac037 /src/dolphinviewcontainer.cpp | |
| parent | b7049db594e8ca8774aad93a6407ad5594d038a0 (diff) | |
Use new key in .protocol files, archiveMimetype, to know which kioslave can handle which type of archive in a generic way.
Used that in dolphin and in konqueror (and in the filetypes config module, to show the right default value for those mimetypes).
This way Urs can extend this mechanism with the p7zip kioslave in the future.
CCMAIL: [email protected], [email protected]
svn path=/trunk/KDE/kdebase/apps/; revision=790102
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 237aa19f5..6fcdb7dec 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -18,6 +18,7 @@ ***************************************************************************/ #include "dolphinviewcontainer.h" +#include <kprotocolmanager.h> #include <QtGui/QApplication> #include <QtGui/QClipboard> @@ -400,25 +401,16 @@ void DolphinViewContainer::slotItemTriggered(const KFileItem& item) } const GeneralSettings* settings = DolphinSettings::instance().generalSettings(); - const bool browseThroughArchives = settings->browseThroughArchives() && - item.isFile() && url.isLocalFile(); - if (browseThroughArchives) { - KMimeType::Ptr mime = item.mimeTypePtr(); - - // Don't use mime->is("application/zip"), as this would - // also browse through Open Office files: - if (mime->name() == "application/zip") { - url.setProtocol("zip"); - m_view->setUrl(url); - return; - } - - if (mime->is("application/x-tar") || - mime->is("application/x-tarz") || - mime->is("application/x-bzip-compressed-tar") || - mime->is("application/x-compressed-tar") || - mime->is("application/x-tzo")) { - url.setProtocol("tar"); + const bool browseThroughArchives = settings->browseThroughArchives(); + if (browseThroughArchives && item.isFile() && url.isLocalFile()) { + // Generic mechanism for redirecting to tar:/<path>/ when clicking on a tar file, + // zip:/<path>/ when clicking on a zip file, etc. + // The .protocol file specifies the mimetype that the kioslave handles. + // Note that we don't use mimetype inheritance since we don't want to + // open OpenDocument files as zip folders... + const QString protocol = KProtocolManager::protocolForArchiveMimetype(item.mimetype()); + if (!protocol.isEmpty()) { + url.setProtocol(protocol); m_view->setUrl(url); return; } |
