Don't reuse KConfigDialogs

Because a cached dialog stays parented to the initial part, which might
not be the one used to open it.
This is especially visible now that we support more than one window per
okular process.

For example:
 - User initially opens a dialog from window A
      -> This dialog gets cached as child of A's PageView. This implies that
         clicking on the dialog also brings window A to foreground.
 - User re-opens the dialog from a different window B
      -> The dialog is still a child of A's PageView, therefore clicking on the
         dialog's frame brings A to the foreground, and B to the background.
remotes/origin/epub-qtextdoc
Fabio D'Urso 13 years ago
parent 84d7eae067
commit c3f7fd525e
  1. 19
      part.cpp

@ -1030,13 +1030,9 @@ void Part::setWindowTitleFromDocument()
void Part::slotGeneratorPreferences( )
{
// an instance the dialog could be already created and could be cached,
// in which case you want to display the cached dialog
if ( KConfigDialog::showDialog( "generator_prefs" ) )
return;
// we didn't find an instance of this dialog, so lets create it
// Create dialog
KConfigDialog * dialog = new KConfigDialog( m_pageView, "generator_prefs", Okular::Settings::self() );
dialog->setAttribute( Qt::WA_DeleteOnClose );
if( m_embedMode == ViewerWidgetMode )
{
@ -1049,6 +1045,7 @@ void Part::slotGeneratorPreferences( )
m_document->fillConfigDialog( dialog );
// Show it
dialog->setWindowModality( Qt::ApplicationModal );
dialog->show();
}
@ -2164,13 +2161,11 @@ void Part::slotGetNewStuff()
void Part::slotPreferences()
{
// an instance the dialog could be already created and could be cached,
// in which case you want to display the cached dialog
if ( PreferencesDialog::showDialog( "preferences" ) )
return;
// we didn't find an instance of this dialog, so lets create it
// Create dialog
PreferencesDialog * dialog = new PreferencesDialog( m_pageView, Okular::Settings::self(), m_embedMode );
dialog->setAttribute( Qt::WA_DeleteOnClose );
// Show it
dialog->show();
}

Loading…
Cancel
Save