Select current format on the configure backend dialog

Subscribers: sander, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D14820
remotes/origin/Applications/18.12
Albert Astals Cid 8 years ago
parent e44ff38706
commit a482c56ba2
  1. 12
      core/document.cpp
  2. 15
      core/document_p.h
  3. 3
      part.cpp

@ -4457,6 +4457,11 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
if ( !dialog ) if ( !dialog )
return; 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 // ensure that we have all the generators with settings loaded
QVector<KPluginMetaData> offers = DocumentPrivate::configurableGenerators(); QVector<KPluginMetaData> offers = DocumentPrivate::configurableGenerators();
d->loadServiceList( offers ); d->loadServiceList( offers );
@ -4482,6 +4487,13 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
{ {
iface->addPages( dialog ); iface->addPages( dialog );
pagesAdded = true; 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 ) if ( pagesAdded )

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

@ -112,6 +112,7 @@
#include "core/annotations.h" #include "core/annotations.h"
#include "core/bookmarkmanager.h" #include "core/bookmarkmanager.h"
#include "core/document.h" #include "core/document.h"
#include "core/document_p.h"
#include "core/generator.h" #include "core/generator.h"
#include "core/page.h" #include "core/page.h"
#include "core/fileprinter.h" #include "core/fileprinter.h"
@ -1166,7 +1167,7 @@ void Part::setWindowTitleFromDocument()
KConfigDialog * Part::slotGeneratorPreferences( ) KConfigDialog * Part::slotGeneratorPreferences( )
{ {
// Create dialog // 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 ); dialog->setAttribute( Qt::WA_DeleteOnClose );
if( m_embedMode == ViewerWidgetMode ) if( m_embedMode == ViewerWidgetMode )

Loading…
Cancel
Save