Add remote sync settings shortcut

This commit is contained in:
Joe Julian
2026-04-06 20:47:57 -07:00
parent 554d4f760d
commit 26748d4b84
3 changed files with 164 additions and 2 deletions
+30 -1
View File
@@ -2358,6 +2358,9 @@ func (u *ui) prefillAdvancedSyncRemoteFromSavedBinding() {
func (u *ui) syncDialogTitle() string {
if u.syncDialogPurpose == syncDialogPurposeRemoteSetup {
if _, ok := u.selectedVaultRemoteBinding(); ok {
return "Remote Sync Settings"
}
return "Set Up Remote Sync"
}
return "Advanced Sync"
@@ -2365,6 +2368,9 @@ func (u *ui) syncDialogTitle() string {
func (u *ui) syncDialogDescription() string {
if u.syncDialogPurpose == syncDialogPurposeRemoteSetup {
if _, ok := u.selectedVaultRemoteBinding(); ok {
return "Review or change this vault's saved WebDAV target, credentials, and sync mode."
}
return "Send this local vault to a WebDAV target, then use that target for future sync."
}
return "Pick direction, choose the other vault, and then run the merge. Saved source and direction defaults now live in Settings."
@@ -2372,6 +2378,9 @@ func (u *ui) syncDialogDescription() string {
func (u *ui) syncDialogConfirmButtonLabel() string {
if u.syncDialogPurpose == syncDialogPurposeRemoteSetup {
if _, ok := u.selectedVaultRemoteBinding(); ok {
return "Save Remote Sync Settings"
}
return "Set Up Remote Sync"
}
return "Synchronize"
@@ -2625,6 +2634,18 @@ func (u *ui) directRemoteSyncShortcutLabel() string {
return "Use Remote Sync"
}
func (u *ui) shouldShowRemoteSyncSettingsShortcut() bool {
if !u.hasOpenVault() || u.isVaultLocked() || u.state.Section != appstate.SectionEntries {
return false
}
_, ok := u.selectedVaultRemoteBinding()
return ok
}
func (u *ui) remoteSyncSettingsShortcutLabel() string {
return "Remote Sync Settings"
}
func (u *ui) shouldShowRemoteSyncSetupShortcut() bool {
if !u.hasOpenVault() || u.isVaultLocked() || u.state.Section != appstate.SectionEntries {
return false
@@ -6836,7 +6857,7 @@ func (u *ui) pathBar(gtx layout.Context) layout.Dimensions {
return children
}()...)
}
if !u.shouldShowDirectRemoteSyncShortcut() && !u.shouldShowRemoteSyncSetupShortcut() {
if !u.shouldShowDirectRemoteSyncShortcut() && !u.shouldShowRemoteSyncSetupShortcut() && !u.shouldShowRemoteSyncSettingsShortcut() {
return crumbBar(gtx)
}
children := []layout.FlexChild{
@@ -6856,6 +6877,14 @@ func (u *ui) pathBar(gtx layout.Context) layout.Dimensions {
return tonedButton(gtx, u.theme, &u.useSavedAdvancedSyncRemote, u.remoteSyncSetupShortcutLabel())
}))
}
if u.shouldShowRemoteSyncSettingsShortcut() {
if u.shouldShowDirectRemoteSyncShortcut() || u.shouldShowRemoteSyncSetupShortcut() {
children = append(children, layout.Rigid(layout.Spacer{Height: unit.Dp(6)}.Layout))
}
children = append(children, layout.Rigid(func(gtx layout.Context) layout.Dimensions {
return tonedButton(gtx, u.theme, &u.useSavedAdvancedSyncRemote, u.remoteSyncSettingsShortcutLabel())
}))
}
return layout.Flex{Axis: layout.Vertical}.Layout(gtx, children...)
}