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@redhat.com>
This commit is contained in:
Caolán McNamara 2020-06-16 21:37:46 +01:00
parent f9383f75af
commit 9da14cf546
3 changed files with 25 additions and 1 deletions

View file

@ -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

View file

@ -55,7 +55,7 @@ SearchResultsDlg::~SearchResultsDlg()
SvxSearchDialog* pSearchDlg = static_cast<SvxSearchDialog*>(pChildWindow->GetController().get());
if (!pSearchDlg)
return;
pSearchDlg->getDialog()->present();
pSearchDlg->Present();
}
namespace

View file

@ -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()