diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 364494f0..c3ce9f2a 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -163,6 +163,7 @@ Kind: annotated lightweight + Hold Ctrl to start directly Cut Delete Branch Branch: diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 58e915db..1603caf4 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -166,6 +166,7 @@ 类型 : 附注标签 轻量标签 + 按住Ctrl键点击将以默认参数运行 剪切 删除分支确认 分支名 : diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 167933da..859a0136 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -166,6 +166,7 @@ 型別 : 附註標籤 輕量標籤 + 按住Ctrl鍵點擊將以預設參數運行 剪下 刪除分支確認 分支名 : diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index f40e88f6..9ff41264 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -253,6 +253,9 @@ + diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 5ef34d5b..7f5a1232 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -420,7 +420,7 @@ namespace SourceGit.ViewModels return menu; } - public void Fetch() + public void Fetch(bool autoStart) { if (!PopupHost.CanCreatePopup()) return; @@ -431,10 +431,13 @@ namespace SourceGit.ViewModels return; } - PopupHost.ShowPopup(new Fetch(this)); + if (autoStart) + PopupHost.ShowAndStartPopup(new Fetch(this)); + else + PopupHost.ShowPopup(new Fetch(this)); } - public void Pull() + public void Pull(bool autoStart) { if (!PopupHost.CanCreatePopup()) return; @@ -445,10 +448,13 @@ namespace SourceGit.ViewModels return; } - PopupHost.ShowPopup(new Pull(this, null)); + if (autoStart) + PopupHost.ShowAndStartPopup(new Pull(this, null)); + else + PopupHost.ShowPopup(new Pull(this, null)); } - public void Push() + public void Push(bool autoStart) { if (!PopupHost.CanCreatePopup()) return; @@ -465,7 +471,10 @@ namespace SourceGit.ViewModels return; } - PopupHost.ShowPopup(new Push(this, null)); + if (autoStart) + PopupHost.ShowAndStartPopup(new Push(this, null)); + else + PopupHost.ShowPopup(new Push(this, null)); } public void ApplyPatch() diff --git a/src/Views/RepositoryToolbar.axaml b/src/Views/RepositoryToolbar.axaml index 2f7a1d48..45186fa7 100644 --- a/src/Views/RepositoryToolbar.axaml +++ b/src/Views/RepositoryToolbar.axaml @@ -31,15 +31,36 @@ - - - diff --git a/src/Views/RepositoryToolbar.axaml.cs b/src/Views/RepositoryToolbar.axaml.cs index 57fed44b..37963d99 100644 --- a/src/Views/RepositoryToolbar.axaml.cs +++ b/src/Views/RepositoryToolbar.axaml.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Input; using Avalonia.Interactivity; namespace SourceGit.Views @@ -10,6 +11,18 @@ namespace SourceGit.Views InitializeComponent(); } + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + _hasCtrl = e.KeyModifiers.HasFlag(KeyModifiers.Control); + } + + protected override void OnKeyUp(KeyEventArgs e) + { + base.OnKeyUp(e); + _hasCtrl = false; + } + private void OpenWithExternalTools(object sender, RoutedEventArgs e) { if (sender is Button button && DataContext is ViewModels.Repository repo) @@ -40,6 +53,24 @@ namespace SourceGit.Views } } + private void Fetch(object _, RoutedEventArgs e) + { + (DataContext as ViewModels.Repository)?.Fetch(_hasCtrl); + e.Handled = true; + } + + private void Pull(object _, RoutedEventArgs e) + { + (DataContext as ViewModels.Repository)?.Pull(_hasCtrl); + e.Handled = true; + } + + private void Push(object _, RoutedEventArgs e) + { + (DataContext as ViewModels.Repository)?.Push(_hasCtrl); + e.Handled = true; + } + private void OpenGitFlowMenu(object sender, RoutedEventArgs e) { if (DataContext is ViewModels.Repository repo) @@ -61,6 +92,8 @@ namespace SourceGit.Views e.Handled = true; } + + private bool _hasCtrl = false; } }