Select current format on the configure backend dialog

Subscribers: sander, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D14820
This commit is contained in:
Albert Astals Cid 2018-10-08 22:53:51 +02:00
parent e44ff38706
commit a482c56ba2
3 changed files with 29 additions and 1 deletions

View file

@ -4457,6 +4457,11 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
if ( !dialog )
return;
// We know it's a BackendConfigDialog, but check anyway
BackendConfigDialog *bcd = dynamic_cast<BackendConfigDialog*>( dialog );
if ( !bcd )
return;
// ensure that we have all the generators with settings loaded
QVector<KPluginMetaData> offers = DocumentPrivate::configurableGenerators();
d->loadServiceList( offers );
@ -4482,6 +4487,13 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
{
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 )

View file

@ -22,6 +22,7 @@
#include <QMutex>
#include <QPointer>
#include <QUrl>
#include <KConfigDialog>
#include <KPluginMetaData>
// local includes
@ -64,6 +65,20 @@ struct GeneratorInfo
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

View file

@ -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 @@ void Part::setWindowTitleFromDocument()
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 )