Skip to content

Commit

Permalink
QoL: Confirm import with 1-click or Return key (#4054)
Browse files Browse the repository at this point in the history
* enter or 1-click to confirm import after importing from site

* Set focus before closePanel in the import popup

* dev rebase fix
  • Loading branch information
Peechey authored Feb 4, 2022
1 parent c38948d commit ae7f64d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Classes/ButtonControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ function ButtonClass:OnKeyDown(key)
end
if key == "LEFTBUTTON" then
self.clicked = true
elseif self.enterFunc then
self.enterFunc()
end
return self
end
Expand Down
12 changes: 6 additions & 6 deletions src/Classes/ImportTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ You can get this from your web browser's cookies while logged into the Path of E
self.controls.importCodeMode.selIndex = 2
end
end)
self.controls.importCodeIn.enterFunc = function()
if self.importCodeState == "VALID" then
self.controls.importCodeGo.onClick()
end
end
self.controls.importCodeState = new("LabelControl", {"LEFT",self.controls.importCodeIn,"RIGHT"}, 4, 0, 0, 16)
self.controls.importCodeState.label = function()
return (self.importCodeState == "VALID" and colorCodes.POSITIVE.."Code is valid") or (self.importCodeState == "INVALID" and colorCodes.NEGATIVE.."Invalid code") or ""
Expand Down Expand Up @@ -270,6 +265,11 @@ You can get this from your web browser's cookies while logged into the Path of E
self.controls.importCodeGo.enabled = function()
return self.importCodeState == "VALID"
end
self.controls.importCodeGo.enterFunc = function()
if self.importCodeState == "VALID" then
self.controls.importCodeGo.onClick()
end
end
end)

function ImportTabClass:Load(xml, fileName)
Expand Down Expand Up @@ -987,8 +987,8 @@ function ImportTabClass:OpenImportFromWebsitePopup()
controls.import.enabled = true
else
self.controls.importCodeIn:SetText(data, true)
main:SelectControl(self.controls.importCodeGo)
main:ClosePopup()
main:SelectControl(self.controls.importCodeIn)
end
end)
end)
Expand Down

0 comments on commit ae7f64d

Please sign in to comment.