Commit c3c0a8f9 authored by Loïck Bonniot's avatar Loïck Bonniot

[gui] Use native file open for userform

parent d93fd42f
Pipeline #579 passed with stage
...@@ -26,20 +26,16 @@ func NewWidget(conf *config.Config, onRegistered func(pw string)) *Widget { ...@@ -26,20 +26,16 @@ func NewWidget(conf *config.Config, onRegistered func(pw string)) *Widget {
registerButton := ui.NewPushButtonFromDriver(form.FindChild("registerButton")) registerButton := ui.NewPushButtonFromDriver(form.FindChild("registerButton"))
home := config.GetHomeDir() home := config.GetHomeDir()
fileDialog := ui.NewFileDialogWithParentCaptionDirectoryFilter(nil, "Select the CA file for the platform", home, "Root Certificates (*.pem);;Any (*.*)")
// Events // Events
registerButton.OnClicked(func() { registerButton.OnClicked(func() {
form.SetDisabled(true) form.SetDisabled(true)
feedbackLabel.SetText("Registration in progress...") feedbackLabel.SetText("Registration in progress...")
fileDialog.Open() filter := "Root Certificates (*.pem);;Any (*.*)"
}) caFilename := ui.QFileDialogGetOpenFileNameWithParentCaptionDirFilterSelectedfilterOptions(form, "Select the CA file for the platform", home, filter, &filter, 0)
fileDialog.OnFileSelected(func(ca string) {
fileDialog.Hide()
caDest := home + config.CAFile caDest := home + config.CAFile
_ = copyCA(ca, caDest) _ = copyCA(caFilename, caDest)
err := user.Register( err := user.Register(
caDest, caDest,
...@@ -60,11 +56,6 @@ func NewWidget(conf *config.Config, onRegistered func(pw string)) *Widget { ...@@ -60,11 +56,6 @@ func NewWidget(conf *config.Config, onRegistered func(pw string)) *Widget {
form.SetDisabled(false) form.SetDisabled(false)
}) })
fileDialog.OnRejected(func() {
form.SetDisabled(false)
feedbackLabel.SetText("Registration aborted.")
})
return &Widget{QWidget: form} return &Widget{QWidget: form}
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment