Fix rapid travel mode, universal commands
This commit is contained in:
@@ -75,7 +75,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
|||||||
{
|
{
|
||||||
var pathInput = new TextInputElement("Path");
|
var pathInput = new TextInputElement("Path");
|
||||||
await _userCommunicationService.ReadInputs(pathInput);
|
await _userCommunicationService.ReadInputs(pathInput);
|
||||||
|
|
||||||
//TODO: message on empty result and on null pathInput.Value
|
//TODO: message on empty result and on null pathInput.Value
|
||||||
var resolvedPath = await _timelessContentProvider.GetItemByNativePathAsync(new NativePath(pathInput.Value));
|
var resolvedPath = await _timelessContentProvider.GetItemByNativePathAsync(new NativePath(pathInput.Value));
|
||||||
if (resolvedPath is IContainer container)
|
if (resolvedPath is IContainer container)
|
||||||
@@ -146,6 +146,7 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
|||||||
if (_currentSelectedItem is not IContainerViewModel containerViewModel || containerViewModel.Container is null)
|
if (_currentSelectedItem is not IContainerViewModel containerViewModel || containerViewModel.Container is null)
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
_appState.RapidTravelText = "";
|
||||||
_selectedTab?.Tab?.SetCurrentLocation(containerViewModel.Container);
|
_selectedTab?.Tab?.SetCurrentLocation(containerViewModel.Container);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
@@ -153,7 +154,12 @@ public class NavigationUserCommandHandlerService : UserCommandHandlerServiceBase
|
|||||||
private async Task GoUp()
|
private async Task GoUp()
|
||||||
{
|
{
|
||||||
if (_currentLocation?.Parent is not AbsolutePath parentPath ||
|
if (_currentLocation?.Parent is not AbsolutePath parentPath ||
|
||||||
await parentPath.ResolveAsyncSafe() is not IContainer newContainer) return;
|
await parentPath.ResolveAsyncSafe() is not IContainer newContainer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_appState.RapidTravelText = "";
|
||||||
_selectedTab?.Tab?.SetCurrentLocation(newContainer);
|
_selectedTab?.Tab?.SetCurrentLocation(newContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using FileTime.App.Core.UserCommand;
|
||||||
using FileTime.GuiApp.Configuration;
|
using FileTime.GuiApp.Configuration;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
@@ -49,7 +50,12 @@ public class KeyboardConfigurationService : IKeyboardConfigurationService
|
|||||||
|
|
||||||
private static bool IsUniversal(CommandBindingConfiguration keyMapping)
|
private static bool IsUniversal(CommandBindingConfiguration keyMapping)
|
||||||
{
|
{
|
||||||
return false;
|
return keyMapping.Command is
|
||||||
//return keyMapping.Command is ConfigCommand.GoUp or ConfigCommand.Open or ConfigCommand.OpenOrRun or ConfigCommand.MoveCursorUp or ConfigCommand.MoveCursorDown or ConfigCommand.MoveCursorUpPage or ConfigCommand.MoveCursorDownPage;
|
GoUpCommand.CommandName
|
||||||
|
or OpenSelectedCommand.CommandName
|
||||||
|
or MoveCursorDownCommand.CommandName
|
||||||
|
or MoveCursorDownPageCommand.CommandName
|
||||||
|
or MoveCursorUpCommand.CommandName
|
||||||
|
or MoveCursorUpPageCommand.CommandName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace FileTime.GuiApp.Services;
|
|||||||
public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
|
public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
|
||||||
{
|
{
|
||||||
private const string RapidTravelFilterName = "rapid_travel_filter";
|
private const string RapidTravelFilterName = "rapid_travel_filter";
|
||||||
|
|
||||||
private readonly IAppState _appState;
|
private readonly IAppState _appState;
|
||||||
private readonly IModalService _modalService;
|
private readonly IModalService _modalService;
|
||||||
private readonly IKeyboardConfigurationService _keyboardConfigurationService;
|
private readonly IKeyboardConfigurationService _keyboardConfigurationService;
|
||||||
@@ -79,7 +79,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var currentKeyAsList = new List<KeyConfig>() {new KeyConfig(key)};
|
var currentKeyAsList = new List<KeyConfig>() { new KeyConfig(key) };
|
||||||
var selectedCommandBinding = _keyboardConfigurationService.UniversalCommandBindings.FirstOrDefault(c => c.Keys.AreKeysEqual(currentKeyAsList));
|
var selectedCommandBinding = _keyboardConfigurationService.UniversalCommandBindings.FirstOrDefault(c => c.Keys.AreKeysEqual(currentKeyAsList));
|
||||||
if (selectedCommandBinding != null)
|
if (selectedCommandBinding != null)
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ public class RapidTravelModeKeyInputHandler : IRapidTravelModeKeyInputHandler
|
|||||||
if (updateRapidTravelFilter)
|
if (updateRapidTravelFilter)
|
||||||
{
|
{
|
||||||
if (_selectedTab?.Tab is not ITab tab) return;
|
if (_selectedTab?.Tab is not ITab tab) return;
|
||||||
|
|
||||||
tab.RemoveItemFilter(RapidTravelFilterName);
|
tab.RemoveItemFilter(RapidTravelFilterName);
|
||||||
tab.AddItemFilter(new ItemFilter(RapidTravelFilterName, i => i.Name.ToLower().Contains(_appState.RapidTravelText)));
|
tab.AddItemFilter(new ItemFilter(RapidTravelFilterName, i => i.Name.ToLower().Contains(_appState.RapidTravelText)));
|
||||||
/*var currentLocation = await _appState.SelectedTab.CurrentLocation.Container.WithoutVirtualContainer(MainPageViewModel.RAPIDTRAVEL);
|
/*var currentLocation = await _appState.SelectedTab.CurrentLocation.Container.WithoutVirtualContainer(MainPageViewModel.RAPIDTRAVEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user