Kaydet (Commit) 2fb266bb authored tarafından Caolán McNamara's avatar Caolán McNamara

unify the message dialogs with extra widgets cases

Change-Id: I9ad3573b15d24c3d1737b9f450792952ae20a31b
Reviewed-on: https://gerrit.libreoffice.org/51476Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 6709db94
......@@ -41,6 +41,21 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
namespace
{
class MessageWithCheck : public weld::MessageDialogController
{
private:
std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
public:
MessageWithCheck(weld::Window *pParent)
: weld::MessageDialogController(pParent, "modules/sbibliography/ui/querydialog.ui", "QueryDialog", "ask")
, m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
{
}
bool get_active() const { return m_xWarningOnBox->get_active(); }
};
}
namespace bib
{
......@@ -139,24 +154,11 @@ namespace bib
sErrorString += "\n";
sErrorString += BibResId(RID_MAP_QUESTION);
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/sbibliography/ui/querydialog.ui"));
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryDialog"));
xQueryBox->set_primary_text(sErrorString);
std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area());
xOrigParent->remove(xWarningOnBox.get());
xContentArea->add(xWarningOnBox.get());
short nResult = xQueryBox->run();
BibModul::GetConfig()->SetShowColumnAssignmentWarning(!xWarningOnBox->get_active());
MessageWithCheck aQueryBox(GetFrameWeld());
aQueryBox.set_primary_text(sErrorString);
//put them back as they were
xContentArea->remove(xWarningOnBox.get());
xOrigParent->add(xWarningOnBox.get());
short nResult = aQueryBox.run();
BibModul::GetConfig()->SetShowColumnAssignmentWarning(!aQueryBox.get_active());
if( RET_YES != nResult )
{
......
......@@ -613,13 +613,19 @@ private:
protected:
std::unique_ptr<weld::Builder> m_xBuilder;
std::unique_ptr<weld::MessageDialog> m_xDialog;
std::unique_ptr<weld::Container> m_xContentArea;
std::unique_ptr<weld::Widget> m_xRelocate;
std::unique_ptr<weld::Container> m_xOrigParent;
public:
MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
const OString& rDialogId);
const OString& rDialogId, const OString& rRelocateId = OString());
~MessageDialogController() override;
void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); }
void set_primary_text(const OUString& rText) { m_xDialog->set_primary_text(rText); }
OUString get_primary_text() const { return m_xDialog->get_primary_text(); }
void set_default_response(int response) { m_xDialog->set_default_response(response); }
};
}
#endif
......
......@@ -516,6 +516,19 @@ ScDocShell& getDocShell(const ScDocument& rDoc)
return static_cast<ScDocShell&>(*rDoc.GetDocumentShell());
}
class MessageWithCheck : public weld::MessageDialogController
{
private:
std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
public:
MessageWithCheck(weld::Window *pParent, const OUString& rUIFile, const OString& rDialogId)
: weld::MessageDialogController(pParent, rUIFile, rDialogId, "ask")
, m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
{
}
bool get_active() const { return m_xWarningOnBox->get_active(); }
};
}
void WorkbookFragment::recalcFormulaCells()
......@@ -534,27 +547,13 @@ void WorkbookFragment::recalcFormulaCells()
// Ask the user if full re-calculation is desired.
vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr,
"modules/scalc/ui/recalcquerydialog.ui"));
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("RecalcQueryDialog"));
xQueryBox->set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
xQueryBox->set_default_response(RET_YES);
std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area());
xOrigParent->remove(xWarningOnBox.get());
xContentArea->add(xWarningOnBox.get());
bHardRecalc = xQueryBox->run() == RET_YES;
MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr, "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog");
aQueryBox.set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS));
aQueryBox.set_default_response(RET_YES);
//put them back as they were
xContentArea->remove(xWarningOnBox.get());
xOrigParent->add(xWarningOnBox.get());
bHardRecalc = aQueryBox.run() == RET_YES;
if (xWarningOnBox->get_active())
if (aQueryBox.get_active())
{
// Always perform selected action in the future.
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
......
......@@ -428,6 +428,19 @@ void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rDa
rMgr.setDataStream(pStrm);
}
class MessageWithCheck : public weld::MessageDialogController
{
private:
std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
public:
MessageWithCheck(weld::Window *pParent, const OUString& rUIFile, const OString& rDialogId)
: weld::MessageDialogController(pParent, rUIFile, rDialogId, "ask")
, m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
{
}
bool get_active() const { return m_xWarningOnBox->get_active(); }
};
}
bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css::embed::XStorage >& xStor )
......@@ -475,27 +488,14 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css
// full re-calculation.
vcl::Window* pWin = GetActiveDialogParent();
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr,
"modules/scalc/ui/recalcquerydialog.ui"));
std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("RecalcQueryDialog"));
xQueryBox->set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
xQueryBox->set_default_response(RET_YES);
std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area());
xOrigParent->remove(xWarningOnBox.get());
xContentArea->add(xWarningOnBox.get());
bHardRecalc = xQueryBox->run() == RET_YES;
MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr,
"modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog");
aQueryBox.set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS));
aQueryBox.set_default_response(RET_YES);
//put them back as they were
xContentArea->remove(xWarningOnBox.get());
xOrigParent->add(xWarningOnBox.get());
bHardRecalc = aQueryBox.run() == RET_YES;
if (xWarningOnBox->get_active())
if (aQueryBox.get_active())
{
// Always perform selected action in the future.
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
......@@ -725,25 +725,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr,
"modules/scalc/ui/sharedwarningdialog.ui"));
std::unique_ptr<weld::MessageDialog> xWarningBox(xBuilder->weld_message_dialog("SharedWarningDialog"));
std::unique_ptr<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask"));
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
std::unique_ptr<weld::Container> xOrigParent(xWarningOnBox->weld_parent());
std::unique_ptr<weld::Container> xContentArea(xWarningBox->weld_message_area());
xOrigParent->remove(xWarningOnBox.get());
xContentArea->add(xWarningOnBox.get());
xWarningBox->run();
//put them back as they were
xContentArea->remove(xWarningOnBox.get());
xOrigParent->add(xWarningOnBox.get());
MessageWithCheck aWarningBox(pWin ? pWin->GetFrameWeld() : nullptr,
"modules/scalc/ui/sharedwarningdialog.ui", "SharedWarningDialog");
aWarningBox.run();
bool bChecked = xWarningOnBox->get_active();
bool bChecked = aWarningBox.get_active();
if (bChecked)
{
aAppOptions.SetShowSharedDocumentWarning( !bChecked );
......
......@@ -27,11 +27,8 @@
class ScReplaceWarnBox : public weld::MessageDialogController
{
std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
std::unique_ptr<weld::Container> m_xOrigParent;
std::unique_ptr<weld::Container> m_xContentArea;
public:
ScReplaceWarnBox(weld::Window* pParent);
virtual ~ScReplaceWarnBox() override;
/** Opens dialog if IsDialogEnabled() returns true.
@descr If after executing the dialog the checkbox "Do not show again" is set,
......
......@@ -27,26 +27,12 @@
ScReplaceWarnBox::ScReplaceWarnBox(weld::Window* pParent)
: MessageDialogController(pParent, "modules/scalc/ui/checkwarningdialog.ui",
"CheckWarningDialog")
"CheckWarningDialog", "ask")
// By default, the check box is ON, and the user needs to un-check it to
// disable all future warnings.
, m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
, m_xOrigParent(m_xWarningOnBox->weld_parent())
, m_xContentArea(m_xDialog->weld_message_area())
{
m_xDialog->set_default_response(RET_YES);
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
m_xOrigParent->remove(m_xWarningOnBox.get());
m_xContentArea->add(m_xWarningOnBox.get());
}
ScReplaceWarnBox::~ScReplaceWarnBox()
{
//put them back as they were
m_xContentArea->remove(m_xWarningOnBox.get());
m_xOrigParent->add(m_xWarningOnBox.get());
}
short ScReplaceWarnBox::execute()
......
......@@ -27,18 +27,11 @@
SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName,
const OUString& _rDefaultExtension, bool rDefaultIsAlien)
: MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog")
: MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog", "ask")
, m_xKeepCurrentBtn(m_xBuilder->weld_button("save"))
, m_xUseDefaultFormatBtn(m_xBuilder->weld_button("cancel"))
, m_xWarningOnBox(m_xBuilder->weld_check_button("ask"))
, m_xOrigParent(m_xWarningOnBox->weld_parent())
, m_xContentArea(m_xDialog->weld_message_area())
{
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
m_xOrigParent->remove(m_xWarningOnBox.get());
m_xContentArea->add(m_xWarningOnBox.get());
OUString aExtension = "ODF";
// replace formatname (text)
......@@ -70,8 +63,6 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUStri
SfxAlienWarningDialog::~SfxAlienWarningDialog()
{
m_xContentArea->remove(m_xWarningOnBox.get());
m_xOrigParent->add(m_xWarningOnBox.get());
// save value of "warning off" checkbox, if necessary
SvtSaveOptions aSaveOpt;
bool bChecked = m_xWarningOnBox->get_active();
......
......@@ -28,9 +28,6 @@ private:
std::unique_ptr<weld::Button> m_xUseDefaultFormatBtn;
std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
std::unique_ptr<weld::Container> m_xOrigParent;
std::unique_ptr<weld::Container> m_xContentArea;
public:
SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName,
const OUString& _rDefaultExtension, bool rDefaultIsAlien);
......
......@@ -120,74 +120,73 @@ static OUString lcl_GetColumnValueOf(const OUString& rColumn, Reference < contai
class SwSaveWarningBox_Impl : public SwMessageAndEditDialog
{
DECL_LINK( ModifyHdl, Edit&, void);
DECL_LINK( ModifyHdl, weld::Entry&, void);
public:
SwSaveWarningBox_Impl(vcl::Window* pParent, const OUString& rFileName);
SwSaveWarningBox_Impl(weld::Window* pParent, const OUString& rFileName);
OUString GetFileName() const
{
return m_pEdit->GetText();
return m_xEdit->get_text();
}
};
class SwSendQueryBox_Impl : public SwMessageAndEditDialog
{
bool bIsEmptyAllowed;
DECL_LINK( ModifyHdl, Edit&, void);
DECL_LINK( ModifyHdl, weld::Entry&, void);
public:
SwSendQueryBox_Impl(vcl::Window* pParent, const OUString& rID,
SwSendQueryBox_Impl(weld::Window* pParent, const OString& rID,
const OUString& rUIXMLDescription);
void SetValue(const OUString& rSet)
{
m_pEdit->SetText(rSet);
ModifyHdl(*m_pEdit);
m_xEdit->set_text(rSet);
ModifyHdl(*m_xEdit);
}
OUString GetValue() const
{
return m_pEdit->GetText();
return m_xEdit->get_text();
}
void SetIsEmptyTextAllowed(bool bSet)
{
bIsEmptyAllowed = bSet;
ModifyHdl(*m_pEdit);
ModifyHdl(*m_xEdit);
}
};
SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(vcl::Window* pParent, const OUString& rFileName)
SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(weld::Window* pParent, const OUString& rFileName)
: SwMessageAndEditDialog(pParent, "AlreadyExistsDialog",
"modules/swriter/ui/alreadyexistsdialog.ui")
{
m_pEdit->SetText(rFileName);
m_pEdit->SetModifyHdl(LINK(this, SwSaveWarningBox_Impl, ModifyHdl));
m_xEdit->set_text(rFileName);
m_xEdit->connect_changed(LINK(this, SwSaveWarningBox_Impl, ModifyHdl));
INetURLObject aTmp(rFileName);
m_pPrimaryMessage->SetText(m_pPrimaryMessage->GetText().replaceAll("%1", aTmp.getName(
m_xDialog->set_primary_text(m_xDialog->get_primary_text().replaceAll("%1", aTmp.getName(
INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset)));
ModifyHdl(*m_pEdit);
ModifyHdl(*m_xEdit);
}
IMPL_LINK( SwSaveWarningBox_Impl, ModifyHdl, Edit&, rEdit, void)
IMPL_LINK( SwSaveWarningBox_Impl, ModifyHdl, weld::Entry&, rEdit, void)
{
m_pOKPB->Enable(!rEdit.GetText().isEmpty());
m_xOKPB->set_sensitive(!rEdit.get_text().isEmpty());
}
SwSendQueryBox_Impl::SwSendQueryBox_Impl(vcl::Window* pParent, const OUString& rID,
SwSendQueryBox_Impl::SwSendQueryBox_Impl(weld::Window* pParent, const OString& rID,
const OUString& rUIXMLDescription)
: SwMessageAndEditDialog(pParent, rID, rUIXMLDescription)
, bIsEmptyAllowed(true)
{
m_pImageIM->SetImage(GetStandardQueryBoxImage());
m_pEdit->SetModifyHdl(LINK(this, SwSendQueryBox_Impl, ModifyHdl));
ModifyHdl(*m_pEdit);
m_xEdit->connect_changed(LINK(this, SwSendQueryBox_Impl, ModifyHdl));
ModifyHdl(*m_xEdit);
}
IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, Edit&, rEdit, void)
IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, weld::Entry&, rEdit, void)
{
m_pOKPB->Enable(bIsEmptyAllowed || !rEdit.GetText().isEmpty());
m_xOKPB->set_sensitive(bIsEmptyAllowed || !rEdit.get_text().isEmpty());
}
class SwCopyToDialog : public SfxModalDialog
......@@ -734,9 +733,9 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void)
if(bFailed)
{
ScopedVclPtrInstance< SwSaveWarningBox_Impl > aWarning( pButton, sOutPath );
if(RET_OK == aWarning->Execute())
sOutPath = aWarning->GetFileName();
std::unique_ptr<SwSaveWarningBox_Impl> xWarning(new SwSaveWarningBox_Impl(pButton->GetFrameWeld(), sOutPath));
if (RET_OK == xWarning->run())
sOutPath = xWarning->GetFileName();
else
{
xTempDocShell->DoClose();
......@@ -1011,26 +1010,26 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
if(m_pSubjectED->GetText().isEmpty())
{
ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "SubjectDialog",
"modules/swriter/ui/subjectdialog.ui");
aQuery->SetIsEmptyTextAllowed(true);
aQuery->SetValue("");
if(RET_OK == aQuery->Execute())
std::unique_ptr<SwSendQueryBox_Impl> xQuery(new SwSendQueryBox_Impl(pButton->GetFrameWeld(), "SubjectDialog",
"modules/swriter/ui/subjectdialog.ui"));
xQuery->SetIsEmptyTextAllowed(true);
xQuery->SetValue("");
if(RET_OK == xQuery->run())
{
if(!aQuery->GetValue().isEmpty())
m_pSubjectED->SetText(aQuery->GetValue());
if(!xQuery->GetValue().isEmpty())
m_pSubjectED->SetText(xQuery->GetValue());
}
else
return; // back to the dialog
}
if(!bAsBody && m_pAttachmentED->GetText().isEmpty())
{
ScopedVclPtrInstance<SwSendQueryBox_Impl> aQuery(pButton, "AttachNameDialog",
"modules/swriter/ui/attachnamedialog.ui");
aQuery->SetIsEmptyTextAllowed(false);
if(RET_OK == aQuery->Execute())
std::unique_ptr<SwSendQueryBox_Impl> xQuery(new SwSendQueryBox_Impl(pButton->GetFrameWeld(), "AttachNameDialog",
"modules/swriter/ui/attachnamedialog.ui"));
xQuery->SetIsEmptyTextAllowed(false);
if (RET_OK == xQuery->run())
{
OUString sAttach(aQuery->GetValue());
OUString sAttach(xQuery->GetValue());
sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.');
if (2 > nTokenCount)
{
......
......@@ -8,41 +8,13 @@
*/
#include <swmessdialog.hxx>
#include <vcl/button.hxx>
#include <vcl/edit.hxx>
#include <vcl/fixed.hxx>
#include <vcl/messagedialog.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/vclmedit.hxx>
SwMessageAndEditDialog::SwMessageAndEditDialog(vcl::Window* pParent, const OUString& rID,
SwMessageAndEditDialog::SwMessageAndEditDialog(weld::Window* pParent, const OString& rID,
const OUString& rUIXMLDescription)
: ModalDialog(pParent, rID, rUIXMLDescription)
: MessageDialogController(pParent, rUIXMLDescription, rID, "grid")
, m_xEdit(m_xBuilder->weld_entry("edit"))
, m_xOKPB(m_xBuilder->weld_button("ok"))
{
get(m_pOKPB, "ok");
get(m_pPrimaryMessage, "primarymessage");
m_pPrimaryMessage->SetPaintTransparent(true);
get(m_pSecondaryMessage, "secondarymessage");
m_pSecondaryMessage->SetPaintTransparent(true);
MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, m_pSecondaryMessage);
get(m_pImageIM, "image");
m_pImageIM->SetImage(GetStandardWarningBoxImage());
get(m_pEdit, "edit");
}
SwMessageAndEditDialog::~SwMessageAndEditDialog()
{
disposeOnce();
}
void SwMessageAndEditDialog::dispose()
{
m_pOKPB.clear();
m_pImageIM.clear();
m_pPrimaryMessage.clear();
m_pSecondaryMessage.clear();
m_pEdit.clear();
ModalDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -10,26 +10,16 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX
#define INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX
#include <vcl/dialog.hxx>
#include <vcl/weld.hxx>
class Edit;
class FixedImage;
class OKButton;
class VclMultiLineEdit;
class SwMessageAndEditDialog : public ModalDialog
class SwMessageAndEditDialog : public weld::MessageDialogController
{
protected:
VclPtr<OKButton> m_pOKPB;
VclPtr<FixedImage> m_pImageIM;
VclPtr<VclMultiLineEdit> m_pPrimaryMessage;
VclPtr<VclMultiLineEdit> m_pSecondaryMessage;
VclPtr<Edit> m_pEdit;
std::unique_ptr<weld::Entry> m_xEdit;
std::unique_ptr<weld::Button> m_xOKPB;
public:
SwMessageAndEditDialog(vcl::Window* pParent, const OUString& rID,
SwMessageAndEditDialog(weld::Window* pParent, const OString& rID,
const OUString& rUIXMLDescription);
virtual ~SwMessageAndEditDialog() override;
virtual void dispose() override;
};
#endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX
......
......@@ -1598,13 +1598,31 @@ namespace weld
Dialog* MessageDialogController::getDialog() { return m_xDialog.get(); }
MessageDialogController::MessageDialogController(weld::Widget* pParent, const OUString &rUIFile, const OString& rDialogId)
MessageDialogController::MessageDialogController(weld::Widget* pParent, const OUString &rUIFile, const OString& rDialogId,
const OString& rRelocateId)
: m_xBuilder(Application::CreateBuilder(pParent, rUIFile))
, m_xDialog(m_xBuilder->weld_message_dialog(rDialogId))
, m_xContentArea(m_xDialog->weld_message_area())
{
if (!rRelocateId.isEmpty())
{
m_xRelocate.reset(m_xBuilder->weld_container(rRelocateId));
m_xOrigParent.reset(m_xRelocate->weld_parent());
//fdo#75121, a bit tricky because the widgets we want to align with
//don't actually exist in the ui description, they're implied
m_xOrigParent->remove(m_xRelocate.get());
m_xContentArea->add(m_xRelocate.get());
}
}
MessageDialogController::~MessageDialogController() = default;
MessageDialogController::~MessageDialogController()
{
if (m_xRelocate)
{
m_xContentArea->remove(m_xRelocate.get());
m_xOrigParent->add(m_xRelocate.get());
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment