mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-03 22:54:31 +00:00
Fix 140482 for okular too
svn path=/trunk/playground/graphics/okular/; revision=627479
This commit is contained in:
parent
6541b015e4
commit
1963e95fe6
21
part.cpp
21
part.cpp
|
@ -12,7 +12,7 @@
|
|||
* Copyright (C) 2004 by Christoph Cullmann <crossfire@babylon2k.de> *
|
||||
* Copyright (C) 2004 by Henrique Pinto <stampede@coltec.ufmg.br> *
|
||||
* Copyright (C) 2004 by Waldo Bastian <bastian@kde.org> *
|
||||
* Copyright (C) 2004-2006 by Albert Astals Cid <tsdgeos@terra.es> *
|
||||
* Copyright (C) 2004-2007 by Albert Astals Cid <aacid@kde.org> *
|
||||
* Copyright (C) 2004 by Antti Markus <antti.markus@starman.ee> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
@ -501,9 +501,14 @@ void Part::setMimeTypes(KIO::Job *job)
|
|||
if (m_supportedMimeTypes.count() <= 0)
|
||||
supportedMimetypes();
|
||||
job->addMetaData("accept", m_supportedMimeTypes.join(", ") + ", */*;q=0.5");
|
||||
connect(job, SIGNAL(mimetype(KIO::Job*,const QString&)), this, SLOT(readMimeType(KIO::Job*,const QString&)));
|
||||
}
|
||||
}
|
||||
|
||||
void Part::readMimeType(KIO::Job *, const QString &mime)
|
||||
{
|
||||
m_jobMime = mime;
|
||||
}
|
||||
|
||||
void Part::fillGenerators()
|
||||
{
|
||||
|
@ -690,7 +695,18 @@ bool Part::openFile()
|
|||
KMimeType::Ptr mime;
|
||||
if ( m_bExtension->urlArgs().serviceType.isEmpty() )
|
||||
{
|
||||
mime = KMimeType::findByPath( m_file );
|
||||
if (!m_jobMime.isEmpty())
|
||||
{
|
||||
mime = KMimeType::mimeType(m_jobMime);
|
||||
if ( !mime )
|
||||
{
|
||||
mime = KMimeType::findByPath( m_file );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mime = KMimeType::findByPath( m_file );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -775,6 +791,7 @@ bool Part::openUrl(const KUrl &url)
|
|||
// if it matches then: download it (if not local) extract to a temp file using
|
||||
// KTar and proceed with the URL of the temporary file
|
||||
|
||||
m_jobMime.clear();
|
||||
const QString path = url.path();
|
||||
const KMimeType::Ptr mimetype = KMimeType::findByPath( path );
|
||||
bool isCompressedFile = false;
|
||||
|
|
6
part.h
6
part.h
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 2003 by Andy Goossens <andygoossens@telenet.be> *
|
||||
* Copyright (C) 2003 by Laurent Montel <montel@kde.org> *
|
||||
* Copyright (C) 2004 by Dominique Devriese <devriese@kde.org> *
|
||||
* Copyright (C) 2004-2006 by Albert Astals Cid <tsdgeos@terra.es> *
|
||||
* Copyright (C) 2004-2007 by Albert Astals Cid <aacid@kde.org> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
@ -140,6 +140,7 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
|
|||
void cannotQuit();
|
||||
void splitterMoved( int pos, int index );
|
||||
void setMimeTypes(KIO::Job *job);
|
||||
void readMimeType(KIO::Job *job, const QString &mime);
|
||||
void saveSplitterSize();
|
||||
// can be connected to widget elements
|
||||
void updateViewActions();
|
||||
|
@ -188,6 +189,9 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
|
|||
// Remember the search history
|
||||
QStringList m_searchHistory;
|
||||
|
||||
// mimetype got from the job
|
||||
QString m_jobMime;
|
||||
|
||||
// actions
|
||||
QAction *m_gotoPage;
|
||||
QAction *m_prevPage;
|
||||
|
|
Loading…
Reference in a new issue