[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/sfx2 include/vcl sw/source vcl/source

Pranav Kant pranavk at collabora.co.uk
Wed Feb 21 16:01:37 UTC 2018


 include/sfx2/tabdlg.hxx           |    2 ++
 include/vcl/dialog.hxx            |    4 ++--
 include/vcl/layout.hxx            |    6 ++++++
 sw/source/uibase/docvw/edtwin.cxx |    5 +++--
 vcl/source/window/layout.cxx      |   13 ++++++++++++-
 5 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit c565a1a36dc6e75744df284edbb36ffd09edc42b
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Feb 21 15:21:43 2018 +0530

    lokdialog: Convert InfoReadonlyDialog -> execute async
    
    Change-Id: I3f2e7fb676911570276f66d000c91ca3ef2bdeb0
    Reviewed-on: https://gerrit.libreoffice.org/50096
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index a758d4544291..d771dc32da6d 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -190,6 +190,8 @@ public:
 
     short               Execute() override;
     void                StartExecuteModal( const Link<Dialog&,void>& rEndDialogHdl ) override;
+
+    using               Dialog::StartExecuteAsync;
     bool                StartExecuteAsync( VclAbstractDialog::AsyncContext &rCtx ) override;
     void                Start();
 
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 92bf603400f6..f028b7cb57c9 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -129,8 +129,8 @@ private:
 public:
 
     // FIXME: Need to remove old StartExecuteModal in favour of this one.
-    /// Returns true of the dialog successfully starts
-    bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
+    /// Returns true if the dialog successfully starts
+    virtual bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
     {
         VclAbstractDialog::AsyncContext aCtx;
         aCtx.mxOwner = this;
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 59a0817d70c6..b8df9a3ee877 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -657,6 +657,7 @@ private:
     void setButtonHandlers(VclButtonBox *pButtonBox);
     short get_response(const vcl::Window *pWindow) const;
     void create_owned_areas();
+    void InitExecute();
 
     friend class VclPtr<MessageDialog>;
     MessageDialog(vcl::Window* pParent, WinBits nStyle);
@@ -668,6 +669,11 @@ public:
         VclButtonsType eButtonsType = VCL_BUTTONS_OK);
     MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription);
     virtual bool set_property(const OString &rKey, const OString &rValue) override;
+
+    // Avoid -Woverloaded-virtual
+    using Dialog::StartExecuteAsync;
+    virtual bool StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn) override;
+
     virtual short Execute() override;
     ///Emitted when an action widget is clicked
     virtual void response(short nResponseId);
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 024c3aabfc88..f45ce68a9024 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2498,8 +2498,9 @@ KEYINPUT_CHECKTABLE_INSDEL:
             }
             else
             {
-                ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog",
-                    "modules/swriter/ui/inforeadonlydialog.ui")->Execute();
+                VclPtr<MessageDialog> pDlg = VclPtr<MessageDialog>::Create(this, "InfoReadonlyDialog",
+                                                                           "modules/swriter/ui/inforeadonlydialog.ui");
+                pDlg->StartExecuteAsync([=](int){});
                 eKeyState = KS_End;
             }
         break;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index a0e0002c57be..d7c584bcefc1 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2310,7 +2310,7 @@ void MessageDialog::SetMessagesWidths(vcl::Window *pParent,
         pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 60);
 }
 
-short MessageDialog::Execute()
+void MessageDialog::InitExecute()
 {
     setDeferredProperties();
 
@@ -2436,6 +2436,17 @@ short MessageDialog::Execute()
         pButtonBox->sort_native_button_order();
         m_pGrid->Show();
     }
+}
+
+bool MessageDialog::StartExecuteAsync(const std::function<void(sal_Int32)> &rEndDialogFn)
+{
+    InitExecute();
+    return Dialog::StartExecuteAsync(rEndDialogFn);
+}
+
+short MessageDialog::Execute()
+{
+    InitExecute();
     return Dialog::Execute();
 }
 


More information about the Libreoffice-commits mailing list