Commit 4fc20307 authored by Albert Astals Cid's avatar Albert Astals Cid

Code simplification

No need to use d->m_loadedGenerators to find the generator since we already have m_generator
parent 22662af2
......@@ -4331,24 +4331,16 @@ bool Document::canSwapBackingFile() const
{
if ( !d->m_generator )
return false;
Q_ASSERT( !d->m_generatorName.isEmpty() );
QHash< QString, GeneratorInfo >::iterator genIt = d->m_loadedGenerators.find( d->m_generatorName );
Q_ASSERT( genIt != d->m_loadedGenerators.end() );
return genIt->generator->hasFeature( Generator::SwapBackingFile );
return d->m_generator->hasFeature( Generator::SwapBackingFile );
}
bool Document::swapBackingFile( const QString &newFileName, const QUrl &url )
{
if ( !d->m_generator )
return false;
Q_ASSERT( !d->m_generatorName.isEmpty() );
QHash< QString, GeneratorInfo >::iterator genIt = d->m_loadedGenerators.find( d->m_generatorName );
Q_ASSERT( genIt != d->m_loadedGenerators.end() );
if ( !genIt->generator->hasFeature( Generator::SwapBackingFile ) )
if ( !d->m_generator->hasFeature( Generator::SwapBackingFile ) )
return false;
// Save metadata about the file we're about to close
......@@ -4356,7 +4348,7 @@ bool Document::swapBackingFile( const QString &newFileName, const QUrl &url )
qCDebug(OkularCoreDebug) << "Swapping backing file to" << newFileName;
QVector< Page * > newPagesVector;
Generator::SwapBackingFileResult result = genIt->generator->swapBackingFile( newFileName, newPagesVector );
Generator::SwapBackingFileResult result = d->m_generator->swapBackingFile( newFileName, newPagesVector );
if (result != Generator::SwapBackingFileError)
{
QLinkedList< ObjectRect* > rectsToDelete;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment