Add remote sync settings shortcut
This commit is contained in:
@@ -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...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user