mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-13 01:41:18 +00:00
review: say why a read-only signature field can't be signed
This commit is contained in:
1 file changed
+14
-2
@@ -120,8 +120,20 @@ pub(crate) fn panel(ui: &mut egui::Ui, t: &Tokens, sigs: &[SignatureInfo], expan
|
||||
egui::Frame::NONE.inner_margin(egui::Margin { left: 44, right: 4, top: 2, bottom: 8 }).show(ui, |ui| {
|
||||
ui.spacing_mut().item_spacing.y = 3.0;
|
||||
if !s.signed {
|
||||
// The writer refuses a read-only field, so the panel does not offer to sign it.
|
||||
if !s.read_only && widgets::pill_button(ui, tl!("Sign this field…"), true).clicked() {
|
||||
// The writer refuses a read-only field, so the panel does not offer to sign it,
|
||||
// and says why instead of showing an empty expansion.
|
||||
if s.read_only {
|
||||
ui.add(
|
||||
egui::Label::new(
|
||||
egui::RichText::new(tl!("This field is read-only, so it can't be signed."))
|
||||
.font(theme::regular(11.5))
|
||||
.color(t.text_muted),
|
||||
)
|
||||
.wrap(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if widgets::pill_button(ui, tl!("Sign this field…"), true).clicked() {
|
||||
action = Some(PanelAction::Sign(s.field.clone()));
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user