From b7150ccccfa1f71f221b547368834f356c3d76d6 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 9 May 2012 05:10:26 +0000 Subject: [PATCH] 2012-05-08 20:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/hbqt_errorsys.prg * Guarded: against possible recursive error handler calls with hbqt_isActiveApplication(). * contrib/hbqt/qtgui/hbqt_init.cpp + Added: HB_FUNC( HBQT_ISACTIVEAPPLICATION ). ; NOTE: there may be a better solution, I know, but... --- harbour/ChangeLog | 9 +++++++ harbour/contrib/hbqt/qtgui/hbqt_errorsys.prg | 28 +++++++++++--------- harbour/contrib/hbqt/qtgui/hbqt_init.cpp | 6 +++++ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fe34532cd3..68b0ba5d45 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-08 20:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/hbqt_errorsys.prg + * Guarded: against possible recursive error handler calls + with hbqt_isActiveApplication(). + * contrib/hbqt/qtgui/hbqt_init.cpp + + Added: HB_FUNC( HBQT_ISACTIVEAPPLICATION ). + + ; NOTE: there may be a better solution, I know, but... + 2012-05-08 16:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtwebkit/qth/QWebFrame.qth * contrib/hbqt/qtwebkit/qth/QWebHistoryItem.qth diff --git a/harbour/contrib/hbqt/qtgui/hbqt_errorsys.prg b/harbour/contrib/hbqt/qtgui/hbqt_errorsys.prg index f399b49f55..aeec11be5a 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_errorsys.prg +++ b/harbour/contrib/hbqt/qtgui/hbqt_errorsys.prg @@ -206,19 +206,23 @@ STATIC FUNCTION ErrorMessage( oError ) STATIC FUNCTION hbqt_messageBox( cMsg, cInfo, cTitle, nIcon ) LOCAL oMB - DEFAULT cTitle TO "Information" - DEFAULT nIcon TO QMessageBox_Information - - oMB := QMessageBox() - oMB:setText( cMsg ) - IF !empty( cInfo ) - oMB:setInformativeText( cInfo ) - ENDIF - oMB:setIcon( nIcon ) - oMB:setWindowTitle( cTitle ) - - oMB:exec() + IF hbqt_IsActiveApplication() + + DEFAULT cTitle TO "Information" + DEFAULT nIcon TO QMessageBox_Information + oMB := QMessageBox() + oMB:setText( cMsg ) + IF !empty( cInfo ) + oMB:setInformativeText( cInfo ) + ENDIF + oMB:setIcon( nIcon ) + oMB:setWindowTitle( cTitle ) + + oMB:exec() + + ENDIF + RETURN nil /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp index 269266368e..1f42e7ae5a 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp @@ -607,6 +607,7 @@ static void hbqt_registerCallbacks( void ) /*----------------------------------------------------------------------*/ static QApplication * s_app = NULL; +static bool isQuitting = false; HB_FUNC_EXTERN( __HBQTCORE ); @@ -652,8 +653,13 @@ static void hbqt_lib_init( void * cargo ) static void hbqt_lib_exit( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); + isQuitting = true; } +HB_FUNC( HBQT_ISACTIVEAPPLICATION ) +{ + hb_retl( ! isQuitting ); +} HB_CALL_ON_STARTUP_BEGIN( _hbqtgui_init_ ) hb_vmAtInit( hbqt_lib_init, NULL );