mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 10:02:10 +08:00
Issue #411: append search engine's hostname to "Find help" link in error dialogs, now that it's customizable
This commit is contained in:
@ -2458,7 +2458,7 @@ var
|
|||||||
rx: TRegExpr;
|
rx: TRegExpr;
|
||||||
KeepAskingValue: Boolean;
|
KeepAskingValue: Boolean;
|
||||||
Hotkeys: String;
|
Hotkeys: String;
|
||||||
WebSearchUrl: String;
|
WebSearchUrl, WebSearchHost: String;
|
||||||
|
|
||||||
procedure AddButton(BtnCaption: String; BtnResult: TModalResult);
|
procedure AddButton(BtnCaption: String; BtnResult: TModalResult);
|
||||||
var
|
var
|
||||||
@ -2501,7 +2501,7 @@ begin
|
|||||||
if Assigned(MainForm) and (MainForm.ActiveConnection <> nil) then
|
if Assigned(MainForm) and (MainForm.ActiveConnection <> nil) then
|
||||||
Dialog.Caption := MainForm.ActiveConnection.Parameters.SessionName + ': ' + Dialog.Caption;
|
Dialog.Caption := MainForm.ActiveConnection.Parameters.SessionName + ': ' + Dialog.Caption;
|
||||||
rx := TRegExpr.Create;
|
rx := TRegExpr.Create;
|
||||||
rx.Expression := 'https?\:\/\/\S+';
|
rx.Expression := 'https?://\S+';
|
||||||
Dialog.Text := rx.Replace(Msg, '<a href="$0">$0</a>', True);
|
Dialog.Text := rx.Replace(Msg, '<a href="$0">$0</a>', True);
|
||||||
rx.Free;
|
rx.Free;
|
||||||
|
|
||||||
@ -2513,7 +2513,14 @@ begin
|
|||||||
Dialog.MainIcon := tdiError;
|
Dialog.MainIcon := tdiError;
|
||||||
WebSearchUrl := AppSettings.ReadString(asWebSearchBaseUrl);
|
WebSearchUrl := AppSettings.ReadString(asWebSearchBaseUrl);
|
||||||
WebSearchUrl := StringReplace(WebSearchUrl, '%q', EncodeURLParam(Copy(Msg, 1, 1000)), []);
|
WebSearchUrl := StringReplace(WebSearchUrl, '%q', EncodeURLParam(Copy(Msg, 1, 1000)), []);
|
||||||
Dialog.FooterText := '<a href="'+WebSearchUrl+'">'+_('Find some help on this error')+'</a>';
|
rx := TRegExpr.Create;
|
||||||
|
rx.Expression := 'https?://(www\.)?([^/]+)/';
|
||||||
|
if rx.Exec(WebSearchUrl) then
|
||||||
|
WebSearchHost := rx.Match[2]
|
||||||
|
else
|
||||||
|
WebSearchHost := '[unknown host]';
|
||||||
|
rx.Free;
|
||||||
|
Dialog.FooterText := '<a href="'+WebSearchUrl+'">'+_('Find some help on this error')+' (=> '+WebSearchHost+')</a>';
|
||||||
Dialog.FooterIcon := tdiInformation;
|
Dialog.FooterIcon := tdiInformation;
|
||||||
end;
|
end;
|
||||||
mtInformation:
|
mtInformation:
|
||||||
|
Reference in New Issue
Block a user