summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-04 10:43:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-04 15:42:39 +0200
commit1cfcf1a5c7437b935da652e6bd25db536c4f4cf7 (patch)
treed8f4982fdfa9d3a86ea2695b99e94cf8092b785d /sw/source
parenta57f67f1773f6693f07352fcb232460350d0d091 (diff)
weld SwAddRenameEntryDialog
Change-Id: I687486a392450fcf3b92fdc4d7a193b10f829835 Reviewed-on: https://gerrit.libreoffice.org/61363 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.cxx44
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.hxx30
2 files changed, 30 insertions, 44 deletions
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
index 81deb59639e2..3c466a415487 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.cxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
@@ -85,19 +85,19 @@ IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, Button*, pButton, voi
if(nPos == LISTBOX_ENTRY_NOTFOUND)
nPos = 0;
- ScopedVclPtr<SwAddRenameEntryDialog> pDlg;
+ std::unique_ptr<SwAddRenameEntryDialog> xDlg;
if (bRename)
- pDlg.disposeAndReset(VclPtr<SwRenameEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders));
+ xDlg.reset(new SwRenameEntryDialog(GetFrameWeld(), m_pNewData->aDBColumnHeaders));
else
- pDlg.disposeAndReset(VclPtr<SwAddEntryDialog>::Create(pButton, m_pNewData->aDBColumnHeaders));
- if(bRename)
+ xDlg.reset(new SwAddEntryDialog(GetFrameWeld(), m_pNewData->aDBColumnHeaders));
+ if (bRename)
{
OUString aTemp = m_pFieldsLB->GetEntry(nPos);
- pDlg->SetFieldName(aTemp);
+ xDlg->SetFieldName(aTemp);
}
- if(RET_OK == pDlg->Execute())
+ if (xDlg->run() == RET_OK)
{
- OUString sNew = pDlg->GetFieldName();
+ OUString sNew = xDlg->GetFieldName();
if(bRename)
{
m_pNewData->aDBColumnHeaders[nPos] = sNew;
@@ -177,32 +177,20 @@ void SwCustomizeAddressListDialog::UpdateButtons()
SwAddRenameEntryDialog::SwAddRenameEntryDialog(
- vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription,
+ weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID,
const std::vector< OUString >& rCSVHeader)
- : SfxModalDialog(pParent, rID, rUIXMLDescription)
+ : SfxDialogController(pParent, rUIXMLDescription, rID)
, m_rCSVHeader(rCSVHeader)
+ , m_xFieldNameED(m_xBuilder->weld_entry("entry"))
+ , m_xOK(m_xBuilder->weld_button("ok"))
{
- get(m_pOK, "ok");
- get(m_pFieldNameED, "entry");
- m_pFieldNameED->SetModifyHdl(LINK(this, SwAddRenameEntryDialog, ModifyHdl_Impl));
- ModifyHdl_Impl(*m_pFieldNameED);
-}
-
-SwAddRenameEntryDialog::~SwAddRenameEntryDialog()
-{
- disposeOnce();
-}
-
-void SwAddRenameEntryDialog::dispose()
-{
- m_pFieldNameED.clear();
- m_pOK.clear();
- SfxModalDialog::dispose();
+ m_xFieldNameED->connect_changed(LINK(this, SwAddRenameEntryDialog, ModifyHdl_Impl));
+ ModifyHdl_Impl(*m_xFieldNameED);
}
-IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit&, rEdit, void)
+IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, weld::Entry&, rEdit, void)
{
- OUString sEntry = rEdit.GetText();
+ OUString sEntry = rEdit.get_text();
bool bFound = sEntry.isEmpty();
if(!bFound)
@@ -217,7 +205,7 @@ IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit&, rEdit, void)
break;
}
}
- m_pOK->Enable(!bFound);
+ m_xOK->set_sensitive(!bFound);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
index a138d83ddf94..e5e2fdb4fae8 100644
--- a/sw/source/ui/dbui/customizeaddresslistdialog.hxx
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
@@ -53,31 +53,29 @@ public:
std::unique_ptr<SwCSVData> ReleaseNewData() { return std::move(m_pNewData);}
};
-class SwAddRenameEntryDialog : public SfxModalDialog
+class SwAddRenameEntryDialog : public SfxDialogController
{
- VclPtr<Edit> m_pFieldNameED;
- VclPtr<OKButton> m_pOK;
const std::vector< OUString >& m_rCSVHeader;
+ std::unique_ptr<weld::Entry> m_xFieldNameED;
+ std::unique_ptr<weld::Button> m_xOK;
- DECL_LINK(ModifyHdl_Impl, Edit&, void);
+ DECL_LINK(ModifyHdl_Impl, weld::Entry&, void);
protected:
- SwAddRenameEntryDialog(vcl::Window* pParent, const OUString& rID,
- const OUString& rUIXMLDescription, const std::vector< OUString >& rCSVHeader);
- virtual ~SwAddRenameEntryDialog() override;
- virtual void dispose() override;
+ SwAddRenameEntryDialog(weld::Window* pParent, const OUString& rUIXMLDescription,
+ const OString& rID, const std::vector< OUString >& rCSVHeader);
public:
- void SetFieldName(const OUString& rName) {m_pFieldNameED->SetText(rName);}
- OUString GetFieldName() const {return m_pFieldNameED->GetText();};
+ void SetFieldName(const OUString& rName) { m_xFieldNameED->set_text(rName); }
+ OUString GetFieldName() const { return m_xFieldNameED->get_text(); }
};
class SwAddEntryDialog : public SwAddRenameEntryDialog
{
public:
- SwAddEntryDialog(vcl::Window* pParent, const std::vector< OUString >& rCSVHeader)
- : SwAddRenameEntryDialog(pParent, "AddEntryDialog",
- "modules/swriter/ui/addentrydialog.ui", rCSVHeader)
+ SwAddEntryDialog(weld::Window* pParent, const std::vector< OUString >& rCSVHeader)
+ : SwAddRenameEntryDialog(pParent, "modules/swriter/ui/addentrydialog.ui",
+ "AddEntryDialog", rCSVHeader)
{
}
};
@@ -85,9 +83,9 @@ public:
class SwRenameEntryDialog : public SwAddRenameEntryDialog
{
public:
- SwRenameEntryDialog(vcl::Window* pParent, const std::vector< OUString >& rCSVHeader)
- : SwAddRenameEntryDialog(pParent, "RenameEntryDialog",
- "modules/swriter/ui/renameentrydialog.ui", rCSVHeader)
+ SwRenameEntryDialog(weld::Window* pParent, const std::vector< OUString >& rCSVHeader)
+ : SwAddRenameEntryDialog(pParent, "modules/swriter/ui/renameentrydialog.ui",
+ "RenameEntryDialog", rCSVHeader)
{
}
};