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

Caolán McNamara caolanm at redhat.com
Fri Nov 3 21:06:25 UTC 2017


 framework/source/dispatch/closedispatcher.cxx |    9 -------
 framework/source/loadenv/loadenv.cxx          |    4 ---
 include/vcl/dialog.hxx                        |    8 +-----
 include/vcl/msgbox.hxx                        |    5 +--
 include/vcl/svapp.hxx                         |    6 ----
 uui/source/iahndl.cxx                         |   33 +++-----------------------
 vcl/source/app/svapp.cxx                      |   16 ------------
 vcl/source/window/dialog.cxx                  |   10 -------
 vcl/source/window/msgbox.cxx                  |    6 ++--
 9 files changed, 12 insertions(+), 85 deletions(-)

New commits:
commit fdcd11ff68fcd9e46aad6efc20779a063f4f6182
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 2 17:23:00 2017 +0000

    Resolves: tdf#113160 changing all warning dialogs to non-modal is unsafe
    
    existing code doesn't expect that so stuff crashes
    
    partial revert of...
    
    commit db6b703d391838c481fd090065f6d329edcd4efa
    Date:   Thu Aug 24 18:32:38 2017 +0200
    
        Allow non-modal Dialogs during FileImport/Load
    
    Change-Id: I152feb849186cf035664a700d3f94ee049cdf6d3
    Reviewed-on: https://gerrit.libreoffice.org/44227
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index 2055cdc5d517..70d40f58f1cc 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -38,7 +38,6 @@
 #include <vcl/window.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/syswin.hxx>
-#include <vcl/dialog.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <comphelper/processfactory.hxx>
 
@@ -367,14 +366,6 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void)
         }
     }
 
-    // if we still have dialogs open, temporary suppress termination
-    if (bTerminateApp && Dialog::AreDialogsOpen())
-    {
-        Application::SetShutdownDelayed();
-        bCloseFrame = true;
-        bTerminateApp = false;
-    }
-
     // Do it now ...
     bool bSuccess = false;
     if (bCloseFrame)
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 3d6da4e3e003..3bfd87e3244c 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -371,10 +371,6 @@ void LoadEnv::startLoading()
     if (!bStarted)
         bStarted = impl_loadContent();
 
-    // This may have triggered Dialogs (error cases) that may have
-    // delayed the shutdown, so give delayed shutdown a chance
-    Application::TriggerShutdownDelayed();
-
     // not started => general error
     // We can't say - what was the reason for.
     if (!bStarted)
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index d7d7ce292cf6..d28ff0ac6d64 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -39,11 +39,8 @@ public:
         /** Use given parent or get a default one using GetDefaultParent(...) */
         Default,
 
-        /** Suppress Parent so that Parent is not blocked (kind of modal mode) */
-        NoParent,
-
-        /** Suppress Parent (no modal, see above) and additionally center on default parent */
-        NoParentCentered
+        /** No Parent */
+        NoParent
     };
 
 private:
@@ -168,7 +165,6 @@ public:
 
     void            EndDialog( long nResult = 0 );
     static void     EndAllDialogs( vcl::Window const * pParent );
-    static bool     AreDialogsOpen();
 
     void            GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
                                          sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 7c377170566c..18b869318b90 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -69,9 +69,8 @@ protected:
     SAL_DLLPRIVATE void ImplPosControls();
 
 public:
-                        MessBox( vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n,
-                            const OUString& rTitle, const OUString& rMessage,
-                            Dialog::InitFlag eInitFlag = Dialog::InitFlag::NoParentCentered);
+                        MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n,
+                                const OUString& rTitle, const OUString& rMessage);
     virtual             ~MessBox() override;
     virtual void        dispose() override;
 
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index e895dde09a7d..dd10349a41b2 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1384,12 +1384,6 @@ public:
     // For vclbootstrapprotector:
     static void setDeInitHook(Link<LinkParamNone*,void> const & hook);
 
-    // for delayed shutdown: set using SetShutdownDelayed, then
-    // trigger using TriggerShutdownDelayed which may actually shutdown
-    // when SetShutdownDelayed is set
-    static void SetShutdownDelayed();
-    static void TriggerShutdownDelayed();
-
 private:
     DECL_STATIC_LINK( Application, PostEventHandler, void*, void );
 };
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index d53d01a513ba..27a10becaf88 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -959,35 +959,12 @@ executeMessageBox(
     vcl::Window * pParent,
     OUString const & rTitle,
     OUString const & rMessage,
-    MessBoxStyle nButtonMask,
-    Dialog::InitFlag eInitFlag)
+    MessBoxStyle nButtonMask)
 {
     SolarMutexGuard aGuard;
     WinBits nStyle(0);
 
-    ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, nStyle, rTitle, rMessage, eInitFlag);
-
-    if (Dialog::InitFlag::NoParentCentered == eInitFlag)
-    {
-        vcl::Window* pDefaultParent = Dialog::GetDefaultParent(nStyle);
-
-        if (pDefaultParent)
-        {
-            // need to 'Show' to have the following tasks do something, does
-            // not work without and may even stumble on nullptrs/errors
-            xBox->Show();
-
-            // center on parent window
-            const Point aP(pDefaultParent->GetPosPixel());
-            const Size aS(pDefaultParent->GetSizePixel());
-            const Size aMySize(xBox->GetSizePixel());
-
-            xBox->SetPosPixel(
-                Point(
-                    aP.X() + ((aS.Width() - aMySize.Width()) >> 1),
-                    aP.Y() + ((aS.Height() - aMySize.Height()) >> 1)));
-        }
-    }
+    ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, nStyle, rTitle, rMessage);
 
     sal_uInt16 aMessResult = xBox->Execute();
     DialogMask aResult = DialogMask::NONE;
@@ -1131,8 +1108,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
                 aTitle += " - " ;
             aTitle += aErrTitle;
 
-            executeMessageBox(
-                getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok, Dialog::InitFlag::NoParentCentered);
+            executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok);
         }
         else
             ErrorHandler::HandleError(nErrorCode);
@@ -1247,8 +1223,7 @@ UUIInteractionHelper::handleBrokenPackageRequest(
         " " +
         utl::ConfigManager::getProductVersion() );
 
-    switch (
-        executeMessageBox( getParentProperty(), title, aMessage, nButtonMask, Dialog::InitFlag::NoParentCentered) )
+    switch (executeMessageBox(getParentProperty(), title, aMessage, nButtonMask))
     {
     case DialogMask::ButtonsOk:
         OSL_ENSURE( xAbort.is(), "unexpected situation" );
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index ad5beddb1c83..351a5bfa2f77 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1642,20 +1642,4 @@ void Application::setDeInitHook(Link<LinkParamNone*,void> const & hook) {
     pSVData->maAppData.mbInAppMain = true;
 }
 
-void Application::SetShutdownDelayed()
-{
-    ImplSVData * pSVData = ImplGetSVData();
-    pSVData->maAppData.mbShutdownDelayed = true;
-}
-
-void Application::TriggerShutdownDelayed()
-{
-    ImplSVData * pSVData = ImplGetSVData();
-
-    if (pSVData->maAppData.mbShutdownDelayed && !Dialog::AreDialogsOpen())
-    {
-        Application::PostUserEvent(LINK(nullptr, ImplSVAppData, ImplPrepareExitMsg));
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 43e3ff7362ff..9be733fbb4d0 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -412,7 +412,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
     // Now, all Dialogs are per default system windows !!!
     nStyle |= WB_SYSTEMWINDOW;
 
-    if (InitFlag::NoParent == eFlag || InitFlag::NoParentCentered == eFlag)
+    if (InitFlag::NoParent == eFlag)
     {
         pParent = nullptr;
     }
@@ -1179,14 +1179,6 @@ void Dialog::EndAllDialogs( vcl::Window const * pParent )
     }
 }
 
-bool Dialog::AreDialogsOpen()
-{
-    ImplSVData* pSVData = ImplGetSVData();
-    Dialog* pModDialog = pSVData->maWinData.mpLastExecuteDlg;
-
-    return (nullptr != pModDialog);
-}
-
 void Dialog::SetModalInputMode( bool bModal )
 {
     if ( bModal == mbModalMode )
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 8b9f4b515130..67b3edf1df37 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -122,15 +122,15 @@ void MessBox::ImplInitButtons()
     }
 }
 
-MessBox::MessBox( vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits nWinBits,
-                  const OUString& rTitle, const OUString& rMessage, Dialog::InitFlag eInitFlag) :
+MessBox::MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits nWinBits,
+                 const OUString& rTitle, const OUString& rMessage) :
     ButtonDialog( WindowType::MESSBOX ),
     mbHelpBtn( false ),
     mbCheck( false ),
     mnMessBoxStyle( nMessBoxStyle ),
     maMessText( rMessage )
 {
-    ImplInit( pParent, nWinBits | WB_MOVEABLE | WB_HORZ | WB_CENTER, eInitFlag);
+    ImplInit(pParent, nWinBits | WB_MOVEABLE | WB_HORZ | WB_CENTER);
     ImplInitButtons();
 
     if ( !rTitle.isEmpty() )


More information about the Libreoffice-commits mailing list