From 8843081f91e206b4749b83b186caaceaf1f8c4e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 23 Aug 2024 21:36:59 +0100 Subject: [PATCH] Resolves: tdf#162597 'ok' in chart range dialog doesn't commit datarange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so nothing happens. since: commit 4965b055b5998dc345ecaeb80fc8c3874b19e2a5 CommitDate: Fri Feb 16 12:08:55 2024 +0100 Chart: Make Data Range Dialog Async async conversion missed that there is a DataSourceDialog::run override so the use of asyncRun means the body of that isn't run. To keep things simple we can add an explicit 'ok' handler and move the special dialog ok code into that instead, so all the existing asyncRun's used with this dialog run the same code originally called in the previous non-async case. Change-Id: Ibdb4b764b1a1e48c01ee1528bc260f694e840221 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172336 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- .../controller/dialogs/dlg_DataSource.cxx | 22 ++++++++++--------- .../source/controller/inc/dlg_DataSource.hxx | 5 ++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index be915f564990..c00698fef60d 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -94,6 +94,7 @@ DataSourceDialog::DataSourceDialog(weld::Window * pParent, m_apDocTemplateProvider.get(), true /* bHideDescription */ ); m_xTabControl->connect_enter_page(LINK(this, DataSourceDialog, ActivatePageHdl)); m_xTabControl->connect_leave_page(LINK(this, DataSourceDialog, DeactivatePageHdl)); + m_xBtnOK->connect_clicked(LINK(this, DataSourceDialog, OkHdl)); ActivatePageHdl(m_xTabControl->get_current_page_ident()); if (m_nLastPageId != 0) { @@ -109,17 +110,18 @@ DataSourceDialog::~DataSourceDialog() m_nLastPageId = m_xTabControl->get_current_page(); } -short DataSourceDialog::run() +void DataSourceDialog::commitPages() { - short nResult = GenericDialogController::run(); - if( nResult == RET_OK ) - { - if( m_xRangeChooserTabPage ) - m_xRangeChooserTabPage->commitPage(); - if( m_xDataSourceTabPage ) - m_xDataSourceTabPage->commitPage(); - } - return nResult; + if (m_xRangeChooserTabPage) + m_xRangeChooserTabPage->commitPage(); + if (m_xDataSourceTabPage) + m_xDataSourceTabPage->commitPage(); +} + +IMPL_LINK_NOARG(DataSourceDialog, OkHdl, weld::Button&, void) +{ + commitPages(); + m_xDialog->response(RET_OK); } IMPL_LINK(DataSourceDialog, ActivatePageHdl, const OUString&, rPage, void) diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx index 166131e30ec9..c6b10d1dd213 100644 --- a/chart2/source/controller/inc/dlg_DataSource.hxx +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -44,9 +44,6 @@ public: const rtl::Reference<::chart::ChartModel> & xChartDocument ); virtual ~DataSourceDialog() override; - // from GenericDialogController base - virtual short run() override; - // TabPageNotifiable virtual void setInvalidPage( BuilderPage * pTabPage ) override; virtual void setValidPage( BuilderPage * pTabPage ) override; @@ -54,6 +51,8 @@ public: private: DECL_LINK(ActivatePageHdl, const OUString&, void); DECL_LINK(DeactivatePageHdl, const OUString&, bool); + DECL_LINK(OkHdl, weld::Button&, void); + void commitPages(); std::unique_ptr< ChartTypeTemplateProvider > m_apDocTemplateProvider; std::unique_ptr< DialogModel > m_apDialogModel;