Skip to content

Commit d2037d9

Browse files
0x5bfayaira2
authored andcommitted
IsCustomized to IsDefault
1 parent fa5e7b9 commit d2037d9

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

src/Files.App/Data/Items/ModifiableCommandHotKeyItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public bool IsEditMode
3535
}
3636

3737
private bool _IsCustomized;
38-
public bool IsCustomized
38+
public bool IsDefaultKey
3939
{
4040
get => _IsCustomized;
4141
set => SetProperty(ref _IsCustomized, value);

src/Files.App/ViewModels/Settings/ActionsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
103103
HotKey = hotkey,
104104
DefaultHotKeyCollection = defaultKeys,
105105
PreviousHotKey = hotkey,
106-
IsCustomized = !defaultKeys.Contains(hotkey),
106+
IsDefaultKey = defaultKeys.Contains(hotkey),
107107
});
108108
}
109109
}

src/Files.App/Views/Settings/ActionsPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</ResourceDictionary.ThemeDictionaries>
3636

3737
<ResourceDictionary.MergedDictionaries>
38-
<ResourceDictionary Source="/ResourceDictionaries/RightAlignedToggleSwitchStyle.xaml" />
38+
<ResourceDictionary Source="ms-appx:///ResourceDictionaries/RightAlignedToggleSwitchStyle.xaml" />
3939
<ResourceDictionary Source="ms-appx:///UserControls/KeyboardShortcut/KeyboardShortcut.xaml" />
4040
</ResourceDictionary.MergedDictionaries>
4141

@@ -244,7 +244,7 @@
244244
x:Name="CustomizedIndicatorCircleBorder"
245245
Width="8"
246246
Height="8"
247-
x:Load="{x:Bind IsCustomized, Mode=OneWay}"
247+
x:Load="{x:Bind IsDefaultKey, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
248248
Background="{ThemeResource SystemAccentColor}"
249249
CornerRadius="{StaticResource ControlCornerRadius}"
250250
ToolTipService.ToolTip="{helpers:ResourceString Name=Customized}" />

src/Files.App/Views/Settings/ActionsPage.xaml.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private void RootGrid_PointerEntered(object sender, PointerRoutedEventArgs e)
2929
{
3030
VisualStateManager.GoToState((UserControl)sender, PointerOverState, true);
3131

32+
// Make edit button visible on pointer in
3233
if (sender is UserControl userControl &&
3334
userControl.FindChild(PART_EditButton) is Button editButton &&
3435
userControl.DataContext is ModifiableCommandHotKeyItem item &&
@@ -40,6 +41,7 @@ private void RootGrid_PointerExited(object sender, PointerRoutedEventArgs e)
4041
{
4142
VisualStateManager.GoToState((UserControl)sender, NormalState, true);
4243

44+
// Make edit button invisible on pointer out
4345
if (sender is UserControl userControl &&
4446
userControl.FindChild(PART_EditButton) is Button editButton &&
4547
userControl.DataContext is ModifiableCommandHotKeyItem item &&
@@ -51,7 +53,7 @@ private void EditButton_Click(object sender, RoutedEventArgs e)
5153
{
5254
if (sender is Button button && button.DataContext is ModifiableCommandHotKeyItem item)
5355
{
54-
// Hide the add-new section grid
56+
// Hide the add command grid
5557
ViewModel.ShowAddNewShortcutGrid = false;
5658

5759
// Reset the selected item's info
@@ -61,14 +63,14 @@ private void EditButton_Click(object sender, RoutedEventArgs e)
6163
ViewModel.SelectedNewShortcutItem = null;
6264
}
6365

64-
// Reset edit mode for each item
66+
// Reset edit mode of every item
6567
foreach (var hotkey in ViewModel.ValidKeyboardShortcuts)
6668
{
6769
hotkey.IsEditMode = false;
6870
hotkey.HotKeyText = hotkey.HotKey.LocalizedLabel;
6971
}
7072

71-
// Enter edit mode
73+
// Enter edit mode for the item
7274
item.IsEditMode = true;
7375
}
7476
}
@@ -107,9 +109,9 @@ GeneralSettingsService.Actions is not null
107109
var newHotKey = HotKey.Parse(item.HotKeyText);
108110
var modifiedCollection = HotKeyCollection.Empty;
109111

110-
if (!item.IsCustomized)
112+
if (item.IsDefaultKey)
111113
{
112-
// The first time to customize
114+
// The first time to customize in the user setting
113115
if (string.IsNullOrEmpty(storedKeys))
114116
{
115117
// Replace with new one
@@ -140,7 +142,7 @@ GeneralSettingsService.Actions is not null
140142
foreach (var action in ViewModel.ValidKeyboardShortcuts)
141143
{
142144
if (action.CommandCode == item.CommandCode)
143-
action.IsCustomized = !item.DefaultHotKeyCollection.Contains(action.HotKey);
145+
action.IsDefaultKey = item.DefaultHotKeyCollection.Contains(action.HotKey);
144146
}
145147

146148
// Exit edit mode
@@ -175,7 +177,7 @@ GeneralSettingsService.Actions is not null
175177
foreach (var action in ViewModel.ValidKeyboardShortcuts)
176178
{
177179
if (action.CommandCode == item.CommandCode)
178-
action.IsCustomized = !item.DefaultHotKeyCollection.Contains(action.HotKey);
180+
action.IsDefaultKey = item.DefaultHotKeyCollection.Contains(action.HotKey);
179181
}
180182

181183
// Exit edit mode
@@ -209,10 +211,9 @@ GeneralSettingsService.Actions is not null
209211
// Initialize
210212
var modifiedCollection = HotKeyCollection.Empty;
211213

212-
// The first time to customize
213-
if (!item.IsCustomized)
214+
if (item.IsDefaultKey)
214215
{
215-
// The first time to customize
216+
// The first time to customize in the user setting
216217
if (string.IsNullOrEmpty(storedKeys))
217218
{
218219
// Replace with new one

0 commit comments

Comments
 (0)