Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
John Zhang
Okular
Commits
be0023b0
Commit
be0023b0
authored
Jul 25, 2007
by
Pino Toscano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recognize correctly the compressed mimetypes for pdf, ps and dvi
svn path=/trunk/KDE/kdegraphics/okular/; revision=692295
parent
ec4827fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
part.cpp
part.cpp
+26
-5
No files found.
part.cpp
View file @
be0023b0
...
...
@@ -764,6 +764,28 @@ bool Part::openFile()
return
true
;
}
static
QString
compressedMimeFor
(
const
QString
&
mime_to_check
)
{
static
QHash
<
QString
,
QString
>
compressedMimeMap
;
if
(
compressedMimeMap
.
isEmpty
()
)
{
compressedMimeMap
[
QString
::
fromLatin1
(
"application/x-gzip"
)
]
=
QString
::
fromLatin1
(
"application/x-gzip"
);
compressedMimeMap
[
QString
::
fromLatin1
(
"application/x-bzip"
)
]
=
QString
::
fromLatin1
(
"application/x-bzip"
);
compressedMimeMap
[
QString
::
fromLatin1
(
"application/x-bzpdf"
)
]
=
QString
::
fromLatin1
(
"application/x-bzip"
);
compressedMimeMap
[
QString
::
fromLatin1
(
"application/x-bzpostscript"
)
]
=
QString
::
fromLatin1
(
"application/x-bzip"
);
compressedMimeMap
[
QString
::
fromLatin1
(
"application/x-bzdvi"
)
]
=
QString
::
fromLatin1
(
"application/x-bzip"
);
}
QHash
<
QString
,
QString
>::
const_iterator
it
=
compressedMimeMap
.
find
(
mime_to_check
);
if
(
it
!=
compressedMimeMap
.
end
()
)
return
it
.
value
();
return
QString
();
}
bool
Part
::
openUrl
(
const
KUrl
&
url
)
{
...
...
@@ -776,11 +798,10 @@ bool Part::openUrl(const KUrl &url)
const
KMimeType
::
Ptr
mimetype
=
KMimeType
::
findByPath
(
path
);
bool
isCompressedFile
=
false
;
KUrl
tempUrl
;
if
((
mimetype
->
name
()
==
"application/x-gzip"
)
||
(
mimetype
->
name
()
==
"application/x-bzip"
)
||
(
mimetype
->
parentMimeType
()
==
"application/x-gzip"
)
||
(
mimetype
->
parentMimeType
()
==
"application/x-bzip"
)
)
QString
compressedMime
=
compressedMimeFor
(
mimetype
->
name
()
);
if
(
compressedMime
.
isEmpty
()
)
compressedMime
=
compressedMimeFor
(
mimetype
->
parentMimeType
()
);
if
(
!
compressedMime
.
isEmpty
()
)
{
isCompressedFile
=
handleCompressed
(
tempUrl
,
path
,
mimetype
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment