[Launcher] Remove Win+R checkbox (#2513)

* Remove Win+R

* Comment out all unused options

* Fix PowerLauncherViewModel tests
This commit is contained in:
Tomas Agustin Raies 2020-05-01 15:58:55 -07:00 committed by GitHub
parent f44109abae
commit 1656b4c5b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 34 deletions

View File

@ -54,7 +54,7 @@
<TextBlock x:Uid="PowerLauncher_SearchResults" <TextBlock x:Uid="PowerLauncher_SearchResults"
Style="{StaticResource SettingsGroupTitleStyle}"/> Style="{StaticResource SettingsGroupTitleStyle}"/>
<ComboBox x:Uid="PowerLauncher_SearchResultPreference" <!--<ComboBox x:Uid="PowerLauncher_SearchResultPreference"
MinWidth="320" MinWidth="320"
Margin="{StaticResource SmallTopMargin}" Margin="{StaticResource SmallTopMargin}"
ItemsSource="{x:Bind searchResultPreferencesOptions}" ItemsSource="{x:Bind searchResultPreferencesOptions}"
@ -72,7 +72,7 @@
SelectedValuePath="Item2" SelectedValuePath="Item2"
DisplayMemberPath="Item1" DisplayMemberPath="Item1"
IsEnabled="False" IsEnabled="False"
/> />-->
<muxc:NumberBox x:Uid="PowerLauncher_MaximumNumberOfResults" <muxc:NumberBox x:Uid="PowerLauncher_MaximumNumberOfResults"
Value="{x:Bind Mode=TwoWay, Path=ViewModel.MaximumNumberOfResults}" Value="{x:Bind Mode=TwoWay, Path=ViewModel.MaximumNumberOfResults}"
@ -95,7 +95,7 @@
HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}" HotkeySettings="{x:Bind Path=ViewModel.OpenPowerLauncher, Mode=TwoWay}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
/> />
<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation" <!--<Custom:HotkeySettingsControl x:Uid="PowerLauncher_OpenFileLocation"
Width="320" Width="320"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Margin="{StaticResource SmallTopMargin}" Margin="{StaticResource SmallTopMargin}"
@ -115,19 +115,19 @@
Margin="{StaticResource SmallTopMargin}" Margin="{StaticResource SmallTopMargin}"
HotkeySettings="{x:Bind Path=ViewModel.OpenConsole, Mode=TwoWay}" HotkeySettings="{x:Bind Path=ViewModel.OpenConsole, Mode=TwoWay}"
IsEnabled="False" IsEnabled="False"
/> />-->
<CheckBox x:Uid="PowerLauncher_OverrideWinRKey" <!--<CheckBox x:Uid="PowerLauncher_OverrideWinRKey"
Margin="{StaticResource SmallTopMargin}" Margin="{StaticResource SmallTopMargin}"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinRKey}" IsChecked="False"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}" IsEnabled="False"
/> />-->
<CheckBox x:Uid="PowerLauncher_OverrideWinSKey" <!--<CheckBox x:Uid="PowerLauncher_OverrideWinSKey"
Margin="{StaticResource SmallTopMargin}" Margin="{StaticResource SmallTopMargin}"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinSKey}" IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.OverrideWinSKey}"
IsEnabled="False" IsEnabled="False"
/> />-->
</StackPanel> </StackPanel>
<StackPanel <StackPanel
x:Name="SidePanel" x:Name="SidePanel"

View File

@ -13,15 +13,6 @@ namespace ViewModelTests
[TestClass] [TestClass]
public class PowerLauncher public class PowerLauncher
{ {
class PowerLauncherSettingsMock : PowerLauncherSettings
{
public int TimesSaved { get; set; }
public override void Save()
{
TimesSaved++;
}
}
class SendCallbackMock class SendCallbackMock
{ {
public int TimesSent { get; set; } public int TimesSent { get; set; }
@ -31,14 +22,14 @@ namespace ViewModelTests
} }
} }
private PowerLauncherViewModel viewModel; private PowerLauncherViewModel viewModel;
private PowerLauncherSettingsMock mockSettings; private PowerLauncherSettings mockSettings;
private SendCallbackMock sendCallbackMock; private SendCallbackMock sendCallbackMock;
[TestInitialize] [TestInitialize]
public void Initialize() public void Initialize()
{ {
mockSettings = new PowerLauncherSettingsMock(); mockSettings = new PowerLauncherSettings();
sendCallbackMock = new SendCallbackMock(); sendCallbackMock = new SendCallbackMock();
viewModel = new PowerLauncherViewModel( viewModel = new PowerLauncherViewModel(
@ -54,19 +45,17 @@ namespace ViewModelTests
viewModel.SearchTypePreference = "SearchOptionsAreNotValidated"; viewModel.SearchTypePreference = "SearchOptionsAreNotValidated";
Assert.AreEqual(sendCallbackMock.TimesSent, 2); Assert.AreEqual(sendCallbackMock.TimesSent, 2);
Assert.AreEqual(mockSettings.TimesSaved, 2);
Assert.IsTrue(mockSettings.properties.search_result_preference == "SearchOptionsAreNotValidated"); Assert.IsTrue(mockSettings.properties.search_result_preference == "SearchOptionsAreNotValidated");
Assert.IsTrue(mockSettings.properties.search_type_preference == "SearchOptionsAreNotValidated"); Assert.IsTrue(mockSettings.properties.search_type_preference == "SearchOptionsAreNotValidated");
} }
public void AssertHotkeySettings(HotkeySettings setting, bool win, bool ctrl, bool alt, bool shift, int code) public void AssertHotkeySettings(HotkeySettings setting, bool win, bool ctrl, bool alt, bool shift, int code)
{ {
Assert.AreEqual(setting.Win, win); Assert.AreEqual(win, setting.Win);
Assert.AreEqual(setting.Ctrl, ctrl); Assert.AreEqual(ctrl, setting.Ctrl);
Assert.AreEqual(setting.Alt, alt); Assert.AreEqual(alt, setting.Alt);
Assert.AreEqual(setting.Shift, shift); Assert.AreEqual(shift, setting.Shift);
Assert.AreEqual(setting.Code, code); Assert.AreEqual(code, setting.Code);
} }
[TestMethod] [TestMethod]
@ -94,8 +83,7 @@ namespace ViewModelTests
viewModel.OpenConsole = openConsole; viewModel.OpenConsole = openConsole;
viewModel.CopyPathLocation = copyFileLocation; viewModel.CopyPathLocation = copyFileLocation;
Assert.AreEqual(mockSettings.TimesSaved, 4); Assert.AreEqual(4, sendCallbackMock.TimesSent);
Assert.AreEqual(sendCallbackMock.TimesSent, 4);
AssertHotkeySettings( AssertHotkeySettings(
mockSettings.properties.open_powerlauncher, mockSettings.properties.open_powerlauncher,
@ -138,8 +126,7 @@ namespace ViewModelTests
viewModel.OverrideWinSKey = false; viewModel.OverrideWinSKey = false;
Assert.AreEqual(sendCallbackMock.TimesSent, 1); Assert.AreEqual(1, sendCallbackMock.TimesSent);
Assert.AreEqual(mockSettings.TimesSaved, 1);
Assert.IsTrue(mockSettings.properties.override_win_r_key); Assert.IsTrue(mockSettings.properties.override_win_r_key);
Assert.IsFalse(mockSettings.properties.override_win_s_key); Assert.IsFalse(mockSettings.properties.override_win_s_key);

View File

@ -293,7 +293,7 @@ namespace Wox.Plugin.Shell
{ {
// not overriding Win+R // not overriding Win+R
// crutkas we need to earn the right for Win+R override // crutkas we need to earn the right for Win+R override
/*
if (_settings.ReplaceWinR) if (_settings.ReplaceWinR)
{ {
if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed) if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed)
@ -309,6 +309,7 @@ namespace Wox.Plugin.Shell
return false; return false;
} }
} }
*/
return true; return true;
} }
@ -357,7 +358,7 @@ namespace Wox.Plugin.Shell
public void UpdateSettings(PowerLauncherSettings settings) public void UpdateSettings(PowerLauncherSettings settings)
{ {
_settings.ReplaceWinR = settings.properties.override_win_r_key; //_settings.ReplaceWinR = settings.properties.override_win_r_key;
} }
} }
} }