mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
Merge remote-tracking branch 'origin/Applications/18.08'
This commit is contained in:
commit
6a37055351
|
@ -4463,12 +4463,23 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
|
|||
QVector<KPluginMetaData> offers = DocumentPrivate::configurableGenerators();
|
||||
d->loadServiceList( offers );
|
||||
|
||||
bool pagesAdded = false;
|
||||
// We want the generators to be sorted by name so let's fill in a QMap
|
||||
// this sorts by internal id which is not awesome, but at least the sorting
|
||||
// is stable between runs that before it wasn't
|
||||
QMap<QString, GeneratorInfo> sortedGenerators;
|
||||
QHash< QString, GeneratorInfo >::iterator it = d->m_loadedGenerators.begin();
|
||||
QHash< QString, GeneratorInfo >::iterator itEnd = d->m_loadedGenerators.end();
|
||||
for ( ; it != itEnd; ++it )
|
||||
{
|
||||
Okular::ConfigInterface * iface = d->generatorConfig( it.value() );
|
||||
sortedGenerators.insert(it.key(), it.value());
|
||||
}
|
||||
|
||||
bool pagesAdded = false;
|
||||
QMap< QString, GeneratorInfo >::iterator sit = sortedGenerators.begin();
|
||||
QMap< QString, GeneratorInfo >::iterator sitEnd = sortedGenerators.end();
|
||||
for ( ; sit != sitEnd; ++sit )
|
||||
{
|
||||
Okular::ConfigInterface * iface = d->generatorConfig( sit.value() );
|
||||
if ( iface )
|
||||
{
|
||||
iface->addPages( dialog );
|
||||
|
|
|
@ -643,11 +643,30 @@ Okular::Document::OpenResult PDFGenerator::init(QVector<Okular::Page*> & pagesVe
|
|||
|
||||
PDFGenerator::SwapBackingFileResult PDFGenerator::swapBackingFile( QString const &newFileName, QVector<Okular::Page*> & newPagesVector )
|
||||
{
|
||||
const QBitArray oldRectsGenerated = rectsGenerated;
|
||||
|
||||
doCloseDocument();
|
||||
auto openResult = loadDocumentWithPassword(newFileName, newPagesVector, QString());
|
||||
if (openResult != Okular::Document::OpenSuccess)
|
||||
return SwapBackingFileError;
|
||||
|
||||
// Recreate links if needed since they are done on image() and image() is not called when swapping the file
|
||||
// since the page is already rendered
|
||||
if (oldRectsGenerated.count() == rectsGenerated.count()) {
|
||||
for (int i = 0; i < oldRectsGenerated.count(); ++i) {
|
||||
if (oldRectsGenerated[i]) {
|
||||
Okular::Page *page = newPagesVector[i];
|
||||
Poppler::Page *pp = pdfdoc->page( i );
|
||||
if (pp) {
|
||||
page->setObjectRects(generateLinks(pp->links()));
|
||||
rectsGenerated[i] = true;
|
||||
resolveMediaLinkReferences(page);
|
||||
delete pp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SwapBackingFileReloadInternalData;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue