add jar, txz and lzma mimetype, this relates to issue #4

Signed-off-by: gregory guy <g-gregory@gmx.fr>
pull/6/head
gregory guy 6 years ago
parent 6d8cea2284
commit 1cc8bb41d3
No known key found for this signature in database
GPG Key ID: 6EFE0EF249A874C0

@ -708,16 +708,18 @@ void DolphinView::updateURL()
else if (fileItem->isFile()) { else if (fileItem->isFile()) {
// allow to browse through ZIP and tar files // allow to browse through ZIP and tar files
KMimeType::Ptr mime = fileItem->mimeTypePtr(); KMimeType::Ptr mime = fileItem->mimeTypePtr();
if (mime->is("application/x-zip")) { if( mime->is("application/x-zip") || mime->is("application/x-jar") ) {
KURL url = fileItem->url(); KURL url = fileItem->url();
url.setProtocol("zip"); url.setProtocol("zip");
setURL(url); setURL(url);
} }
else if (mime->is("application/x-tar") || else if( mime->is("application/x-tar") ||
mime->is("application/x-tarz") || mime->is("application/x-tarz") ||
mime->is("application/x-tbz") || mime->is("application/x-tbz") ||
mime->is("application/x-tgz") || mime->is("application/x-tgz") ||
mime->is("application/x-tzo")) { mime->is("application/x-tzo") ||
mime->is("application/x-txz") ||
mime->is("application/x-tlzma") ) {
KURL url = fileItem->url(); KURL url = fileItem->url();
url.setProtocol("tar"); url.setProtocol("tar");
setURL(url); setURL(url);

@ -119,15 +119,15 @@ void URLNavigator::setURL(const KURL& url)
if (url.protocol() == "zip") { if (url.protocol() == "zip") {
bool stillInside = false; bool stillInside = false;
if (KMimeType::findByPath(url.url(-1)) if( KMimeType::findByPath( url.url(-1) )->is("application/x-zip") ||
->is("application/x-zip")) { KMimeType::findByPath( url.url(-1) )->is("application/x-jar") ) {
stillInside = true; stillInside = true;
} }
else { else {
KURL url1 = url.upURL(); KURL url1 = url.upURL();
while (url1 != url1.upURL()) { while (url1 != url1.upURL()) {
if (KMimeType::findByPath(url1.url(-1)) if( KMimeType::findByPath( url1.url(-1) )->is("application/x-zip") ||
->is("application/x-zip")) { KMimeType::findByPath( url1.url(-1) )->is("application/x-jar") ) {
stillInside = true; stillInside = true;
break; break;
} }
@ -145,11 +145,13 @@ void URLNavigator::setURL(const KURL& url)
bool stillInside = false; bool stillInside = false;
KMimeType::Ptr kmp = KMimeType::Ptr kmp =
KMimeType::findByPath(url.url(-1)); KMimeType::findByPath(url.url(-1));
if (kmp->is("application/x-tar") || if( kmp->is("application/x-tar") ||
kmp->is("application/x-tarz") || kmp->is("application/x-tarz") ||
kmp->is("application/x-tbz") || kmp->is("application/x-tbz") ||
kmp->is("application/x-tgz") || kmp->is("application/x-tgz") ||
kmp->is("application/x-tzo") kmp->is("application/x-tzo") ||
kmp->is("application/x-txz") ||
kmp->is("application/x-tlzma")
) { ) {
stillInside = true; stillInside = true;
} }
@ -158,11 +160,13 @@ void URLNavigator::setURL(const KURL& url)
while (url1 != url1.upURL()) { while (url1 != url1.upURL()) {
KMimeType::Ptr kmp = KMimeType::Ptr kmp =
KMimeType::findByPath(url1.url(-1)); KMimeType::findByPath(url1.url(-1));
if (kmp->is("application/x-tar") || if( kmp->is("application/x-tar") ||
kmp->is("application/x-tarz") || kmp->is("application/x-tarz") ||
kmp->is("application/x-tbz") || kmp->is("application/x-tbz") ||
kmp->is("application/x-tgz") || kmp->is("application/x-tgz") ||
kmp->is("application/x-tzo") kmp->is("application/x-tzo") ||
kmp->is("application/x-txz") ||
kmp->is("application/x-tlzma")
) { ) {
stillInside = true; stillInside = true;
break; break;

Loading…
Cancel
Save