mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 21:58:32 +01:00
Qt,Qt5: fixed html text escaping - message boxes should be plain text. issue #37805
git-svn-id: trunk@63918 -
This commit is contained in:
parent
4c4761c72e
commit
5d132a7330
@ -1811,9 +1811,11 @@ type
|
||||
function getDetailText: WideString;
|
||||
function getMessageStr: WideString;
|
||||
function getMsgBoxType: QMessageBoxIcon;
|
||||
function GetTextFormat: QtTextFormat;
|
||||
procedure setDetailText(const AValue: WideString);
|
||||
procedure setMessageStr(const AValue: WideString);
|
||||
procedure setMsgBoxType(const AValue: QMessageBoxIcon);
|
||||
procedure SetTextFormat(AValue: QtTextFormat);
|
||||
procedure setTitle(const AValue: WideString);
|
||||
protected
|
||||
function CreateWidget(AParent: QWidgetH):QWidgetH; overload;
|
||||
@ -1834,6 +1836,7 @@ type
|
||||
property MessageStr: WideString read getMessageStr write setMessageStr;
|
||||
property MsgBoxType:QMessageBoxIcon read getMsgBoxType write setMsgBoxType;
|
||||
property Title: WideString read FTitle write setTitle;
|
||||
property TextFormat: QtTextFormat read GetTextFormat write SetTextFormat;
|
||||
end;
|
||||
|
||||
{ TQtCalendar }
|
||||
@ -19535,6 +19538,11 @@ begin
|
||||
Result := QMessageBox_icon(QMessageBoxH(Widget));
|
||||
end;
|
||||
|
||||
function TQtMessageBox.GetTextFormat: QtTextFormat;
|
||||
begin
|
||||
Result := QMessageBox_textFormat(QMessageBoxH(Widget));
|
||||
end;
|
||||
|
||||
procedure TQtMessageBox.setDetailText(const AValue: WideString);
|
||||
var
|
||||
Str: WideString;
|
||||
@ -19572,6 +19580,11 @@ begin
|
||||
QMessageBox_setIcon(QMessageBoxH(Widget), AValue);
|
||||
end;
|
||||
|
||||
procedure TQtMessageBox.SetTextFormat(AValue: QtTextFormat);
|
||||
begin
|
||||
QMessageBox_setTextFormat(QMessageBoxH(Widget), AValue);
|
||||
end;
|
||||
|
||||
procedure TQtMessageBox.setTitle(const AValue: WideString);
|
||||
begin
|
||||
if AValue <> FTitle then
|
||||
@ -19604,6 +19617,7 @@ begin
|
||||
AParent := QApplication_activeWindow;
|
||||
{$ENDIF}
|
||||
Widget := CreateWidget(AParent);
|
||||
TextFormat := QtPlainText;
|
||||
setProperty(Widget, 'lclwidget', Int64(PtrUInt(Self)));
|
||||
QtWidgetSet.AddHandle(Self);
|
||||
end;
|
||||
|
||||
@ -1818,9 +1818,11 @@ type
|
||||
function getDetailText: WideString;
|
||||
function getMessageStr: WideString;
|
||||
function getMsgBoxType: QMessageBoxIcon;
|
||||
function GetTextFormat: QtTextFormat;
|
||||
procedure setDetailText(const AValue: WideString);
|
||||
procedure setMessageStr(const AValue: WideString);
|
||||
procedure setMsgBoxType(const AValue: QMessageBoxIcon);
|
||||
procedure SetTextFormat(AValue: QtTextFormat);
|
||||
procedure setTitle(const AValue: WideString);
|
||||
protected
|
||||
function CreateWidget(AParent: QWidgetH):QWidgetH; overload;
|
||||
@ -1841,6 +1843,7 @@ type
|
||||
property MessageStr: WideString read getMessageStr write setMessageStr;
|
||||
property MsgBoxType:QMessageBoxIcon read getMsgBoxType write setMsgBoxType;
|
||||
property Title: WideString read FTitle write setTitle;
|
||||
property TextFormat: QtTextFormat read GetTextFormat write SetTextFormat;
|
||||
end;
|
||||
|
||||
{ TQtCalendar }
|
||||
@ -19573,6 +19576,11 @@ begin
|
||||
Result := QMessageBox_icon(QMessageBoxH(Widget));
|
||||
end;
|
||||
|
||||
function TQtMessageBox.GetTextFormat: QtTextFormat;
|
||||
begin
|
||||
Result := QMessageBox_textFormat(QMessageBoxH(Widget));
|
||||
end;
|
||||
|
||||
procedure TQtMessageBox.setDetailText(const AValue: WideString);
|
||||
var
|
||||
Str: WideString;
|
||||
@ -19610,6 +19618,11 @@ begin
|
||||
QMessageBox_setIcon(QMessageBoxH(Widget), AValue);
|
||||
end;
|
||||
|
||||
procedure TQtMessageBox.SetTextFormat(AValue: QtTextFormat);
|
||||
begin
|
||||
QMessageBox_setTextFormat(QMessageBoxH(Widget), AValue);
|
||||
end;
|
||||
|
||||
procedure TQtMessageBox.setTitle(const AValue: WideString);
|
||||
begin
|
||||
if AValue <> FTitle then
|
||||
@ -19642,6 +19655,7 @@ begin
|
||||
AParent := QApplication_activeWindow;
|
||||
{$ENDIF}
|
||||
Widget := CreateWidget(AParent);
|
||||
TextFormat := QtPlainText;
|
||||
setProperty(Widget, 'lclwidget', Int64(PtrUInt(Self)));
|
||||
QtWidgetSet.AddHandle(Self);
|
||||
end;
|
||||
|
||||
@ -5202,6 +5202,7 @@ var
|
||||
//OkStr: WideString;
|
||||
AParent: QWidgetH;
|
||||
DialogType, DefButton, DefIcon : Cardinal;
|
||||
AQtString: QStringH;
|
||||
begin
|
||||
Result := 0;
|
||||
Str := GetUtf8String(lpText);
|
||||
@ -5214,6 +5215,12 @@ begin
|
||||
DefButton:= ((uType and $00000300) shr 8) + 1;
|
||||
DialogType:= (uType and $0000000F);
|
||||
DefIcon := (uType and $000000FF) shr 4;
|
||||
|
||||
//issue #37805 - we must show plain text.
|
||||
AQtString := QString_Create(PWideString(@Str));
|
||||
QString_toHtmlEscaped(AQtString, @Str);
|
||||
QString_destroy(AQtString);
|
||||
|
||||
case IconToMessageType(DefIcon) of
|
||||
QMessageBoxInformation: Result := QMessageBox_information(AParent, @TitleStr, @Str, ButtonToQtButtons(DialogType), ButtonToQtDefButton(DialogType, DefButton));
|
||||
QMessageBoxQuestion: Result := QMessageBox_question(AParent, @TitleStr, @Str, ButtonToQtButtons(DialogType), ButtonToQtDefButton(DialogType, DefButton));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user