Make alert dialogs modular, thus preventing that they are hidden behind the main window (bug 1977)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10717 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2006-01-09 10:28:05 +00:00
parent a0a923307c
commit c920d104ab
3 changed files with 21 additions and 3 deletions

View File

@ -10,6 +10,7 @@
#include <config.h> #include <config.h>
#include <qapplication.h>
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qlabel.h> #include <qlabel.h>
#include <qlineedit.h> #include <qlineedit.h>
@ -31,21 +32,30 @@ using std::make_pair;
void alert_pimpl(string const & s1, string const & s2, string const & s3) void alert_pimpl(string const & s1, string const & s2, string const & s3)
{ {
QMessageBox::warning(0, "LyX", QWidget * const parent = qApp->focusWidget() ?
qApp->focusWidget() : qApp->mainWidget();
QMessageBox::warning(parent, "LyX",
toqstr(s1 + '\n' + '\n' + s2 + '\n' + s3)); toqstr(s1 + '\n' + '\n' + s2 + '\n' + s3));
} }
bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3) bool askQuestion_pimpl(string const & s1, string const & s2, string const & s3)
{ {
return !(QMessageBox::information(0, "LyX", toqstr(s1 + '\n' + s2 + '\n' + s3), QWidget * const parent = qApp->focusWidget() ?
qApp->focusWidget() : qApp->mainWidget();
return !(QMessageBox::information(parent, "LyX", toqstr(s1 + '\n' + s2 + '\n' + s3),
qt_("&Yes"), qt_("&No"), 0, 1)); qt_("&Yes"), qt_("&No"), 0, 1));
} }
int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3) int askConfirmation_pimpl(string const & s1, string const & s2, string const & s3)
{ {
return (QMessageBox::information(0, "LyX", toqstr(s1 + '\n' + s2 + '\n' + s3), QWidget * const parent = qApp->focusWidget() ?
qApp->focusWidget() : qApp->mainWidget();
return (QMessageBox::information(parent, "LyX", toqstr(s1 + '\n' + s2 + '\n' + s3),
qt_("&Yes"), qt_("&No"), qt_("&Cancel"), 0, 2)) + 1; qt_("&Yes"), qt_("&No"), qt_("&Cancel"), 0, 2)) + 1;
} }

View File

@ -1,3 +1,8 @@
2006-01-09 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* Alert_pimpl.C: Make alert dialogs modular, thus preventing that
they are hidden behind the main window (bug 1977).
2006-01-08 Jürgen Spitzmüller <j.spitzmueller@gmx.de> 2006-01-08 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ui/QRefDialogBase.ui: re-connect the refsLB->Selected signal * ui/QRefDialogBase.ui: re-connect the refsLB->Selected signal

View File

@ -79,6 +79,9 @@ What's new
- Enable Instant Preview to work if the path to the external GhostScript - Enable Instant Preview to work if the path to the external GhostScript
executable contains spaces. (bug 2193). executable contains spaces. (bug 2193).
- The error/warning/confirmation dialogs aren't hidden behind the main
window anymore [Qt only] (bug 1977).
* Configuration/Installation: * Configuration/Installation:
- Enable TeXFiles.sh to run when its path contains spaces. - Enable TeXFiles.sh to run when its path contains spaces.