mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-24 18:35:37 +00:00
port to the new kpart api:
- first use the mimetype from the OpenUrlArguments, or fallback on a manual mimetype detection - get rid of the manual discover of the mimetype using the signal from the file transfer job - this is done in the base readOnlyPart, now svn path=/branches/work/kparts_urlargs_split/kdegraphics/okular/; revision=698689
This commit is contained in:
parent
4e7fa038b4
commit
4fa5e016c6
27
part.cpp
27
part.cpp
|
@ -531,15 +531,9 @@ void Part::setMimeTypes(KIO::Job *job)
|
|||
{
|
||||
QStringList supportedMimeTypes = m_document->supportedMimeTypes();
|
||||
job->addMetaData("accept", 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::loadCancelled(const QString &reason)
|
||||
{
|
||||
emit setWindowCaption( QString() );
|
||||
|
@ -701,24 +695,13 @@ bool Part::slotImportPSFile()
|
|||
bool Part::openFile()
|
||||
{
|
||||
KMimeType::Ptr mime;
|
||||
if ( m_bExtension->urlArgs().serviceType.isEmpty() )
|
||||
if ( arguments().mimeType().isEmpty() )
|
||||
{
|
||||
if (!m_jobMime.isEmpty())
|
||||
{
|
||||
mime = KMimeType::mimeType(m_jobMime);
|
||||
if ( !mime )
|
||||
{
|
||||
mime = KMimeType::findByPath( localFilePath() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mime = KMimeType::findByPath( localFilePath() );
|
||||
}
|
||||
mime = KMimeType::mimeType( arguments().mimeType() );
|
||||
}
|
||||
else
|
||||
if ( !mime )
|
||||
{
|
||||
mime = KMimeType::mimeType( m_bExtension->urlArgs().serviceType );
|
||||
mime = KMimeType::findByPath( localFilePath() );
|
||||
}
|
||||
bool isCompressedFile = false;
|
||||
bool uncompressOk = true;
|
||||
|
@ -805,8 +788,6 @@ bool Part::openFile()
|
|||
|
||||
bool Part::openUrl(const KUrl &url)
|
||||
{
|
||||
m_jobMime.clear();
|
||||
|
||||
// this calls in sequence the 'closeUrl' and 'openFile' methods
|
||||
bool openOk = KParts::ReadOnlyPart::openUrl( url );
|
||||
|
||||
|
|
4
part.h
4
part.h
|
@ -148,7 +148,6 @@ class Part : public KParts::ReadOnlyPart, public Okular::DocumentObserver, publi
|
|||
void slotShowFindBar();
|
||||
void slotHideFindBar();
|
||||
void setMimeTypes(KIO::Job *job);
|
||||
void readMimeType(KIO::Job *job, const QString &mime);
|
||||
void loadCancelled(const QString &reason);
|
||||
void setWindowTitleFromDocument();
|
||||
// can be connected to widget elements
|
||||
|
@ -202,9 +201,6 @@ 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