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
AuthorDate: Tue Apr 13 08:48:32 2021 +0300
Commit: Jan Holesovsky
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
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114373
Tested-by: Jenkins CollaboraOffice
Reviewed-by: Jan Holesovsky
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
#include
#include
-
#include
-
+#include
#include
#include
#include
@@ -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 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
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 m_xBrowseTemplatePB;
std::unique_ptr m_xRecentDocLB;
std::unique_ptr m_xDataSourceWarningFT;
+std::unique_ptr m_xExchangeDatabasePB;
DECL_LINK(DocSelectHdl, weld::ToggleButton&, void);
DECL_LINK(FileSelectHdl, weld::Button&, void);
+DECL_LINK(ExchangeDatabaseHdl, weld::Button&, void);
virtual boolcommitPage( ::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 @@
0
-1
+3
@@ -72,7 +72,7 @@
0
-2
+4
@@ -89,7 +89,7 @@