mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Issue #1232: fix wrong tab caption used when rename-tab action triggered through its shortcut
This commit is contained in:
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: HeidiSQL\n"
|
||||
"POT-Creation-Date: 2012-11-05 21:40\n"
|
||||
"PO-Revision-Date: 2020-11-21 13:08+0100\n"
|
||||
"PO-Revision-Date: 2020-11-24 17:51+0100\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"
|
||||
@@ -6593,8 +6593,8 @@ msgstr "Size &All Columns to Fit"
|
||||
msgid "This view probably contains an error in its code."
|
||||
msgstr "This view probably contains an error in its code."
|
||||
|
||||
msgid "Rename tab"
|
||||
msgstr "Rename tab"
|
||||
msgid "Rename query tab"
|
||||
msgstr "Rename query tab"
|
||||
|
||||
msgid "Enter new name"
|
||||
msgstr "Enter new name"
|
||||
|
||||
@@ -369,7 +369,6 @@ type
|
||||
function ThemeIsDark(ThemeName: String): Boolean;
|
||||
function ProcessExists(pid: Cardinal; ExeNamePattern: String): Boolean;
|
||||
procedure ToggleCheckBoxWithoutClick(chk: TCheckBox; State: Boolean);
|
||||
function GetClickedMenu(Sender: TObject): TMenu;
|
||||
|
||||
var
|
||||
AppSettings: TAppSettings;
|
||||
@@ -2975,22 +2974,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function GetClickedMenu(Sender: TObject): TMenu;
|
||||
var
|
||||
ClickedControl: TComponent;
|
||||
begin
|
||||
Result := nil;
|
||||
if Sender is TAction then begin
|
||||
ClickedControl := (Sender as TAction).ActionComponent;
|
||||
if ClickedControl is TMenuItem then begin
|
||||
Result := (ClickedControl as TMenuItem).GetParentMenu;
|
||||
end;
|
||||
end;
|
||||
if Result = nil then
|
||||
raise Exception.Create('Could not find menu from '+Sender.ClassName+' instance');
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{ Threading stuff }
|
||||
|
||||
|
||||
@@ -2115,6 +2115,9 @@ object MainForm: TMainForm
|
||||
object Closequerytab1: TMenuItem
|
||||
Action = actCloseQueryTab
|
||||
end
|
||||
object Renametab1: TMenuItem
|
||||
Action = actRenameQueryTab
|
||||
end
|
||||
object Clear1: TMenuItem
|
||||
Action = actClearQueryEditor
|
||||
end
|
||||
@@ -3496,11 +3499,11 @@ object MainForm: TMainForm
|
||||
ImageIndex = 135
|
||||
OnExecute = actConnectionPropertiesExecute
|
||||
end
|
||||
object actRenameTab: TAction
|
||||
object actRenameQueryTab: TAction
|
||||
Category = 'File'
|
||||
Caption = 'Rename tab'
|
||||
Caption = 'Rename query tab'
|
||||
ImageIndex = 58
|
||||
OnExecute = actRenameTabExecute
|
||||
OnExecute = actRenameQueryTabExecute
|
||||
end
|
||||
end
|
||||
object menuConnections: TPopupMenu
|
||||
@@ -4272,13 +4275,15 @@ object MainForm: TMainForm
|
||||
object menuNewQueryTab: TMenuItem
|
||||
Action = actNewQueryTab
|
||||
end
|
||||
object menuCloseTab: TMenuItem
|
||||
object menuCloseQueryTab: TMenuItem
|
||||
Caption = 'Close query tab'
|
||||
ImageIndex = 133
|
||||
OnClick = menuCloseQueryTab
|
||||
OnClick = menuCloseQueryTabClick
|
||||
end
|
||||
object Renametab1: TMenuItem
|
||||
Action = actRenameTab
|
||||
object menuRenameQueryTab: TMenuItem
|
||||
Caption = 'Rename tab'
|
||||
ImageIndex = 58
|
||||
OnClick = menuRenameQueryTabClick
|
||||
end
|
||||
end
|
||||
object TimerFilterVT: TTimer
|
||||
|
||||
@@ -459,7 +459,7 @@ type
|
||||
menuAutoRefresh: TMenuItem;
|
||||
popupMainTabs: TPopupMenu;
|
||||
menuNewQueryTab: TMenuItem;
|
||||
menuCloseTab: TMenuItem;
|
||||
menuCloseQueryTab: TMenuItem;
|
||||
actNewQueryTab: TAction;
|
||||
actCloseQueryTab: TAction;
|
||||
Newquerytab1: TMenuItem;
|
||||
@@ -726,7 +726,8 @@ type
|
||||
actConnectionProperties: TAction;
|
||||
Connectionproperties1: TMenuItem;
|
||||
menuCopyAs: TMenuItem;
|
||||
actRenameTab: TAction;
|
||||
actRenameQueryTab: TAction;
|
||||
menuRenameQueryTab: TMenuItem;
|
||||
Renametab1: TMenuItem;
|
||||
procedure actCreateDBObjectExecute(Sender: TObject);
|
||||
procedure menuConnectionsPopup(Sender: TObject);
|
||||
@@ -922,7 +923,7 @@ type
|
||||
procedure PageControlMainMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure actNewQueryTabExecute(Sender: TObject);
|
||||
procedure actCloseQueryTabExecute(Sender: TObject);
|
||||
procedure menuCloseQueryTab(Sender: TObject);
|
||||
procedure menuCloseQueryTabClick(Sender: TObject);
|
||||
procedure CloseQueryTab(PageIndex: Integer);
|
||||
procedure CloseButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure CloseButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
@@ -1112,7 +1113,8 @@ type
|
||||
procedure actCodeFoldingEndRegionExecute(Sender: TObject);
|
||||
procedure actCodeFoldingFoldSelectionExecute(Sender: TObject);
|
||||
procedure actConnectionPropertiesExecute(Sender: TObject);
|
||||
procedure actRenameTabExecute(Sender: TObject);
|
||||
procedure actRenameQueryTabExecute(Sender: TObject);
|
||||
procedure menuRenameQueryTabClick(Sender: TObject);
|
||||
private
|
||||
// Executable file details
|
||||
FAppVerMajor: Integer;
|
||||
@@ -11465,7 +11467,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.menuCloseQueryTab(Sender: TObject);
|
||||
procedure TMainForm.menuCloseQueryTabClick(Sender: TObject);
|
||||
var
|
||||
aPoint: TPoint;
|
||||
begin
|
||||
@@ -11475,33 +11477,40 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.actRenameTabExecute(Sender: TObject);
|
||||
procedure TMainForm.actRenameQueryTabExecute(Sender: TObject);
|
||||
var
|
||||
ClickedMenu: TMenu;
|
||||
aPoint: TPoint;
|
||||
PageIndex: Integer;
|
||||
NewCaption: String;
|
||||
begin
|
||||
// Rename query tab
|
||||
try
|
||||
ClickedMenu := GetClickedMenu(Sender);
|
||||
aPoint := PageControlMain.ScreenToClient(TPopupMenu(ClickedMenu).PopupPoint);
|
||||
if Sender = menuRenameQueryTab then begin
|
||||
aPoint := PageControlMain.ScreenToClient(popupMainTabs.PopupPoint);
|
||||
PageIndex := GetMainTabAt(aPoint.X, aPoint.Y);
|
||||
end else begin
|
||||
PageIndex := PageControlMain.ActivePageIndex;
|
||||
end;
|
||||
if not IsQueryTab(PageIndex, True) then begin
|
||||
// Action may have been triggered through shortcut, and active tab is not a query tab
|
||||
MessageBeep(MB_ICONASTERISK);
|
||||
end else begin
|
||||
NewCaption := PageControlMain.Pages[PageIndex].Caption;
|
||||
NewCaption := NewCaption.Trim([' ', '*']);
|
||||
if InputQuery(_('Rename tab'), _('Enter new name'), NewCaption) then begin
|
||||
if InputQuery(actRenameQueryTab.Caption, _('Enter new name'), NewCaption) then begin
|
||||
SetTabCaption(PageIndex, NewCaption);
|
||||
ValidateQueryControls(Sender);
|
||||
end;
|
||||
except
|
||||
on E:Exception do begin
|
||||
raise;
|
||||
ErrorDialog(E.Message);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.menuRenameQueryTabClick(Sender: TObject);
|
||||
begin
|
||||
// Rename tab by click on menu item (not by shortcut!)
|
||||
actRenameQueryTabExecute(Sender);
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.popupMainTabsPopup(Sender: TObject);
|
||||
var
|
||||
aPoint: TPoint;
|
||||
@@ -11510,8 +11519,12 @@ begin
|
||||
// Detect if there is a tab under mouse position
|
||||
aPoint := PageControlMain.ScreenToClient(popupMainTabs.PopupPoint);
|
||||
PageIndex := GetMainTabAt(aPoint.X, aPoint.Y);
|
||||
menuCloseTab.Enabled := IsQueryTab(PageIndex, False);
|
||||
actRenameTab.Enabled := IsQueryTab(PageIndex, True);
|
||||
menuCloseQueryTab.ImageIndex := actCloseQueryTab.ImageIndex;
|
||||
menuCloseQueryTab.Caption := actCloseQueryTab.Caption;
|
||||
menuCloseQueryTab.Enabled := IsQueryTab(PageIndex, False);
|
||||
menuRenameQueryTab.ImageIndex := actRenameQueryTab.ImageIndex;
|
||||
menuRenameQueryTab.Caption := actRenameQueryTab.Caption;
|
||||
menuRenameQueryTab.Enabled := IsQueryTab(PageIndex, True);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user