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 3f0b135bdcb8e0eb25cbf532d117729a1519ed97
Author:     Pranav Kant <pran...@collabora.co.uk>
AuthorDate: Wed Feb 21 15:21:43 2018 +0530
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Wed Jul 18 17:37:19 2018 +0200

    lokdialog: Convert InfoReadonlyDialog -> execute async
    
    Change-Id: I3f2e7fb676911570276f66d000c91ca3ef2bdeb0
    Reviewed-on: https://gerrit.libreoffice.org/50096
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>
    (cherry picked from commit c565a1a36dc6e75744df284edbb36ffd09edc42b)
    Reviewed-on: https://gerrit.libreoffice.org/57651

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index c6bc49157b28..8d5554a5cbdb 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 0ba15407ae08..dff20e7d7e2f 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -146,8 +146,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 d973704f8802..ed9762c509f8 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -629,6 +629,7 @@ private:
     void setButtonHandlers(VclButtonBox const *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);
@@ -640,6 +641,11 @@ public:
         VclButtonsType eButtonsType = VclButtonsType::Ok);
     MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& 
rUIXMLDescription);
     virtual bool set_property(const OString &rKey, const OUString &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 bfc5c3dc8585..29177bfaebff 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2471,8 +2471,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 = SwKeyState::End;
             }
         break;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 63728f65e0b2..7c05e3d230bb 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2302,7 +2302,7 @@ void MessageDialog::SetMessagesWidths(vcl::Window const 
*pParent,
         
pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 
60);
 }
 
-short MessageDialog::Execute()
+void MessageDialog::InitExecute()
 {
     setDeferredProperties();
 
@@ -2428,6 +2428,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();
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to