Permalink
Browse files

Add "Keep showing" checkbox to dialog showing MySQL warnings, so the …

…user can disable that. Also adding an option in preferences dialog to reactivate it again. Closes #234
  • Loading branch information...
ansgarbecker committed Apr 19, 2018
1 parent dbd0178 commit 774830cad0bd6d869608eadacfaf8f1776dc31cd
Showing with 55 additions and 28 deletions.
  1. +4 −1 out/locale/en/LC_MESSAGES/default.po
  2. +7 −3 source/apphelpers.pas
  3. +2 −2 source/main.pas
  4. +39 −22 source/options.dfm
  5. +3 −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: 2018-04-15 14:45+0200\n"
"PO-Revision-Date: 2018-04-19 07:33+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"
@@ -5692,6 +5692,9 @@ msgstr "Missing \"No\" button in %() call"
msgid "Keep asking this question."
msgstr "Keep asking this question."
msgid "Keep showing this dialog."
msgstr "Keep showing this dialog."
#. Table editor
msgid "Foreign column count does not match source column count."
msgstr "Foreign column count does not match source column count."
@@ -167,7 +167,7 @@ TQueryThread = class(TThread)
asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect,
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
asLastUsageStatisticCall, asWheelZoom, asDisplayBars, asBarColor, asMySQLBinaries, asCustomSnippetsDirectory,
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates,
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
@@ -2491,11 +2491,14 @@ function MessageDialog(const Title, Msg: string; DlgType: TMsgDlgType; Buttons:
// Checkbox, s'il vous plait?
KeepAskingValue := True;
if KeepAskingSetting <> asUnused then begin
if not (mbNo in Buttons) then
if (not (mbNo in Buttons)) and (Buttons <> [mbOK]) then
raise Exception.CreateFmt(_('Missing "No" button in %() call'), ['MessageDialog']);
KeepAskingValue := AppSettings.ReadBool(KeepAskingSetting);
Dialog.Flags := Dialog.Flags + [tfVerificationFlagChecked];
Dialog.VerificationText := _('Keep asking this question.');
if Buttons = [mbOK] then
Dialog.VerificationText := _('Keep showing this dialog.')
else
Dialog.VerificationText := _('Keep asking this question.');
end;
// Supress dialog and assume "No" if user disabled this dialog
@@ -3502,6 +3505,7 @@ constructor TAppSettings.Create;
InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory);
InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True);
InitSetting(asWarnUnsafeUpdates, 'WarnUnsafeUpdates', 0, True);
InitSetting(asQueryWarningsMessage, 'QueryWarningsMessage', 0, True);
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
InitSetting(asCompletionProposalWidth, 'CompletionProposalWidth', 350);
InitSetting(asCompletionProposalNbLinesInWindow,'CompletionProposalNbLinesInWindow', 12);
@@ -2880,13 +2880,13 @@ procedure TMainForm.FinishedQueryExecution(Thread: TQueryThread);
end;
MsgText := Trim(MsgText);
if (Warnings.RecordCount = Thread.WarningCount) or (Warnings.RecordCount < 5) then
MessageDialog(MsgTitle, MsgText, mtWarning, [mbOk])
MessageDialog(MsgTitle, MsgText, mtWarning, [mbOk], asQueryWarningsMessage)
else begin
MsgText := MsgText + CRLF+CRLF + _('Show all warnings in a new query tab?');
MaxWarnings := MakeInt(Thread.Connection.GetVar('SELECT @@max_error_count'));
if MaxWarnings < Thread.WarningCount then
MsgText := MsgText + CRLF+CRLF+ f_('The server variable %s is currently set to %d, so you won''t see all warnings.', ['@@max_error_count', MaxWarnings]);
if MessageDialog(MsgTitle, MsgText, mtWarning, [mbYes, mbNo]) = mrYes then begin
if MessageDialog(MsgTitle, MsgText, mtWarning, [mbYes, mbNo], asQueryWarningsMessage) = mrYes then begin
actNewQueryTab.Execute;
WarningsTab := QueryTabs[QueryTabs.Count-1];
WarningsTab.Memo.Text := 'SHOW WARNINGS';
@@ -493,7 +493,7 @@ object optionsform: Toptionsform
object lblSQLFontSize: TLabel
Left = 689
Top = 11
Width = 12
Width = 10
Height = 13
Anchors = [akTop, akRight]
Caption = 'pt'
@@ -514,22 +514,22 @@ object optionsform: Toptionsform
end
object lblSQLColElement: TLabel
Left = 8
Top = 158
Top = 165
Width = 42
Height = 13
Caption = 'Element:'
end
object lblSQLColBackground: TLabel
Left = 489
Top = 184
Top = 191
Width = 60
Height = 13
Anchors = [akTop, akRight]
Caption = 'Background:'
end
object lblSQLColForeground: TLabel
Left = 489
Top = 158
Top = 165
Width = 60
Height = 13
Anchors = [akTop, akRight]
@@ -621,7 +621,7 @@ object optionsform: Toptionsform
Top = 61
Width = 41
Height = 21
TabOrder = 8
TabOrder = 9
Text = '1'
OnChange = Modified
end
@@ -633,64 +633,64 @@ object optionsform: Toptionsform
Associate = editMaxQueryResults
Min = 1
Position = 1
TabOrder = 9
TabOrder = 10
OnChanging = anyUpDownLimitChanging
end
object comboSQLColElement: TComboBox
Left = 67
Top = 155
Top = 162
Width = 407
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
TabOrder = 10
TabOrder = 11
OnChange = comboSQLColElementChange
end
object chkSQLBold: TCheckBox
Left = 67
Top = 182
Top = 189
Width = 130
Height = 17
Caption = 'Bold'
TabOrder = 11
TabOrder = 12
OnClick = SQLFontChange
end
object chkSQLItalic: TCheckBox
Left = 203
Top = 182
Top = 189
Width = 271
Height = 17
Anchors = [akLeft, akTop, akRight]
Caption = 'Italic'
TabOrder = 12
TabOrder = 13
OnClick = SQLFontChange
end
object cboxSQLColForeground: TColorBox
Left = 583
Top = 155
Top = 162
Width = 118
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
Anchors = [akTop, akRight]
TabOrder = 13
TabOrder = 14
OnChange = SQLFontChange
end
object cboxSQLColBackground: TColorBox
Left = 583
Top = 181
Top = 188
Width = 118
Height = 22
Style = [cbStandardColors, cbExtendedColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors]
Anchors = [akTop, akRight]
TabOrder = 14
TabOrder = 15
OnChange = SQLFontChange
end
object SynMemoSQLSample: TSynMemo
AlignWithMargins = True
Left = 8
Top = 208
Top = 215
Width = 693
Height = 133
Height = 132
Cursor = crHandPoint
SingleLineMode = False
Anchors = [akLeft, akTop, akRight, akBottom]
@@ -699,8 +699,16 @@ object optionsform: Toptionsform
Font.Height = -13
Font.Name = 'Courier New'
Font.Style = []
TabOrder = 15
TabOrder = 16
OnClick = SynMemoSQLSampleClick
CodeFolding.GutterShapeSize = 11
CodeFolding.CollapsedLineColor = clGrayText
CodeFolding.FolderBarLinesColor = clGrayText
CodeFolding.IndentGuidesColor = clGray
CodeFolding.IndentGuides = True
CodeFolding.ShowCollapsedLine = False
CodeFolding.ShowHintMark = True
UseCodeFolding = False
Gutter.Font.Charset = DEFAULT_CHARSET
Gutter.Font.Color = clWindowText
Gutter.Font.Height = -11
@@ -719,6 +727,15 @@ object optionsform: Toptionsform
OnChange = SQLFontChange
FontSmoothing = fsmNone
end
object chkQueryWarningsMessage: TCheckBox
Left = 8
Top = 136
Width = 691
Height = 17
Caption = 'Show query warnings dialog'
TabOrder = 8
OnClick = Modified
end
end
object tabGridFormatting: TTabSheet
Caption = 'Grid formatting'
@@ -1069,15 +1086,15 @@ object optionsform: Toptionsform
Left = 306
Top = 64
Width = 45
Height = 13
Height = 12
Anchors = [akLeft, akTop, akBottom]
Caption = 'Shortcut:'
end
object lblShortcutHint: TLabel
Left = 306
Top = 3
Width = 279
Height = 55
Height = 54
Anchors = [akLeft, akTop, akBottom]
AutoSize = False
Caption = 'Please select a shortcut item in the tree.'
@@ -1087,7 +1104,7 @@ object optionsform: Toptionsform
Left = 306
Top = 107
Width = 98
Height = 13
Height = 12
Anchors = [akLeft, akTop, akBottom]
Caption = 'Secondary shortcut:'
end
@@ -142,6 +142,7 @@ Toptionsform = class(TForm)
Label3: TLabel;
cboxRowHighlightSameText: TColorBox;
chkWheelZoom: TCheckBox;
chkQueryWarningsMessage: TCheckBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@@ -243,6 +244,7 @@ procedure Toptionsform.Apply(Sender: TObject);
AppSettings.WriteBool(asAllowMultipleInstances, chkAllowMultiInstances.Checked);
AppSettings.WriteBool(asRestoreLastUsedDB, chkRestoreLastDB.Checked);
AppSettings.WriteBool(asPromptSaveFileOnTabClose, chkAskFileSave.Checked);
AppSettings.WriteBool(asQueryWarningsMessage, chkQueryWarningsMessage.Checked);
AppSettings.WriteString(asFontName, comboSQLFontName.Text);
AppSettings.WriteInt(asFontSize, updownSQLFontSize.Position);
AppSettings.WriteInt(asTabWidth, updownSQLTabWidth.Position);
@@ -489,6 +491,7 @@ procedure Toptionsform.FormShow(Sender: TObject);
updownGUIFontSize.Position := AppSettings.ReadInt(asGUIFontSize);
comboGUIFont.OnChange(comboGUIFont);
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
chkQueryWarningsMessage.Checked := AppSettings.ReadBool(asQueryWarningsMessage);
// Logging
updownLogLines.Position := AppSettings.ReadInt(asLogsqlnum);

0 comments on commit 774830c

Please sign in to comment.