chart2/source/controller/dialogs/dlg_DataSource.cxx |   22 ++++++++++----------
 chart2/source/controller/inc/dlg_DataSource.hxx     |    5 +---
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 80994373993a264df0df2938f6b6ac176d1c3ff4
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Aug 23 21:36:59 2024 +0100
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed Aug 28 12:19:22 2024 +0200

    Resolves: tdf#162597 'ok' in chart range dialog doesn't commit datarange
    
    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/+/172276
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx 
b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index 1eb6202deb4b..7e85790777c6 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -96,6 +96,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)
     {
@@ -111,17 +112,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;

Reply via email to