Skip to content
Permalink
Browse files

Add preference option for custom web search url, used in error dialogs.

Closes #411
  • Loading branch information...
ansgarbecker committed Apr 17, 2019
1 parent 2a37a94 commit 4608390b967797c5e9f39d79aceb6bc7a3133ef4
Showing with 44 additions and 3 deletions.
  1. +7 −1 out/locale/en/LC_MESSAGES/default.po
  2. +6 −2 source/apphelpers.pas
  3. +27 −0 source/options.dfm
  4. +4 −0 source/options.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-04-17 08:21+0200\n"
"PO-Revision-Date: 2019-04-17 21:27+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@@ -6313,6 +6313,12 @@ msgstr "Style Theme: *"
msgid "Icon pack:"
msgstr "Icon pack:"

msgid "Web search base url:"
msgstr "Web search base url:"

msgid "Used in footer of various message dialogs"
msgstr "Used in footer of various message dialogs"

msgid "You should restart %s to apply changed critical settings, and to prevent unexpected behaviour."
msgstr "You should restart %s to apply changed critical settings, and to prevent unexpected behaviour."

@@ -171,7 +171,7 @@ TQueryThread = class(TThread)
asPromptSaveFileOnTabClose, asRestoreTabs, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme, asIconPack,
asTheme, asIconPack, asWebSearchBaseUrl,
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asLogScript, asFieldColorNumeric,
asFieldColorReal, asFieldColorText, asFieldColorBinary, asFieldColorDatetime, asFieldColorSpatial,
@@ -2456,6 +2456,7 @@ function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons:
rx: TRegExpr;
KeepAskingValue: Boolean;
Hotkeys: String;
WebSearchUrl: String;

procedure AddButton(BtnCaption: String; BtnResult: TModalResult);
var
@@ -2508,7 +2509,9 @@ function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons:
Dialog.MainIcon := tdiWarning;
mtError: begin
Dialog.MainIcon := tdiError;
Dialog.FooterText := '<a href="http://www.google.com/search?q='+EncodeURLParam(Copy(Msg, 1, 1000))+'">'+_('Find some help on this error')+'</a>';
WebSearchUrl := AppSettings.ReadString(asWebSearchBaseUrl);
WebSearchUrl := StringReplace(WebSearchUrl, '%q', EncodeURLParam(Copy(Msg, 1, 1000)), []);
Dialog.FooterText := '<a href="'+WebSearchUrl+'">'+_('Find some help on this error')+'</a>';
Dialog.FooterIcon := tdiInformation;
end;
mtInformation:
@@ -3656,6 +3659,7 @@ constructor TAppSettings.Create;
InitSetting(asGUIFontSize, 'GUIFontSize', 8);
InitSetting(asTheme, 'Theme', 0, False, 'Windows');
InitSetting(asIconPack, 'IconPack', 0, False, 'Icons8');
InitSetting(asWebSearchBaseUrl, 'WebSearchBaseUrl', 0, False, 'https://www.ecosia.org/search?q=%query');
InitSetting(asMaxQueryResults, 'MaxQueryResults', 10);
InitSetting(asLogErrors, 'LogErrors', 0, True);
InitSetting(asLogUserSQL, 'LogUserSQL', 0, True);
@@ -97,6 +97,14 @@ object optionsform: Toptionsform
Height = 13
Caption = 'Icon pack:'
end
object lblWebSearchBaseUrl: TLabel
Left = 8
Top = 339
Width = 102
Height = 13
Hint = 'Used in footer of various message dialogs'
Caption = 'Web search base url:'
end
object chkAutoReconnect: TCheckBox
Left = 190
Top = 31
@@ -306,6 +314,25 @@ object optionsform: Toptionsform
TabOrder = 17
OnChange = Modified
end
object comboWebSearchBaseUrl: TComboBox
Left = 190
Top = 336
Width = 505
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 18
Text = 'comboWebSearchBaseUrl'
OnChange = Modified
Items.Strings = (
'https://www.ecosia.org/search?q=%query'
'https://www.startpage.com/do/search?query=%query'
'https://duckduckgo.com/?q=%query'
'https://www.baidu.com/s?wd=%query'
'https://www.searchencrypt.com/search?q=%query'
'https://yandex.com/search/?text=%query'
'https://www.bing.com/search?q=%query'
'https://www.google.com/search?q=%query')
end
end
end
object tabLogging: TTabSheet
@@ -172,6 +172,8 @@ Toptionsform = class(TFormWithSizeGrip)
chkAskFileSave: TCheckBox;
chkRestoreTabs: TCheckBox;
chkLogEventScript: TCheckBox;
lblWebSearchBaseUrl: TLabel;
comboWebSearchBaseUrl: TComboBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@@ -342,6 +344,7 @@ procedure Toptionsform.Apply(Sender: TObject);
AppSettings.WriteInt(asGUIFontSize, updownGUIFontSize.Position);
AppSettings.WriteString(asTheme, comboTheme.Text);
AppSettings.WriteString(asIconPack, comboIconPack.Text);
AppSettings.WriteString(asWebSearchBaseUrl, comboWebSearchBaseUrl.Text);

AppSettings.WriteInt(asMaxQueryResults, updownMaxQueryResults.Position);
// Save color settings
@@ -652,6 +655,7 @@ procedure Toptionsform.FormShow(Sender: TObject);
comboGUIFont.OnChange(comboGUIFont);
comboTheme.ItemIndex := comboTheme.Items.IndexOf(AppSettings.ReadString(asTheme));
comboIconPack.ItemIndex := comboIconPack.Items.IndexOf(AppSettings.ReadString(asIconPack));
comboWebSearchBaseUrl.Text := AppSettings.ReadString(asWebSearchBaseUrl);
chkQueryWarningsMessage.Checked := AppSettings.ReadBool(asQueryWarningsMessage);

// Logging

0 comments on commit 4608390

Please sign in to comment.
You can’t perform that action at this time.