Kaydet (Commit) 9fcef57a authored tarafından Caolán McNamara's avatar Caolán McNamara

convert Redline warning dialog to .ui to get helpids

etc.

Change-Id: Ic5e6031fe99347f19002d5d8527b5632333fefb0
Reviewed-on: https://gerrit.libreoffice.org/50431Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst aa4548d1
......@@ -21,8 +21,8 @@
#include <vcl/dialog.hxx>
#include <vcl/edit.hxx>
#include <vcl/button.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <osl/file.hxx>
#include <tools/urlobj.hxx>
......@@ -720,12 +720,10 @@ void SbiIoSystem::Shutdown()
// anything left to PRINT?
if( !aOut.isEmpty() )
{
#if defined __GNUC__
vcl::Window* pParent = Application::GetDefDialogParent();
ScopedVclPtrInstance<MessBox>( pParent, MessBoxStyle::Ok, 0, OUString(), aOut )->Execute();
#else
ScopedVclPtrInstance<MessBox>( Application::GetDefDialogParent(), MessBoxStyle::Ok, 0, OUString(), aOut )->Execute();
#endif
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, VclMessageType::Warning,
VclButtonsType::Ok, aOut));
xBox->run();
}
aOut.clear();
}
......@@ -860,10 +858,12 @@ void SbiIoSystem::WriteCon(const OUString& rText)
}
{
SolarMutexGuard aSolarGuard;
if( !ScopedVclPtrInstance<MessBox>(
Application::GetDefDialogParent(),
MessBoxStyle::OkCancel | MessBoxStyle::DefaultOk,
0, OUString(), s)->Execute() )
vcl::Window* pParent = Application::GetDefDialogParent();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, VclMessageType::Warning,
VclButtonsType::OkCancel, s));
xBox->set_default_response(RET_OK);
if (!xBox->run())
{
nError = ERRCODE_BASIC_USER_ABORT;
}
......
......@@ -305,6 +305,9 @@
#define STR_CLEAR_CHAR NC_("STR_CLEAR_CHAR", "Remove")
#define STR_CLEAR_ALL_CHAR NC_("STR_CLEAR_ALL_CHAR", "Clear All")
#define STR_PASSWORD_LEN NC_("STR_PASSWORD_LEN", "Password length")
#define STR_PASSWORD_WARNING NC_("STR_PASSWORD_WARNING", "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes.")
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -135,7 +135,7 @@ public:
bool IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
// TRUE -> break
bool DoError( vcl::Window* pParent, const OUString& rInput, const ScAddress& rPos ) const;
bool DoError(weld::Window* pParent, const OUString& rInput, const ScAddress& rPos) const;
void DoCalcError( ScFormulaCell* pCell ) const;
bool IsEmpty() const;
......
......@@ -374,11 +374,11 @@ void ScValidationData::DoCalcError( ScFormulaCell* pCell ) const
// true -> abort
bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput,
const ScAddress& rPos ) const
bool ScValidationData::DoError(weld::Window* pParent, const OUString& rInput,
const ScAddress& rPos) const
{
if ( eErrorStyle == SC_VALERR_MACRO )
return DoMacro( rPos, rInput, nullptr, pParent ? pParent->GetFrameWeld() : nullptr);
return DoMacro(rPos, rInput, nullptr, pParent);
// Output error message
......@@ -389,29 +389,39 @@ bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput,
if (aMessage.isEmpty())
aMessage = ScGlobal::GetRscString( STR_VALID_DEFERROR );
//TODO: ErrorBox / WarningBox / InfoBox ?
//TODO: (with InfoBox always OK-Button only)
MessBoxStyle nStyle = MessBoxStyle::NONE;
VclButtonsType eStyle = VclButtonsType::Ok;
VclMessageType eType = VclMessageType::Error;
switch (eErrorStyle)
{
case SC_VALERR_STOP:
nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk;
case SC_VALERR_INFO:
eType = VclMessageType::Info;
eStyle = VclButtonsType::OkCancel;
break;
case SC_VALERR_WARNING:
nStyle = MessBoxStyle::OkCancel | MessBoxStyle::DefaultCancel;
eType = VclMessageType::Warning;
eStyle = VclButtonsType::OkCancel;
break;
default:
break;
}
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eType,
eStyle, aMessage));
xBox->set_title(aTitle);
switch (eErrorStyle)
{
case SC_VALERR_INFO:
nStyle = MessBoxStyle::OkCancel | MessBoxStyle::DefaultOk;
xBox->set_default_response(RET_OK);
break;
case SC_VALERR_WARNING:
xBox->set_default_response(RET_CANCEL);
break;
default:
{
// added to avoid warnings
}
break;
}
ScopedVclPtrInstance< MessBox > aBox( pParent, nStyle, 0, aTitle, aMessage );
sal_uInt16 nRet = aBox->Execute();
short nRet = xBox->run();
return ( eErrorStyle == SC_VALERR_STOP || nRet == RET_CANCEL );
}
......
......@@ -2670,7 +2670,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
else
pParent = Application::GetDefDialogParent();
if ( pData->DoError( pParent, aString, aCursorPos ) )
if (pData->DoError(pParent ? pParent->GetFrameWeld() : nullptr, aString, aCursorPos))
bForget = true; // Do not take over input
}
}
......
......@@ -18,7 +18,6 @@
*/
#include <sfx2/app.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/weld.hxx>
#include <vcl/waitobj.hxx>
#include <svx/dataaccessdescriptor.hxx>
......@@ -1008,14 +1007,17 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
bool bOk = true;
if (rParam.bReplace)
{
if (rDoc.TestRemoveSubTotals( nTab, rParam ))
{
bOk = ScopedVclPtrInstance<MessBox>( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
// "StarCalc" "Delete Data?"
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) )->Execute()
== RET_YES;
vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
VclMessageType::Question,
VclButtonsType::YesNo, ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_1))); // "Delete Data?"
xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
bOk = xBox->run() == RET_YES;
}
}
if (bOk)
{
......
......@@ -20,7 +20,6 @@
#include <scitems.hxx>
#include <sfx2/app.hxx>
#include <sfx2/bindings.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/weld.hxx>
#include <com/sun/star/sdbc/XResultSet.hpp>
......@@ -339,10 +338,13 @@ void ScDBFunc::ToggleAutoFilter()
{
if (!bHeader)
{
if ( ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), // "StarCalc"
ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) // header from first row?
)->Execute() == RET_YES )
vcl::Window* pWin = GetViewData().GetDialogParent();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
VclMessageType::Question,
VclButtonsType::YesNo, ScGlobal::GetRscString(STR_MSSG_MAKEAUTOFILTER_0))); // header from first row?
xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
xBox->set_default_response(RET_YES);
if (xBox->run() == RET_YES)
{
pDBData->SetHeader( true ); //! Undo ??
}
......
......@@ -21,8 +21,8 @@
#include <scitems.hxx>
#include <sfx2/bindings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/weld.hxx>
#include <svl/zforlist.hxx>
#include <sfx2/app.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
......@@ -418,14 +418,18 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord,
WaitObject aWait( GetViewData().GetDialogParent() );
bool bOk = true;
if (rParam.bReplace)
{
if (rDoc.TestRemoveSubTotals( nTab, rParam ))
{
bOk = ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
// "StarCalc" "delete data?"
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) )->Execute()
== RET_YES;
vcl::Window* pWin = GetViewData().GetDialogParent();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
VclMessageType::Question, VclButtonsType::YesNo,
ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_1))); // "delete data?"
xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0)); // "StarCalc"
xBox->set_default_response(RET_YES);
bOk = xBox->run() == RET_YES;
}
}
if (bOk)
{
......
......@@ -29,7 +29,6 @@
#include <sfx2/viewfrm.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/weld.hxx>
#include <spelldialog.hxx>
......@@ -307,10 +306,13 @@ bool ScSpellingEngine::ShowTableWrapDialog()
{
vcl::Window* pParent = GetDialogParent();
ScWaitCursorOff aWaitOff( pParent );
ScopedVclPtrInstance<MessBox> aMsgBox( pParent, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
ScGlobal::GetRscString( STR_SPELLING_BEGIN_TAB) );
return aMsgBox->Execute() == RET_YES;
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
VclMessageType::Question, VclButtonsType::YesNo,
ScGlobal::GetRscString(STR_SPELLING_BEGIN_TAB))); // "delete data?"
xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0));
xBox->set_default_response(RET_YES);
return xBox->run() == RET_YES;
}
void ScSpellingEngine::ShowFinishDialog()
......
......@@ -35,7 +35,8 @@
#include <svl/zforlist.hxx>
#include <svx/srchdlg.hxx>
#include <svx/svdview.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <vcl/waitobj.hxx>
#include <basic/sbstar.hxx>
......@@ -2058,12 +2059,12 @@ void ScViewFunc::Solve( const ScSolveParam& rParam )
aMsgStr += ScGlobal::GetRscString( STR_MSSG_SOLVE_4 );
}
ScopedVclPtrInstance<MessBox> aBox( GetViewData().GetDialogParent(),
MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, 0,
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), aMsgStr );
sal_uInt16 nRetVal = aBox->Execute();
if ( RET_YES == nRetVal )
vcl::Window* pWin = GetViewData().GetDialogParent();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
VclMessageType::Question, VclButtonsType::YesNo, aMsgStr));
xBox->set_title(ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_0));
xBox->set_default_response(RET_NO);
if (xBox->run() == RET_NO)
EnterValue( nDestCol, nDestRow, nDestTab, nSolveResult );
GetViewData().GetViewShell()->UpdateInputHandler( true );
......
......@@ -2692,10 +2692,11 @@ ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter,
{
break;
}
ScopedVclPtrInstance<MessBox>(Application::GetDefDialogParent(),
MessBoxStyle::Ok, 0, "Password length",
"The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes."
)->Execute();
vcl::Window* pWin = Application::GetDefDialogParent();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, VclMessageType::Warning,
VclButtonsType::Ok, SfxResId(STR_PASSWORD_LEN)));
xBox->set_secondary_text(SfxResId(STR_PASSWORD_WARNING));
xBox->run();
}
while (true);
if ( pPasswordRequest->isPassword() )
......
......@@ -194,6 +194,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
sw/uiconfig/swriter/ui/querycontinuebegindialog \
sw/uiconfig/swriter/ui/querycontinueenddialog \
sw/uiconfig/swriter/ui/querydefaultcompatdialog \
sw/uiconfig/swriter/ui/queryredlinedialog \
sw/uiconfig/swriter/ui/queryrotateintostandarddialog \
sw/uiconfig/swriter/ui/querysavelabeldialog \
sw/uiconfig/swriter/ui/queryshowchangesdialog \
......
......@@ -99,10 +99,6 @@
// More Help-IDs
#define HID_EDIT_FORMULA "SW_HID_EDIT_FORMULA"
#define HID_AUTOFORMAT_REJECT "SW_HID_AUTOFORMAT_REJECT"
#define HID_AUTOFORMAT_ACCEPT "SW_HID_AUTOFORMAT_ACCEPT"
#define HID_AUTOFORMAT_EDIT_CHG "SW_HID_AUTOFORMAT_EDIT_CHG"
#define HID_AUTH_FIELD_IDENTIFIER "SW_HID_AUTH_FIELD_IDENTIFIER"
#define HID_AUTH_FIELD_AUTHORITY_TYPE "SW_HID_AUTH_FIELD_AUTHORITY_TYPE"
#define HID_AUTH_FIELD_ADDRESS "SW_HID_AUTH_FIELD_ADDRESS"
......
......@@ -1206,11 +1206,6 @@
#define STR_REDLINE_FORMATED NC_("STR_REDLINE_FORMATED", "Formats")
#define STR_REDLINE_TABLECHG NC_("STR_REDLINE_TABLECHG", "Table Changes")
#define STR_REDLINE_FMTCOLLSET NC_("STR_REDLINE_FMTCOLLSET", "Applied Paragraph Styles")
#define STR_REDLINE_TITLE NC_("STR_REDLINE_TITLE", "AutoCorrect")
#define STR_REDLINE_MSG NC_("STR_REDLINE_MSG", "AutoCorrect completed.\nYou can accept or reject all changes,\nor accept or reject particular changes.")
#define STR_REDLINE_ACCEPT_ALL NC_("STR_REDLINE_ACCEPT_ALL", "Accept All")
#define STR_REDLINE_REJECT_ALL NC_("STR_REDLINE_REJECT_ALL", "Reject All")
#define STR_REDLINE_EDIT NC_("STR_REDLINE_EDIT", "Edit Changes")
#define STR_PAGE NC_("STR_PAGE", "Page ")
#define STR_PAGE_COUNT NC_("STR_PAGE_COUNT", "Page %1 of %2")
#define STR_PAGE_COUNT_CUSTOM NC_("STR_PAGE_COUNT_CUSTOM", "Page %1 of %2 (Page %3)")
......
......@@ -38,7 +38,9 @@
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/objitem.hxx>
#include <vcl/svapp.hxx>
#include <vcl/unohelp2.hxx>
#include <vcl/weld.hxx>
#include <sfx2/request.hxx>
#include <svl/eitem.hxx>
#include <svl/macitem.hxx>
......@@ -273,25 +275,11 @@ static void sw_CharDialogResult(const SfxItemSet* pSet, SwWrtShell &rWrtSh, std:
}
static short lcl_AskRedlineFlags(vcl::Window *pWin)
static short lcl_AskRedlineFlags(weld::Window *pWin)
{
ScopedVclPtrInstance<MessBox> aQBox( pWin, MessBoxStyle::NONE, 0,
SwResId( STR_REDLINE_TITLE ),
SwResId( STR_REDLINE_MSG ) );
aQBox->SetImage(GetStandardQueryBoxImage());
const ButtonDialogFlags nBtnFlags = ButtonDialogFlags::Default |
ButtonDialogFlags::OK |
ButtonDialogFlags::Focus;
aQBox->AddButton(SwResId(STR_REDLINE_ACCEPT_ALL), RET_OK, nBtnFlags);
aQBox->GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
aQBox->AddButton(SwResId(STR_REDLINE_REJECT_ALL), RET_CANCEL, ButtonDialogFlags::Cancel);
aQBox->GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
aQBox->AddButton(SwResId(STR_REDLINE_EDIT), 2);
aQBox->GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
aQBox->SetButtonHelpText( RET_OK, OUString() );
return aQBox->Execute();
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin, "modules/swriter/ui/queryredlinedialog.ui"));
std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryRedlineDialog"));
return xQBox->run();
}
static void sw_ParagraphDialogResult(SfxItemSet* pSet, SwWrtShell &rWrtSh, SfxRequest& rReq, SwPaM* pPaM)
......@@ -741,7 +729,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
ScopedVclPtr<AbstractSwModalRedlineAcceptDlg> pDlg(pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin()));
OSL_ENSURE(pDlg, "Dialog creation failed!");
switch (lcl_AskRedlineFlags(&GetView().GetEditWin()))
switch (lcl_AskRedlineFlags(GetView().GetEditWin().GetFrameWeld()))
{
case RET_OK:
{
......
......@@ -406,8 +406,10 @@ void SwView::HyphenateDocument()
// do not hyphenate if interactive hyphenation is active elsewhere
if (SwEditShell::HasHyphIter())
{
ScopedVclPtrInstance<MessBox>( nullptr, MessBoxStyle::Ok, 0, SwResId( STR_HYPH_TITLE ),
SwResId( STR_MULT_INTERACT_HYPH_WARN ) )->Execute();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, VclMessageType::Warning,
VclButtonsType::Ok, SwResId(STR_MULT_INTERACT_HYPH_WARN)));
xBox->set_title(SwResId(STR_HYPH_TITLE));
xBox->run();
return;
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<interface domain="sw">
<requires lib="gtk+" version="3.0"/>
<object class="GtkMessageDialog" id="QueryRedlineDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">Delete this theme?</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="message_type">question</property>
<property name="text" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">AutoCorrect completed.</property>
<property name="secondary_text" translatable="yes" context="queryredlinedialog|QueryRedlineDialog">You can accept or reject all changes,
or accept or reject particular changes.</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label" translatable="yes" context="queryredlinedialog|cancel">Reject All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label" translatable="yes" context="queryredlinedialog|ok">Accept All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="edit">
<property name="label" translatable="yes" context="queryredlinedialog|edit">Edit Changes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="2">edit</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
......@@ -63,13 +63,13 @@
#include <osl/conditn.hxx>
#include <unotools/resmgr.hxx>
#include <vcl/errinf.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <osl/thread.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/documentconstants.hxx>
#include <comphelper/propertysequence.hxx>
#include <svtools/sfxecode.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <unotools/configmgr.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
......@@ -965,36 +965,35 @@ namespace {
DialogMask
executeMessageBox(
vcl::Window * pParent,
weld::Window * pParent,
OUString const & rTitle,
OUString const & rMessage,
MessBoxStyle nButtonMask)
VclMessageType eMessageType)
{
SolarMutexGuard aGuard;
WinBits nStyle(0);
ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, nStyle, rTitle, rMessage);
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, eMessageType,
eMessageType == VclMessageType::Question ? VclButtonsType::YesNo : VclButtonsType::Ok, rMessage));
xBox->set_title(rTitle);
sal_uInt16 aMessResult = xBox->Execute();
short nMessResult = xBox->run();
DialogMask aResult = DialogMask::NONE;
switch( aMessResult )
switch (nMessResult)
{
case RET_OK:
aResult = DialogMask::ButtonsOk;
break;
case RET_CANCEL:
aResult = DialogMask::ButtonsCancel;
break;
case RET_YES:
aResult = DialogMask::ButtonsYes;
break;
case RET_NO:
aResult = DialogMask::ButtonsNo;
break;
case RET_RETRY:
aResult = DialogMask::ButtonsRetry;
break;
default: assert(false);
case RET_OK:
aResult = DialogMask::ButtonsOk;
break;
case RET_CANCEL:
aResult = DialogMask::ButtonsCancel;
break;
case RET_YES:
aResult = DialogMask::ButtonsYes;
break;
case RET_NO:
aResult = DialogMask::ButtonsNo;
break;
default:
assert(false);
}
return aResult;
......@@ -1117,7 +1116,8 @@ UUIInteractionHelper::handleGenericErrorRequest(
aTitle += " - " ;
aTitle += aErrTitle;
executeMessageBox(getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok);
vcl::Window* pWin = getParentProperty();
executeMessageBox(pWin ? pWin->GetFrameWeld() : nullptr, aTitle, aErrorString, VclMessageType::Error);
}
else
{
......@@ -1218,15 +1218,11 @@ UUIInteractionHelper::handleBrokenPackageRequest(
return;
}
MessBoxStyle nButtonMask;
VclMessageType eMessageType;
if( xApprove.is() && xDisapprove.is() )
{
nButtonMask = MessBoxStyle::YesNo | MessBoxStyle::DefaultYes;
}
eMessageType = VclMessageType::Question;
else if ( xAbort.is() )
{
nButtonMask = MessBoxStyle::Ok;
}
eMessageType = VclMessageType::Warning;
else
return;
......@@ -1235,7 +1231,8 @@ UUIInteractionHelper::handleBrokenPackageRequest(
" " +
utl::ConfigManager::getProductVersion() );
switch (executeMessageBox(getParentProperty(), title, aMessage, nButtonMask))
vcl::Window* pWin = getParentProperty();
switch (executeMessageBox(pWin ? pWin->GetFrameWeld() : nullptr, title, aMessage, eMessageType))
{
case DialogMask::ButtonsOk:
OSL_ENSURE( xAbort.is(), "unexpected situation" );
......
......@@ -23,6 +23,7 @@
#include <vcl/dialog.hxx>
#include <unotools/securityoptions.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <com/sun/star/uno/Sequence.hxx>
namespace com {
......
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