[Libreoffice-commits] core.git: include/svx sc/source svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 17 13:56:28 UTC 2020


 include/svx/srchdlg.hxx                |    7 +++++++
 sc/source/ui/dialogs/searchresults.cxx |    2 +-
 svx/source/dialog/srchdlg.cxx          |   17 +++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 9da14cf5461a1883718da9f92e03dd0dd6e28efd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jun 16 21:37:46 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jun 17 15:55:53 2020 +0200

    tdf#133807 re-present search dialog after a short timeout
    
    Change-Id: Icc6016b3a9e3f25fd4c9e065e9f2d9570ad040c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96524
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/srchdlg.hxx b/include/svx/srchdlg.hxx
index 6b45e838dcf9..8982e4d37a2b 100644
--- a/include/svx/srchdlg.hxx
+++ b/include/svx/srchdlg.hxx
@@ -25,6 +25,7 @@
 #include <svl/srchdefs.hxx>
 #include <svl/srchitem.hxx>
 #include <svx/svxdllapi.h>
+#include <vcl/timer.hxx>
 #include <memory>
 #include <vector>
 
@@ -132,8 +133,12 @@ public:
 
     void SetSearchLabel(const OUString& rStr);
 
+    // bring this window back to the foreground
+    void Present();
+
 private:
     SfxBindings&    rBindings;
+    Timer           m_aPresentIdle;
     bool            bWriter;
     bool            bSearch;
     bool            bFormat;
@@ -255,6 +260,8 @@ private:
     SVX_DLLPRIVATE bool IsOtherOptionsExpanded() const;
 
     SVX_DLLPRIVATE short executeSubDialog(VclAbstractDialog * dialog);
+
+    DECL_DLLPRIVATE_LINK(PresentTimeoutHdl_Impl, Timer*, void);
 };
 
 #endif
diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index b1b0e45aec5f..950726a18c4e 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -55,7 +55,7 @@ SearchResultsDlg::~SearchResultsDlg()
     SvxSearchDialog* pSearchDlg = static_cast<SvxSearchDialog*>(pChildWindow->GetController().get());
     if (!pSearchDlg)
         return;
-    pSearchDlg->getDialog()->present();
+    pSearchDlg->Present();
 }
 
 namespace
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index adab6f86b642..6653be858078 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -255,6 +255,7 @@ SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWi
     : SfxModelessDialogController(&rBind, pChildWin, pParent,
                                   "svx/ui/findreplacedialog.ui", "FindReplaceDialog")
     , rBindings(rBind)
+    , m_aPresentIdle("Bring SvxSearchDialog to Foreground")
     , bWriter(false)
     , bSearch(true)
     , bFormat(false)
@@ -312,6 +313,9 @@ SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWi
     , m_xAllSheetsCB(m_xBuilder->weld_check_button("allsheets"))
     , m_xCalcStrFT(m_xBuilder->weld_label("entirecells"))
 {
+    m_aPresentIdle.SetTimeout(50);
+    m_aPresentIdle.SetInvokeHandler(LINK(this, SvxSearchDialog, PresentTimeoutHdl_Impl));
+
     m_xSearchTmplLB->make_sorted();
     m_xSearchAttrText->hide();
     m_xSearchLabel->show();
@@ -338,6 +342,18 @@ SvxSearchDialog::SvxSearchDialog(weld::Window* pParent, SfxChildWindow* pChildWi
     Construct_Impl();
 }
 
+IMPL_LINK_NOARG(SvxSearchDialog, PresentTimeoutHdl_Impl, Timer*, void)
+{
+    getDialog()->present();
+}
+
+void SvxSearchDialog::Present()
+{
+    PresentTimeoutHdl_Impl(nullptr);
+    // tdf#133807 try again in a short timeout
+    m_aPresentIdle.Start();
+}
+
 void SvxSearchDialog::ChildWinDispose()
 {
     rBindings.EnterRegistrations();
@@ -350,6 +366,7 @@ void SvxSearchDialog::ChildWinDispose()
 
 SvxSearchDialog::~SvxSearchDialog()
 {
+    m_aPresentIdle.Stop();
 }
 
 void SvxSearchDialog::Construct_Impl()


More information about the Libreoffice-commits mailing list