include/svx/dialog/ThemeDialog.hxx | 1 + svx/source/dialog/ThemeDialog.cxx | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
New commits: commit b380a9068472bf9ee8a78aefdf72d1296bae6662 Author: Gülşah Köse <gulsah.k...@collabora.com> AuthorDate: Mon Jul 31 11:04:35 2023 +0300 Commit: Gülşah Köse <gulsah.k...@collabora.com> CommitDate: Thu Aug 10 11:44:35 2023 +0200 Prevent to open multiple Theme Color Edit dialog When we do super fast clicks to Add button prevent to open multiple dialog. Follow-up commit e73b2bc4e6fdaba3098fa2c701342e1df112514c Signed-off-by: Gülşah Köse <gulsah.k...@collabora.com> Change-Id: If40c4982b873d41984bea298284eae062742b057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155083 Tested-by: Jenkins (cherry picked from commit 5a683f2d7c59bbb9ad93172f8dcf43e9efa56053) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155477 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/include/svx/dialog/ThemeDialog.hxx b/include/svx/dialog/ThemeDialog.hxx index 020240c97ca3..7003fdebf168 100644 --- a/include/svx/dialog/ThemeDialog.hxx +++ b/include/svx/dialog/ThemeDialog.hxx @@ -30,6 +30,7 @@ class SVX_DLLPUBLIC ThemeDialog final : public weld::GenericDialogController private: weld::Window* mpWindow; model::Theme* mpTheme; + bool mxSubDialog; std::vector<model::ColorSet> maColorSets; std::unique_ptr<svx::ThemeColorValueSet> mxValueSetThemeColors; diff --git a/svx/source/dialog/ThemeDialog.cxx b/svx/source/dialog/ThemeDialog.cxx index ab743b0df4bd..99e7c3ad466e 100644 --- a/svx/source/dialog/ThemeDialog.cxx +++ b/svx/source/dialog/ThemeDialog.cxx @@ -22,6 +22,7 @@ ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme) : GenericDialogController(pParent, "svx/ui/themedialog.ui", "ThemeDialog") , mpWindow(pParent) , mpTheme(pTheme) + , mxSubDialog(false) , mxValueSetThemeColors(new svx::ThemeColorValueSet) , mxValueSetThemeColorsWindow( new weld::CustomWeld(*m_xBuilder, "valueset_theme_colors", *mxValueSetThemeColors)) @@ -85,12 +86,17 @@ IMPL_LINK_NOARG(ThemeDialog, SelectItem, ValueSet*, void) void ThemeDialog::runThemeColorEditDialog() { + if (mxSubDialog) + return; + auto pDialog = std::make_shared<svx::ThemeColorEditDialog>(mpWindow, *mpCurrentColorSet); std::shared_ptr<DialogController> xKeepAlive(shared_from_this()); - weld::DialogController::runAsync(pDialog, [this, xKeepAlive, pDialog](sal_uInt32 nResult) { + + mxSubDialog = weld::DialogController::runAsync(pDialog, [this, pDialog](sal_uInt32 nResult) { if (nResult != RET_OK) { mxAdd->set_sensitive(true); + mxSubDialog = false; return; } auto aColorSet = pDialog->getColorSet(); @@ -107,15 +113,16 @@ void ThemeDialog::runThemeColorEditDialog() = std::make_shared<model::ColorSet>(maColorSets[maColorSets.size() - 1]); } mxAdd->set_sensitive(true); + mxSubDialog = false; }); } IMPL_LINK(ThemeDialog, ButtonClicked, weld::Button&, rButton, void) { + mxAdd->set_sensitive(false); if (mpCurrentColorSet && mxAdd.get() == &rButton) { runThemeColorEditDialog(); - mxAdd->set_sensitive(false); } }