mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
feature: use Ctrl
+ click to start fetch/pull/push automatically with default options (#351)
This commit is contained in:
parent
2e12717235
commit
965a4b21ae
7 changed files with 78 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue