fix: deniability button now disables the comments field

This commit is contained in:
Alex Verner 2024-08-07 17:03:52 +03:00
parent 0dadb24304
commit 985ae302b1
2 changed files with 7 additions and 5 deletions

View file

@ -1 +1 @@
1.38 1.39

View file

@ -2,7 +2,7 @@ package main
/* /*
Picocrypt v1.38 Picocrypt v1.39
Copyright (c) Evan Su Copyright (c) Evan Su
Released under a GNU GPL v3 License Released under a GNU GPL v3 License
https://github.com/Picocrypt/Picocrypt https://github.com/Picocrypt/Picocrypt
@ -58,7 +58,7 @@ var TRANSPARENT = color.RGBA{0x00, 0x00, 0x00, 0x00}
// Generic variables // Generic variables
var window *giu.MasterWindow var window *giu.MasterWindow
var version = "v1.38" var version = "v1.39"
var dpi float32 var dpi float32
var mode string var mode string
var working bool var working bool
@ -467,12 +467,14 @@ func draw() {
), ),
giu.Separator(), giu.Separator(),
giu.Style().SetDisabled(mode != "decrypt" && ((len(keyfiles) == 0 && password == "") || (password != cpassword))).To( giu.Style().SetDisabled(mode != "decrypt" && ((len(keyfiles) == 0 && password == "") || (password != cpassword)) || deniability).To(
giu.Style().SetDisabled(mode == "decrypt" && (comments == "" || comments == "Comments are corrupted")).To( giu.Style().SetDisabled(mode == "decrypt" && (comments == "" || comments == "Comments are corrupted")).To(
giu.Label(commentsLabel), giu.Label(commentsLabel),
giu.InputText(&comments).Size(giu.Auto).Flags(func() giu.InputTextFlags { giu.InputText(&comments).Size(giu.Auto).Flags(func() giu.InputTextFlags {
if commentsDisabled { if commentsDisabled {
return giu.InputTextFlagsReadOnly return giu.InputTextFlagsReadOnly
} else if deniability {
comments = ""
} }
return giu.InputTextFlagsNone return giu.InputTextFlagsNone
}()), }()),
@ -515,7 +517,7 @@ func draw() {
giu.Row( giu.Row(
giu.Checkbox("Deniability", &deniability), giu.Checkbox("Deniability", &deniability),
giu.Tooltip("Add plausible deniability to the volume"), giu.Tooltip("Add plausible deniability to the volume\nIf enabled, the comments will not work"),
giu.Dummy(-170, 0), giu.Dummy(-170, 0),
giu.Style().SetDisabled(!(len(allFiles) > 1 || len(onlyFolders) > 0)).To( giu.Style().SetDisabled(!(len(allFiles) > 1 || len(onlyFolders) > 0)).To(
giu.Checkbox("Recursively", &recursively).OnChange(func() { giu.Checkbox("Recursively", &recursively).OnChange(func() {