feature/ui - zatim ne uplne uhlazena ale celkem pouzitelna appka #1
17
ui.go
17
ui.go
@ -692,11 +692,18 @@ func buildContactsTab(parts *uiParts, svc ServiceFacade) fyne.CanvasObject {
|
|||||||
certEntry.SetMinRowsVisible(8)
|
certEntry.SetMinRowsVisible(8)
|
||||||
certEntry.Wrapping = fyne.TextWrapWord
|
certEntry.Wrapping = fyne.TextWrapWord
|
||||||
// Detail toolbar
|
// Detail toolbar
|
||||||
|
pasteAction := widget.NewToolbarAction(theme.ContentPasteIcon(), func() {
|
||||||
|
clip := fyne.CurrentApp().Clipboard().Content()
|
||||||
|
if strings.TrimSpace(clip) == "" {
|
||||||
|
parts.showToast("Schránka prázdná")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
certEntry.SetText(clip)
|
||||||
|
parts.showToast("Vloženo ze schránky")
|
||||||
|
})
|
||||||
certToolbar := widget.NewToolbar(
|
certToolbar := widget.NewToolbar(
|
||||||
widget.NewToolbarAction(theme.ContentCopyIcon(), func() { copyClip(certEntry.Text, parts) }),
|
widget.NewToolbarAction(theme.ContentCopyIcon(), func() { copyClip(certEntry.Text, parts) }),
|
||||||
widget.NewToolbarAction(theme.ContentPasteIcon(), func() {
|
pasteAction,
|
||||||
certEntry.SetText(fyne.CurrentApp().Clipboard().Content())
|
|
||||||
}),
|
|
||||||
widget.NewToolbarAction(theme.ContentClearIcon(), func() { certEntry.SetText("") }),
|
widget.NewToolbarAction(theme.ContentClearIcon(), func() { certEntry.SetText("") }),
|
||||||
)
|
)
|
||||||
// helper pro generování default názvu
|
// helper pro generování default názvu
|
||||||
@ -831,6 +838,10 @@ func buildContactsTab(parts *uiParts, svc ServiceFacade) fyne.CanvasObject {
|
|||||||
draft = &Contact{ID: "__draft__", Name: makeDefaultName(), Cert: ""}
|
draft = &Contact{ID: "__draft__", Name: makeDefaultName(), Cert: ""}
|
||||||
nameEntry.SetText(draft.Name)
|
nameEntry.SetText(draft.Name)
|
||||||
certEntry.SetText("")
|
certEntry.SetText("")
|
||||||
|
// Pokud je ve schránce PEM / CERT, automaticky ho vlož
|
||||||
|
if clip := fyne.CurrentApp().Clipboard().Content(); strings.Contains(clip, "BEGIN ") && strings.Contains(clip, "PUBLIC") || strings.Contains(clip, "CERTIFICATE") {
|
||||||
|
certEntry.SetText(clip)
|
||||||
|
}
|
||||||
// auto select all text in name so user can immediately přepsat
|
// auto select all text in name so user can immediately přepsat
|
||||||
fyne.CurrentApp().Driver().CanvasForObject(nameEntry).Focus(nameEntry)
|
fyne.CurrentApp().Driver().CanvasForObject(nameEntry).Focus(nameEntry)
|
||||||
nameEntry.TypedShortcut(&fyne.ShortcutSelectAll{})
|
nameEntry.TypedShortcut(&fyne.ShortcutSelectAll{})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user