Skip to content

Commit

Permalink
chore(hotkey): added property IsHotkeyActive
Browse files Browse the repository at this point in the history
  • Loading branch information
salvadorbs committed Jan 4, 2025
1 parent 922557d commit 2a50aec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Frame/Frame.Properties.Advanced.pas
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function TfrmAdvancedPropertyPage.InternalLoadData: Boolean;
dtpSchTime.Time := CurrentNodeData.SchDateTime;
cxSchedulerChange(Self);
//Hotkey
if (CurrentNodeData.Hotkey <> 0) then
if (CurrentNodeData.IsHotkeyActive) then
edtHotkey.Text := ShortCutToText(CurrentNodeData.Hotkey);
//Specific file settings
cbHideSoftware.Checked := CurrentNodeData.HideFromMenu;
Expand Down
2 changes: 1 addition & 1 deletion Library/Database.List.pas
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class procedure TSQLtbl_list.InsertFileRecord(AData: TvBaseNodeData; ADBManager:

//If enabled, register item's hotkey with new ID
if AData is TvCustomRealNodeData then
if TvCustomRealNodeData(AData).Hotkey <> 0 then
if TvCustomRealNodeData(AData).IsHotkeyActive then
ASuiteManager.ListManager.HotKeyItemList.AddItem(TvCustomRealNodeData(AData));

SQLFilesData.Free;
Expand Down
2 changes: 1 addition & 1 deletion Library/Lists.Manager.pas
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ procedure TListManager.RemoveItemFromLists(AItemData: TvCustomRealNodeData);
FMRUList.RemoveItem(AItemData);
FMFUList.RemoveItem(AItemData);
//Remove item from hotkey list
if AItemData.Hotkey <> 0 then
if AItemData.IsHotkeyActive then
FHotKeyItemList.RemoveItem(AItemData);
//Remove item from scheduler list
if AItemData.SchMode <> smDisabled then
Expand Down
9 changes: 8 additions & 1 deletion Library/NodeDataTypes.Custom.pas
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TvCustomRealNodeData = class(TvBaseNodeData)
FHotkey : TShortCut;
FLastAccess : Int64;

function GetIsHotkeyActive: Boolean;
procedure SetAutorun(value: TAutorunType);
procedure SetHotkey(AValue: TShortCut);
procedure SetSchMode(value: TSchedulerMode);
Expand Down Expand Up @@ -75,6 +76,7 @@ TvCustomRealNodeData = class(TvBaseNodeData)
property SchMode: TSchedulerMode read FSchMode write SetSchMode;
property SchDateTime: TDateTime read FSchDateTime write SetSchDateTime;
property Hotkey: TShortCut read FHotkey write SetHotkey;
property IsHotkeyActive: Boolean read GetIsHotkeyActive;
end;
PvCustomRealNodeData = ^TvCustomRealNodeData;

Expand Down Expand Up @@ -250,12 +252,17 @@ procedure TvCustomRealNodeData.SetAutorun(value:TAutorunType);
FAutorun := value;
end;

function TvCustomRealNodeData.GetIsHotkeyActive: Boolean;
begin
Result := Self.Hotkey <> 0;
end;

procedure TvCustomRealNodeData.SetHotkey(AValue: TShortCut);
begin
if (Config.ASuiteState <> lsImporting) then
begin
//Old value is true, remove it in HotKeyApp
if (FHotkey <> 0) then
if (Self.IsHotkeyActive) then
ASuiteManager.ListManager.HotKeyItemList.RemoveItem(Self);
//New value is true, add it in HotKeyApp
if (AValue <> 0) then
Expand Down
4 changes: 0 additions & 4 deletions languages/ASuite.pot
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,6 @@ msgstr ""
msgid "Hide this software from menu"
msgstr ""

#: tfrmadvancedpropertypage.cbhotkey.caption
msgid "Active hotkey"
msgstr ""

#: tfrmadvancedpropertypage.cbshortcutdesktop.caption
msgid "Create shortcut on desktop when ASuite is running"
msgstr ""
Expand Down

0 comments on commit 2a50aec

Please sign in to comment.