[Libreoffice-commits] core.git: sw/source sw/uiconfig
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 18 12:20:05 UTC 2018
sw/source/ui/dbui/mailmergewizard.cxx | 2
sw/source/ui/dbui/mmdocselectpage.cxx | 90 ++++++++++++++-------------------
sw/source/ui/dbui/mmdocselectpage.hxx | 29 ++++------
sw/uiconfig/swriter/ui/mmselectpage.ui | 9 +--
4 files changed, 58 insertions(+), 72 deletions(-)
New commits:
commit bfd6233cc83aa368d4869ae5901219238fb02e13
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Oct 18 09:24:58 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 18 14:18:56 2018 +0200
weld SwMailMergeDocSelectPage
Change-Id: I0a319624656eb1305522ebd4ae3ff63d5106db3b
Reviewed-on: https://gerrit.libreoffice.org/61910
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
index ed43ce86e430..43234669beef 100644
--- a/sw/source/ui/dbui/mailmergewizard.cxx
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -93,7 +93,7 @@ VclPtr<TabPage> SwMailMergeWizard::createPage(WizardState _nState)
switch(_nState)
{
case MM_DOCUMENTSELECTPAGE :
- pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this);
+ pRet = VclPtr<SwMailMergeDocSelectPage>::Create(this, TabPageParent(this));
/* tdf#52986 Set help ID using SetRoadmapHelpId for all pages
so that when by default the focus is on the left side pane of
diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx
index 2ea8679dd9e4..af68496086d0 100644
--- a/sw/source/ui/dbui/mmdocselectpage.cxx
+++ b/sw/source/ui/dbui/mmdocselectpage.cxx
@@ -42,45 +42,43 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace svt;
-SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pParent)
- : svt::OWizardPage(pParent, "MMSelectPage",
- "modules/swriter/ui/mmselectpage.ui")
- , m_pWizard(pParent)
+SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pWizard, TabPageParent pParent)
+ : svt::OWizardPage(pParent, "modules/swriter/ui/mmselectpage.ui", "MMSelectPage")
+ , m_pWizard(pWizard)
+ , m_xCurrentDocRB(m_xBuilder->weld_radio_button("currentdoc"))
+ , m_xNewDocRB(m_xBuilder->weld_radio_button("newdoc"))
+ , m_xLoadDocRB(m_xBuilder->weld_radio_button("loaddoc"))
+ , m_xLoadTemplateRB(m_xBuilder->weld_radio_button("template"))
+ , m_xRecentDocRB(m_xBuilder->weld_radio_button("recentdoc"))
+ , m_xBrowseDocPB(m_xBuilder->weld_button("browsedoc"))
+ , m_xBrowseTemplatePB(m_xBuilder->weld_button("browsetemplate"))
+ , m_xRecentDocLB(m_xBuilder->weld_combo_box("recentdoclb"))
{
- get(m_pCurrentDocRB, "currentdoc");
- get(m_pNewDocRB, "newdoc");
- get(m_pLoadDocRB, "loaddoc");
- get(m_pLoadTemplateRB, "template");
- get(m_pRecentDocRB, "recentdoc");
- get(m_pBrowseDocPB, "browsedoc");
- get(m_pBrowseTemplatePB, "browsetemplate");
- get(m_pRecentDocLB, "recentdoclb");
-
- m_pCurrentDocRB->Check();
- DocSelectHdl(m_pNewDocRB);
-
- Link<Button*,void> aDocSelectLink = LINK(this, SwMailMergeDocSelectPage, DocSelectHdl);
- m_pCurrentDocRB->SetClickHdl(aDocSelectLink);
- m_pNewDocRB->SetClickHdl(aDocSelectLink);
- m_pLoadDocRB->SetClickHdl(aDocSelectLink);
- m_pLoadTemplateRB->SetClickHdl(aDocSelectLink);
- m_pRecentDocRB->SetClickHdl(aDocSelectLink);
-
- Link<Button*,void> aFileSelectHdl = LINK(this, SwMailMergeDocSelectPage, FileSelectHdl);
- m_pBrowseDocPB->SetClickHdl(aFileSelectHdl);
- m_pBrowseTemplatePB->SetClickHdl(aFileSelectHdl);
+ m_xCurrentDocRB->set_active(true);
+ DocSelectHdl(*m_xNewDocRB);
+
+ Link<weld::ToggleButton&,void> aDocSelectLink = LINK(this, SwMailMergeDocSelectPage, DocSelectHdl);
+ m_xCurrentDocRB->connect_toggled(aDocSelectLink);
+ m_xNewDocRB->connect_toggled(aDocSelectLink);
+ m_xLoadDocRB->connect_toggled(aDocSelectLink);
+ m_xLoadTemplateRB->connect_toggled(aDocSelectLink);
+ m_xRecentDocRB->connect_toggled(aDocSelectLink);
+
+ Link<weld::Button&,void> aFileSelectHdl = LINK(this, SwMailMergeDocSelectPage, FileSelectHdl);
+ m_xBrowseDocPB->connect_clicked(aFileSelectHdl);
+ m_xBrowseTemplatePB->connect_clicked(aFileSelectHdl);
const uno::Sequence< OUString >& rDocs =
m_pWizard->GetConfigItem().GetSavedDocuments();
for(sal_Int32 nDoc = 0; nDoc < rDocs.getLength(); ++nDoc)
{
//insert in reverse order
- m_pRecentDocLB->InsertEntry(rDocs[nDoc], 0);
+ m_xRecentDocLB->insert_text(0, rDocs[nDoc]);
}
- m_pRecentDocLB->SelectEntryPos(0);
+ m_xRecentDocLB->set_active(0);
if(!rDocs.getLength())
{
- m_pRecentDocRB->Enable(false);
+ m_xRecentDocRB->set_sensitive(false);
}
//Temp hack until all pages are converted to .ui and wizard
@@ -95,33 +93,25 @@ SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage()
void SwMailMergeDocSelectPage::dispose()
{
- m_pCurrentDocRB.clear();
- m_pNewDocRB.clear();
- m_pLoadDocRB.clear();
- m_pLoadTemplateRB.clear();
- m_pRecentDocRB.clear();
- m_pBrowseDocPB.clear();
- m_pBrowseTemplatePB.clear();
- m_pRecentDocLB.clear();
m_pWizard.clear();
svt::OWizardPage::dispose();
}
-IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, Button*, pButton, void)
+IMPL_LINK_NOARG(SwMailMergeDocSelectPage, DocSelectHdl, weld::ToggleButton&, void)
{
- m_pRecentDocLB->Enable(m_pRecentDocRB == pButton);
+ m_xRecentDocLB->set_sensitive(m_xRecentDocRB->get_active());
m_pWizard->UpdateRoadmap();
m_pWizard->enableButtons(WizardButtonFlags::NEXT, m_pWizard->isStateEnabled(MM_OUTPUTTYPETPAGE));
}
-IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, Button*, pButton, void)
+IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button&, rButton, void)
{
- bool bTemplate = m_pBrowseTemplatePB == pButton;
+ bool bTemplate = m_xBrowseTemplatePB.get() == &rButton;
if(bTemplate)
{
- m_pLoadTemplateRB->Check();
+ m_xLoadTemplateRB->set_active(true);
SfxNewFileDialog aNewFileDlg(GetFrameWeld(), SfxNewFileDialogMode::NONE);
sal_uInt16 nRet = aNewFileDlg.run();
if(RET_TEMPLATE_LOAD == nRet)
@@ -130,7 +120,7 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, Button*, pButton, void)
m_sLoadTemplateName = aNewFileDlg.GetTemplateFileName();
}
else
- m_pLoadDocRB->Check();
+ m_xLoadDocRB->set_active(true);
if(!bTemplate)
{
@@ -176,15 +166,15 @@ bool SwMailMergeDocSelectPage::commitPage( ::svt::WizardTypes::CommitPageReason
if(bNext || _eReason == ::svt::WizardTypes::eValidate )
{
OUString sReloadDocument;
- bReturn = m_pCurrentDocRB->IsChecked() ||
- m_pNewDocRB->IsChecked() ||
- (!(sReloadDocument = m_sLoadFileName).isEmpty() && m_pLoadDocRB->IsChecked() )||
- (!(sReloadDocument = m_sLoadTemplateName).isEmpty() && m_pLoadTemplateRB->IsChecked())||
- (m_pRecentDocRB->IsChecked() && !(sReloadDocument = m_pRecentDocLB->GetSelectedEntry()).isEmpty());
+ bReturn = m_xCurrentDocRB->get_active() ||
+ m_xNewDocRB->get_active() ||
+ (!(sReloadDocument = m_sLoadFileName).isEmpty() && m_xLoadDocRB->get_active() )||
+ (!(sReloadDocument = m_sLoadTemplateName).isEmpty() && m_xLoadTemplateRB->get_active())||
+ (m_xRecentDocRB->get_active() && !(sReloadDocument = m_xRecentDocLB->get_active_text()).isEmpty());
if( _eReason == ::svt::WizardTypes::eValidate )
- m_pWizard->SetDocumentLoad(!m_pCurrentDocRB->IsChecked());
+ m_pWizard->SetDocumentLoad(!m_xCurrentDocRB->get_active());
- if(bNext && !m_pCurrentDocRB->IsChecked())
+ if(bNext && !m_xCurrentDocRB->get_active())
{
if(!sReloadDocument.isEmpty())
m_pWizard->SetReloadDocument( sReloadDocument );
diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx
index 3eafb73b817f..7411d29f91fd 100644
--- a/sw/source/ui/dbui/mmdocselectpage.hxx
+++ b/sw/source/ui/dbui/mmdocselectpage.hxx
@@ -27,32 +27,29 @@ class SwMailMergeWizard;
class SwMailMergeDocSelectPage : public svt::OWizardPage
{
- VclPtr<RadioButton> m_pCurrentDocRB;
- VclPtr<RadioButton> m_pNewDocRB;
- VclPtr<RadioButton> m_pLoadDocRB;
- VclPtr<RadioButton> m_pLoadTemplateRB;
- VclPtr<RadioButton> m_pRecentDocRB;
-
- VclPtr<PushButton> m_pBrowseDocPB;
- VclPtr<PushButton> m_pBrowseTemplatePB;
-
- VclPtr<ListBox> m_pRecentDocLB;
-
OUString m_sLoadFileName;
OUString m_sLoadTemplateName;
VclPtr<SwMailMergeWizard> m_pWizard;
- DECL_LINK(DocSelectHdl, Button*, void);
- DECL_LINK(FileSelectHdl, Button*, void);
+ std::unique_ptr<weld::RadioButton> m_xCurrentDocRB;
+ std::unique_ptr<weld::RadioButton> m_xNewDocRB;
+ std::unique_ptr<weld::RadioButton> m_xLoadDocRB;
+ std::unique_ptr<weld::RadioButton> m_xLoadTemplateRB;
+ std::unique_ptr<weld::RadioButton> m_xRecentDocRB;
+ std::unique_ptr<weld::Button> m_xBrowseDocPB;
+ std::unique_ptr<weld::Button> m_xBrowseTemplatePB;
+ std::unique_ptr<weld::ComboBox> m_xRecentDocLB;
+
+ DECL_LINK(DocSelectHdl, weld::ToggleButton&, void);
+ DECL_LINK(FileSelectHdl, weld::Button&, void);
virtual bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason ) override;
public:
- SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent);
- virtual ~SwMailMergeDocSelectPage() override;
+ SwMailMergeDocSelectPage(SwMailMergeWizard* pWizard, TabPageParent pParent);
+ virtual ~SwMailMergeDocSelectPage() override;
virtual void dispose() override;
-
};
#endif
diff --git a/sw/uiconfig/swriter/ui/mmselectpage.ui b/sw/uiconfig/swriter/ui/mmselectpage.ui
index 3058b25791d2..414cb0455ec5 100644
--- a/sw/uiconfig/swriter/ui/mmselectpage.ui
+++ b/sw/uiconfig/swriter/ui/mmselectpage.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.19.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<object class="GtkBox" id="MMSelectPage">
@@ -36,7 +36,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">newdoc</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -52,7 +51,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
- <property name="group">loaddoc</property>
+ <property name="group">currentdoc</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -69,7 +68,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
- <property name="group">template</property>
+ <property name="group">currentdoc</property>
</object>
<packing>
<property name="left_attach">0</property>
@@ -86,7 +85,7 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
- <property name="group">recentdoc</property>
+ <property name="group">currentdoc</property>
</object>
<packing>
<property name="left_attach">0</property>
More information about the Libreoffice-commits
mailing list