From: vtn Date: Tue, 20 May 2014 13:25:36 +0000 (+0400) Subject: #2090: External 20694 Drive Guithare by a script, without opening it. SUIT_MessageBox... X-Git-Tag: CTH_1_10_a~9^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2cb9238b665c9b6c6d728b4a2db6500c5deb2eb8;p=modules%2Fgui.git #2090: External 20694 Drive Guithare by a script, without opening it. SUIT_MessageBox returns default button in batch mode. --- diff --git a/src/SUIT/SUIT_MessageBox.cxx b/src/SUIT/SUIT_MessageBox.cxx index 52f8874c0..110d72554 100755 --- a/src/SUIT/SUIT_MessageBox.cxx +++ b/src/SUIT/SUIT_MessageBox.cxx @@ -162,6 +162,8 @@ void SUIT_MessageBox::setButtonText( StandardButton btn, const QString& text ) SUIT_MessageBox::StandardButton SUIT_MessageBox::critical( QWidget* parent, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton ) { + if ( getenv( "SALOME_BATCH_MODE" ) ) + return defaultButton; SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); return QMessageBox::critical( parent, title, text, buttons, defaultButton ); } @@ -178,6 +180,8 @@ SUIT_MessageBox::StandardButton SUIT_MessageBox::critical( QWidget* parent, cons SUIT_MessageBox::StandardButton SUIT_MessageBox::warning( QWidget* parent, const QString& title, const QString& text, SUIT_MessageBox::StandardButtons buttons, StandardButton defaultButton ) { + if ( getenv( "SALOME_BATCH_MODE" ) ) + return defaultButton; SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); return QMessageBox::warning( parent, title, text, buttons, defaultButton ); } @@ -194,6 +198,8 @@ SUIT_MessageBox::StandardButton SUIT_MessageBox::warning( QWidget* parent, const SUIT_MessageBox::StandardButton SUIT_MessageBox::information( QWidget* parent, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton ) { + if ( getenv( "SALOME_BATCH_MODE" ) ) + return defaultButton; SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); return QMessageBox::information( parent, title, text, buttons, defaultButton ); } @@ -210,6 +216,8 @@ SUIT_MessageBox::StandardButton SUIT_MessageBox::information( QWidget* parent, c SUIT_MessageBox::StandardButton SUIT_MessageBox::question( QWidget* parent, const QString& title, const QString& text, StandardButtons buttons, StandardButton defaultButton ) { + if ( getenv( "SALOME_BATCH_MODE" ) ) + return defaultButton; SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::ArrowCursor ); return QMessageBox::question( parent, title, text, buttons, defaultButton ); } @@ -953,6 +961,9 @@ int SUIT_MessageBox::messageBox( Icon icon, QWidget* parent, const int defaultButton, const int escapeButton ) { + if ( getenv( "SALOME_BATCH_MODE" ) ) + return defaultButton; + SUIT_MessageBox msgBox( icon, title, text, NoButton, parent ); QMap bm;