[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/source sw/uiconfig

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 21 06:40:43 UTC 2021


 sw/source/ui/dbui/mmdocselectpage.cxx  |   30 ++++++++++++++++++++++++++--
 sw/source/ui/dbui/mmdocselectpage.hxx  |    2 +
 sw/uiconfig/swriter/ui/mmselectpage.ui |   35 ++++++++++++++++++++++++---------
 3 files changed, 56 insertions(+), 11 deletions(-)

New commits:
commit efc99a06894ab7cd8a16fced93aaafc5fdb5133f
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Tue Apr 13 08:48:32 2021 +0300
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Apr 21 08:40:09 2021 +0200

    tdf#139906  Add an option to change data source from mail merge wizard dialog.
    
    Change-Id: I52dfd9be82813a1b01c725eab97a7534ae9a05d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114079
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114373
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx
index 58151d969acf..7d99f8274976 100644
--- a/sw/source/ui/dbui/mmdocselectpage.cxx
+++ b/sw/source/ui/dbui/mmdocselectpage.cxx
@@ -30,9 +30,8 @@
 #include <shellio.hxx>
 #include <swabstdlg.hxx>
 #include <mmconfigitem.hxx>
-
 #include <dbui.hrc>
-
+#include <swuiexp.hxx>
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
@@ -54,6 +53,7 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(weld::Container* pPage, SwMai
     , m_xBrowseTemplatePB(m_xBuilder->weld_button("browsetemplate"))
     , m_xRecentDocLB(m_xBuilder->weld_combo_box("recentdoclb"))
     , m_xDataSourceWarningFT(m_xBuilder->weld_label("datasourcewarning"))
+    , m_xExchangeDatabasePB(m_xBuilder->weld_button("exchangedatabase"))
 {
     m_xCurrentDocRB->set_active(true);
     DocSelectHdl(*m_xNewDocRB);
@@ -69,6 +69,9 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(weld::Container* pPage, SwMai
     m_xBrowseDocPB->connect_clicked(aFileSelectHdl);
     m_xBrowseTemplatePB->connect_clicked(aFileSelectHdl);
 
+    Link<weld::Button&,void> aExchangeDatabaseHdl = LINK(this, SwMailMergeDocSelectPage, ExchangeDatabaseHdl);
+    m_xExchangeDatabasePB->connect_clicked(aExchangeDatabaseHdl);
+
     const uno::Sequence< OUString >& rDocs =
                             m_pWizard->GetConfigItem().GetSavedDocuments();
     for(const auto& rDoc : rDocs)
@@ -105,6 +108,11 @@ IMPL_LINK_NOARG(SwMailMergeDocSelectPage, DocSelectHdl, weld::ToggleButton&, voi
         m_xDataSourceWarningFT->hide();
         m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(MM_OUTPUTTYPETPAGE));
     }
+
+    if(m_xCurrentDocRB->get_active())
+        m_xExchangeDatabasePB->set_sensitive(true);
+    else
+        m_xExchangeDatabasePB->set_sensitive(false);
 }
 
 IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button&, rButton, void)
@@ -160,6 +168,24 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button&, rButton, void)
     m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(MM_OUTPUTTYPETPAGE));
 }
 
+IMPL_LINK_NOARG(SwMailMergeDocSelectPage, ExchangeDatabaseHdl, weld::Button&, void)
+{
+
+    SwAbstractDialogFactory& rFact = ::swui::GetFactory();
+    ScopedVclPtr<VclAbstractDialog> pDlg(rFact.CreateSwChangeDBDlg(*m_pWizard->GetSwView()));
+    pDlg->Execute();
+
+    OUString sDataSourceName = m_pWizard->GetSwView()->GetDataSourceName();
+
+    if(m_xCurrentDocRB->get_active() &&
+       !sDataSourceName.isEmpty() &&
+       SwView::IsDataSourceAvailable(sDataSourceName))
+    {
+        m_xDataSourceWarningFT->hide();
+        m_pWizard->enableButtons(WizardButtonFlags::NEXT, true);
+    }
+}
+
 bool SwMailMergeDocSelectPage::commitPage( ::vcl::WizardTypes::CommitPageReason _eReason )
 {
     bool bReturn = false;
diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx
index eccb3ffdda15..8a2a86a6e400 100644
--- a/sw/source/ui/dbui/mmdocselectpage.hxx
+++ b/sw/source/ui/dbui/mmdocselectpage.hxx
@@ -40,9 +40,11 @@ class SwMailMergeDocSelectPage : public vcl::OWizardPage
     std::unique_ptr<weld::Button> m_xBrowseTemplatePB;
     std::unique_ptr<weld::ComboBox> m_xRecentDocLB;
     std::unique_ptr<weld::Label> m_xDataSourceWarningFT;
+    std::unique_ptr<weld::Button> m_xExchangeDatabasePB;
 
     DECL_LINK(DocSelectHdl, weld::ToggleButton&, void);
     DECL_LINK(FileSelectHdl, weld::Button&, void);
+    DECL_LINK(ExchangeDatabaseHdl, weld::Button&, void);
 
     virtual bool    commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override;
 
diff --git a/sw/uiconfig/swriter/ui/mmselectpage.ui b/sw/uiconfig/swriter/ui/mmselectpage.ui
index 4f5da744c05c..323af20266fd 100644
--- a/sw/uiconfig/swriter/ui/mmselectpage.ui
+++ b/sw/uiconfig/swriter/ui/mmselectpage.ui
@@ -55,7 +55,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">1</property>
+                    <property name="top_attach">3</property>
                   </packing>
                 </child>
                 <child>
@@ -72,7 +72,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">2</property>
+                    <property name="top_attach">4</property>
                   </packing>
                 </child>
                 <child>
@@ -89,7 +89,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">4</property>
+                    <property name="top_attach">6</property>
                   </packing>
                 </child>
                 <child>
@@ -105,7 +105,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">6</property>
+                    <property name="top_attach">8</property>
                   </packing>
                 </child>
                 <child>
@@ -116,7 +116,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">7</property>
+                    <property name="top_attach">9</property>
                   </packing>
                 </child>
                 <child>
@@ -131,7 +131,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">3</property>
+                    <property name="top_attach">5</property>
                   </packing>
                 </child>
                 <child>
@@ -146,7 +146,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">5</property>
+                    <property name="top_attach">7</property>
                   </packing>
                 </child>
                 <child>
@@ -154,14 +154,31 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="halign">start</property>
-                    <property name="label" translatable="yes" context="mmselectpage|extended_tip|datasourcewarning">Data source of the current document is not registered.</property>
+                    <property name="margin_left">18</property>
+                    <property name="margin_start">18</property>
+                    <property name="label" translatable="yes" context="mmselectpage|extended_tip|datasourcewarning">Data source of the current document is not registered. Please exchange database.</property>
                     <attributes>
                       <attribute name="foreground" value="#cccc00000000"/>
                     </attributes>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">8</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="exchangedatabase">
+                    <property name="label" translatable="yes" context="mmselectpage|extended_tip|exchangedatabase">Exchange Database...</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">18</property>
+                    <property name="margin_start">18</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
                   </packing>
                 </child>
               </object>


More information about the Libreoffice-commits mailing list