From c3f7fd525ecd46ad6aa6707e3d682ae5a07e928a Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Tue, 28 May 2013 21:10:50 +0200 Subject: [PATCH] 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. --- part.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/part.cpp b/part.cpp index 731ba5c52..272e5a2ce 100644 --- a/part.cpp +++ b/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(); }