96 lines
2.5 KiB
Go
96 lines
2.5 KiB
Go
package actions
|
|
|
|
import "git.julianfamily.org/keepassgo/internal/appstate"
|
|
|
|
type SyncMenuModel struct {
|
|
HasOpenVault bool
|
|
HasSelectedBinding bool
|
|
ShowSelectors bool
|
|
ShowShare bool
|
|
ShowSaveCurrentBinding bool
|
|
SavedBindingSummary SyncMenuBindingSummary
|
|
RemoteBaseURL string
|
|
RemotePath string
|
|
RemoteUsername string
|
|
RemotePassword string
|
|
SelectedVaultSyncMode appstate.SyncMode
|
|
}
|
|
|
|
type SyncMenuBindingSummary struct {
|
|
ProfileLabel string
|
|
CredentialLabel string
|
|
SyncLabel string
|
|
OK bool
|
|
}
|
|
|
|
func (m SyncMenuModel) SavedBindingHeading() string {
|
|
if !m.ShowSelectors {
|
|
return "Use this vault's saved remote sync target"
|
|
}
|
|
return "Use a saved remote profile from this vault"
|
|
}
|
|
|
|
func (m SyncMenuModel) OpenSelectedButtonLabel() string {
|
|
if !m.ShowSelectors {
|
|
return "Use Remote Sync"
|
|
}
|
|
return "Open Saved Remote"
|
|
}
|
|
|
|
func (m SyncMenuModel) ShowDirectRemoteSyncShortcut() bool {
|
|
return m.HasOpenVault && m.HasSelectedBinding
|
|
}
|
|
|
|
func (m SyncMenuModel) DirectRemoteSyncShortcutLabel() string {
|
|
return "Use Remote Sync"
|
|
}
|
|
|
|
func (m SyncMenuModel) ShowRemoteSyncSettingsShortcut() bool {
|
|
return m.HasOpenVault && m.HasSelectedBinding
|
|
}
|
|
|
|
func (m SyncMenuModel) RemoteSyncSettingsShortcutLabel() string {
|
|
return "Remote Sync Settings"
|
|
}
|
|
|
|
func (m SyncMenuModel) ShowRemoveRemoteSyncShortcut() bool {
|
|
return m.ShowRemoteSyncSettingsShortcut()
|
|
}
|
|
|
|
func (m SyncMenuModel) RemoveRemoteSyncShortcutLabel() string {
|
|
return "Stop Using Remote Sync"
|
|
}
|
|
|
|
func (m SyncMenuModel) ShowRemoteSyncSetupShortcut() bool {
|
|
return m.HasOpenVault && !m.HasSelectedBinding
|
|
}
|
|
|
|
func (m SyncMenuModel) RemoteSyncSetupShortcutLabel() string {
|
|
return "Set Up Remote Sync"
|
|
}
|
|
|
|
func (m SyncMenuModel) ActionLabels() []string {
|
|
labels := []string{"Open Advanced Sync"}
|
|
if m.ShowRemoteSyncSetupShortcut() {
|
|
labels = append(labels, m.RemoteSyncSetupShortcutLabel())
|
|
}
|
|
if m.ShowDirectRemoteSyncShortcut() {
|
|
labels = append(labels, m.DirectRemoteSyncShortcutLabel())
|
|
}
|
|
if m.ShowRemoteSyncSettingsShortcut() {
|
|
labels = append(labels, m.RemoteSyncSettingsShortcutLabel())
|
|
}
|
|
if m.ShowRemoveRemoteSyncShortcut() {
|
|
labels = append(labels, m.RemoveRemoteSyncShortcutLabel())
|
|
}
|
|
return labels
|
|
}
|
|
|
|
func (m SyncMenuModel) SaveCurrentRemoteBindingHeading() string {
|
|
return "Bind this local vault to the current remote target"
|
|
}
|
|
|
|
func (m SyncMenuModel) SaveCurrentRemoteBindingButtonLabel() string {
|
|
return "Save Remote In Vault"
|
|
}
|