Detect if all Drives are indexed and show a warning if they aren't (#5015)

* opens new settings search options

* Catching file not found exception

* removed unnecessary header files

* Added display strings and cleaned up code

* reduced the number of max results to 30

* added log statement for exception

* Added drive detection to settings ui but still doesn't reflect on toggling it

* added getter setter for DriveDetectionWarning

* Got UI and backend to work as expected

* Reading value from registry working as expected

* Added test for settings

* Added tests for drive detection

* rename drive detection

* Localized indexer string

* formatting

* resolving merge conflict

* Added theme aware warning icon

* changed text for the warning

* Added the warning images to the installer
This commit is contained in:
Alekhya
2020-07-20 17:50:42 -07:00
committed by GitHub
parent c85cd4ac24
commit 96cd135f82
23 changed files with 289 additions and 68 deletions

View File

@@ -26,6 +26,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
public bool ignore_hotkeys_in_fullscreen { get; set; }
public bool disable_drive_detection_warning { get; set; }
public bool clear_input_on_launch { get; set; }
public PowerLauncherProperties()
@@ -37,6 +38,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
search_result_preference = "most_recently_used";
search_type_preference = "application_name";
ignore_hotkeys_in_fullscreen = false;
disable_drive_detection_warning = false;
clear_input_on_launch = false;
}
}

View File

@@ -272,6 +272,9 @@
<data name="PowerLauncher_IgnoreHotkeysInFullScreen.Content" xml:space="preserve">
<value>Ignore hotkeys in fullscreen mode</value>
</data>
<data name="PowerLauncher_DisableDriveDetectionWarning.Content" xml:space="preserve">
<value>Disable drive detection warning for the indexer plugin</value>
</data>
<data name="PowerLauncher_ClearInputOnLaunch.Content" xml:space="preserve">
<value>Clear the previous query on launch</value>
</data>

View File

@@ -252,5 +252,22 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
}
public bool DisableDriveDetectionWarning
{
get
{
return settings.properties.disable_drive_detection_warning;
}
set
{
if (settings.properties.disable_drive_detection_warning != value)
{
settings.properties.disable_drive_detection_warning = value;
UpdateSettings();
}
}
}
}
}

View File

@@ -1,4 +1,4 @@
<Page
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
@@ -10,7 +10,7 @@
xmlns:CustomControls="using:Microsoft.PowerToys.Settings.UI.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid ColumnSpacing="{StaticResource DefaultColumnSpacing}" RowSpacing="{StaticResource DefaultRowSpacing}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="LayoutVisualStates">
@@ -141,6 +141,13 @@
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.ClearInputOnLaunch}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
/>
<CheckBox x:Uid="PowerLauncher_DisableDriveDetectionWarning"
Margin="{StaticResource SmallTopMargin}"
IsChecked="{x:Bind Mode=TwoWay, Path=ViewModel.DisableDriveDetectionWarning}"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.EnablePowerLauncher}"
/>
</StackPanel>
<StackPanel
x:Name="SidePanel"

View File

@@ -131,6 +131,15 @@ namespace ViewModelTests
Assert.IsFalse(mockSettings.properties.override_win_s_key);
}
[TestMethod]
public void DriveDetectionViewModel_WhenSet_MustUpdateOverrides()
{
// Act
viewModel.DisableDriveDetectionWarning = true;
// Assert
Assert.AreEqual(1, sendCallbackMock.TimesSent);
Assert.IsTrue(mockSettings.properties.disable_drive_detection_warning);
}
}
}