[Libreoffice-commits] core.git: basctl/source include/vcl vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 24 19:30:46 UTC 2018


 basctl/source/basicide/baside2.cxx |    8 ++++++++
 include/vcl/dialog.hxx             |    3 +++
 vcl/source/window/dialog.cxx       |    9 +++++++++
 3 files changed, 20 insertions(+)

New commits:
commit 389db2b45c138b8e62499024e31636ba365db676
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 24 14:18:02 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 24 21:30:17 2018 +0200

    Resolves: tdf#118572 ensure basic error dialog blocks any other dialog
    
    if a dialog is already running, disable input to it until this
    error dialog is acknowledged. The other dialog might be running
    from the script which has the error.
    
    Change-Id: I10c437a25bd7c91d37eeb8241bef10709767e499
    Reviewed-on: https://gerrit.libreoffice.org/59567
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 9741bdfeaeed..706c602eb124 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -622,7 +622,15 @@ bool ModulWindow::BasicErrorHdl( StarBASIC const * pBasic )
     // #i47002#
     Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this );
 
+    // tdf#118572 make a currently running dialog, regardless of what its modal
+    // to, insensitive to user input until after this error dialog goes away.
+    auto xDialog = Dialog::GetMostRecentExecutingDialog();
+    const bool bToggleEnableInput = xDialog && xDialog->IsInputEnabled();
+    if (bToggleEnableInput)
+        xDialog->EnableInput(false);
     ErrorHandler::HandleError(StarBASIC::GetErrorCode(), GetFrameWeld());
+    if (bToggleEnableInput)
+        xDialog->EnableInput(true);
 
     // #i47002#
     VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 43f45955a69f..440aacf479af 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -167,6 +167,9 @@ public:
     void            EndDialog( long nResult = 0 );
     static void     EndAllDialogs( vcl::Window const * pParent );
 
+    // returns the most recent of the currently executing modal dialogs
+    static VclPtr<Dialog> GetMostRecentExecutingDialog();
+
     void            GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
                                          sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
 
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index b7c1a3392a73..4403140df3f6 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1131,6 +1131,15 @@ void Dialog::EndAllDialogs( vcl::Window const * pParent )
     }
 }
 
+VclPtr<Dialog> Dialog::GetMostRecentExecutingDialog()
+{
+    ImplSVData* pSVData = ImplGetSVData();
+    auto& rExecuteDialogs = pSVData->maWinData.mpExecuteDialogs;
+    if (!rExecuteDialogs.empty())
+        return rExecuteDialogs.back();
+    return nullptr;
+}
+
 void Dialog::SetModalInputMode( bool bModal )
 {
     if ( bModal == mbModalMode )


More information about the Libreoffice-commits mailing list