mirror of
https://github.com/HACKERALERT/Picocrypt.git
synced 2024-09-20 09:46:43 +00:00
Check for clipboard support, fix a bug
This commit is contained in:
parent
8318639f76
commit
ab1412ab1d
|
@ -182,7 +182,9 @@ func draw() {
|
||||||
giu.Checkbox("Lowercase", &passgenLower),
|
giu.Checkbox("Lowercase", &passgenLower),
|
||||||
giu.Checkbox("Numbers", &passgenNums),
|
giu.Checkbox("Numbers", &passgenNums),
|
||||||
giu.Checkbox("Symbols", &passgenSymbols),
|
giu.Checkbox("Symbols", &passgenSymbols),
|
||||||
giu.Checkbox("Copy to clipboard", &passgenCopy),
|
giu.Style().SetDisabled(clipboard.Unsupported).To(
|
||||||
|
giu.Checkbox("Copy to clipboard", &passgenCopy),
|
||||||
|
),
|
||||||
giu.Row(
|
giu.Row(
|
||||||
giu.Button("Cancel").Size(100, 0).OnClick(func() {
|
giu.Button("Cancel").Size(100, 0).OnClick(func() {
|
||||||
giu.CloseCurrentPopup()
|
giu.CloseCurrentPopup()
|
||||||
|
@ -337,22 +339,26 @@ func draw() {
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Clear the password entries."),
|
giu.Tooltip("Clear the password entries."),
|
||||||
|
|
||||||
giu.Button("Copy").Size(54, 0).OnClick(func() {
|
giu.Style().SetDisabled(clipboard.Unsupported).To(
|
||||||
clipboard.WriteAll(password)
|
giu.Row(
|
||||||
giu.Update()
|
giu.Button("Copy").Size(54, 0).OnClick(func() {
|
||||||
}),
|
clipboard.WriteAll(password)
|
||||||
giu.Tooltip("Copy the password into your clipboard."),
|
giu.Update()
|
||||||
|
}),
|
||||||
|
giu.Tooltip("Copy the password into your clipboard."),
|
||||||
|
|
||||||
giu.Button("Paste").Size(54, 0).OnClick(func() {
|
giu.Button("Paste").Size(54, 0).OnClick(func() {
|
||||||
tmp, _ := clipboard.ReadAll()
|
tmp, _ := clipboard.ReadAll()
|
||||||
password = tmp
|
password = tmp
|
||||||
if mode != "decrypt" {
|
if mode != "decrypt" {
|
||||||
cpassword = tmp
|
cpassword = tmp
|
||||||
}
|
}
|
||||||
passwordStrength = zxcvbn.PasswordStrength(password, nil).Score
|
passwordStrength = zxcvbn.PasswordStrength(password, nil).Score
|
||||||
giu.Update()
|
giu.Update()
|
||||||
}),
|
}),
|
||||||
giu.Tooltip("Paste a password from your clipboard."),
|
giu.Tooltip("Paste a password from your clipboard."),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
giu.Style().SetDisabled(mode == "decrypt").To(
|
giu.Style().SetDisabled(mode == "decrypt").To(
|
||||||
giu.Button("Create").Size(54, 0).OnClick(func() {
|
giu.Button("Create").Size(54, 0).OnClick(func() {
|
||||||
|
@ -570,7 +576,7 @@ func draw() {
|
||||||
if file == "" || err != nil {
|
if file == "" || err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
file = strings.Split(file, ".")[0]
|
file = filepath.Join(filepath.Dir(file), strings.Split(filepath.Base(file), ".")[0])
|
||||||
|
|
||||||
// Add the correct extensions
|
// Add the correct extensions
|
||||||
if mode == "encrypt" {
|
if mode == "encrypt" {
|
||||||
|
@ -1877,7 +1883,7 @@ func resetUI() {
|
||||||
passgenLower = true
|
passgenLower = true
|
||||||
passgenNums = true
|
passgenNums = true
|
||||||
passgenSymbols = true
|
passgenSymbols = true
|
||||||
passgenCopy = true
|
passgenCopy = !clipboard.Unsupported
|
||||||
|
|
||||||
keyfile = false
|
keyfile = false
|
||||||
keyfiles = nil
|
keyfiles = nil
|
||||||
|
@ -2033,6 +2039,11 @@ func main() {
|
||||||
// Set universal DPI
|
// Set universal DPI
|
||||||
dpi = giu.Context.GetPlatform().GetContentScale()
|
dpi = giu.Context.GetPlatform().GetContentScale()
|
||||||
|
|
||||||
|
// Ensure clipboard support is available
|
||||||
|
if clipboard.Unsupported {
|
||||||
|
mainStatus = "Ready. (Note: No clipboard support found.)"
|
||||||
|
}
|
||||||
|
|
||||||
// Start the UI
|
// Start the UI
|
||||||
window.Run(draw)
|
window.Run(draw)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue