diff --git a/core/document.cpp b/core/document.cpp --- a/core/document.cpp +++ b/core/document.cpp @@ -4457,6 +4457,11 @@ if ( !dialog ) return; + // We know it's a BackendConfigDialog, but check anyway + BackendConfigDialog *bcd = dynamic_cast( dialog ); + if ( !bcd ) + return; + // ensure that we have all the generators with settings loaded QVector offers = DocumentPrivate::configurableGenerators(); d->loadServiceList( offers ); @@ -4482,6 +4487,13 @@ { iface->addPages( dialog ); pagesAdded = true; + + if ( sit.value().generator == d->m_generator ) + { + const int rowCount = bcd->thePageWidget()->model()->rowCount(); + KPageView *view = bcd->thePageWidget(); + view->setCurrentPage( view->model()->index( rowCount - 1, 0 ) ); + } } } if ( pagesAdded ) diff --git a/core/document_p.h b/core/document_p.h --- a/core/document_p.h +++ b/core/document_p.h @@ -22,6 +22,7 @@ #include #include #include +#include #include // local includes @@ -64,6 +65,20 @@ namespace Okular { +class BackendConfigDialog : public KConfigDialog +{ +public: + BackendConfigDialog(QWidget *parent, const QString &name, KCoreConfigSkeleton *config) + : KConfigDialog(parent, name, config) + { + } + + KPageWidget *thePageWidget() + { + return pageWidget(); + } +}; + class FontExtractionThread; struct DoContinueDirectionMatchSearchStruct diff --git a/part.cpp b/part.cpp --- a/part.cpp +++ b/part.cpp @@ -112,6 +112,7 @@ #include "core/annotations.h" #include "core/bookmarkmanager.h" #include "core/document.h" +#include "core/document_p.h" #include "core/generator.h" #include "core/page.h" #include "core/fileprinter.h" @@ -1166,7 +1167,7 @@ KConfigDialog * Part::slotGeneratorPreferences( ) { // Create dialog - KConfigDialog * dialog = new KConfigDialog( m_pageView, QStringLiteral("generator_prefs"), Okular::Settings::self() ); + KConfigDialog * dialog = new Okular::BackendConfigDialog( m_pageView, QStringLiteral("generator_prefs"), Okular::Settings::self() ); dialog->setAttribute( Qt::WA_DeleteOnClose ); if( m_embedMode == ViewerWidgetMode )