From 057d31ca5015ab92f1c688cdb9375aed8e24ab87 Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Thu, 16 Feb 2023 21:34:07 +0530
Subject: [PATCH 01/35] Add invalid name warning
---
src/Files.App/Views/SettingsPages/Tags.xaml | 69 ++++++++++++++++++-
.../Views/SettingsPages/Tags.xaml.cs | 1 +
2 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml b/src/Files.App/Views/SettingsPages/Tags.xaml
index a07de33cd1ca..7bb8b7aa2e3e 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml
@@ -106,6 +106,40 @@
HorizontalAlignment="Right"
Orientation="Horizontal"
Spacing="12">
+
+
+
+
+
+
+
+
+
+
+
@@ -230,6 +264,39 @@
Orientation="Horizontal"
Spacing="12"
Visibility="{x:Bind IsEditing, Converter={StaticResource BoolVisibilityConverter}, Mode=OneWay}">
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml.cs b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
index c0b5b72b1446..c489fbdc484a 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml.cs
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
@@ -75,6 +75,7 @@ private void RenameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
var text = ((TextBox)sender).Text;
editingTag!.IsNameValid = IsNameValid(text);
+ editingTag!.CanCommit = IsNameValid(text) || (editingTag!.Tag.Name == text);
}
private void NewTagTextBox_TextChanged(object sender, TextChangedEventArgs e)
From dc0c048424ccfac5887dc72adfa0487ba64a5be9 Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Thu, 16 Feb 2023 21:37:00 +0530
Subject: [PATCH 02/35] Add string
---
src/Files.App/Strings/en-US/Resources.resw | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw
index 50a272619625..72ca9765e1f5 100644
--- a/src/Files.App/Strings/en-US/Resources.resw
+++ b/src/Files.App/Strings/en-US/Resources.resw
@@ -2958,4 +2958,7 @@
Context menu options
+
+ Invalid name
+
\ No newline at end of file
From da9ef96331a217ead2ec430adf2b87e40abb7e11 Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Thu, 16 Feb 2023 22:16:47 +0530
Subject: [PATCH 03/35] fix regression
---
src/Files.App/Views/SettingsPages/Tags.xaml | 606 +++++++++---------
.../Views/SettingsPages/Tags.xaml.cs | 6 +-
.../ViewModels/FileTags/ListedTagViewModel.cs | 7 +
3 files changed, 313 insertions(+), 306 deletions(-)
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml b/src/Files.App/Views/SettingsPages/Tags.xaml
index 7bb8b7aa2e3e..082f2998daf4 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml
@@ -1,321 +1,321 @@
-
-
-
-
-
-
-
-
-
-
+ x:Class="Files.App.SettingsPages.Tags"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
+ xmlns:converters1="using:CommunityToolkit.WinUI.UI.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:helpers="using:Files.App.Helpers"
+ xmlns:local="using:Files.App.UserControls.Settings"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:settingsviewmodels="using:Files.App.ViewModels.SettingsViewModels"
+ xmlns:vc="using:Files.App.ValueConverters"
+ mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml.cs b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
index c489fbdc484a..1d44eb76470b 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml.cs
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
@@ -74,8 +74,8 @@ private void RemoveTag_Click(object sender, RoutedEventArgs e)
private void RenameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
var text = ((TextBox)sender).Text;
- editingTag!.IsNameValid = IsNameValid(text);
- editingTag!.CanCommit = IsNameValid(text) || (editingTag!.Tag.Name == text);
+ editingTag!.IsNameValid = IsNameValid(text) || (text == editingTag!.Tag.Name);
+ editingTag!.CanCommit = IsNameValid(text);
}
private void NewTagTextBox_TextChanged(object sender, TextChangedEventArgs e)
@@ -122,7 +122,7 @@ private bool IsNameValid(string name)
string.IsNullOrWhiteSpace(name) ||
name.StartsWith('.') ||
name.EndsWith('.') ||
- (name != editingTag?.Tag.Name && ViewModel.Tags.Any(tag => name == tag.Tag.Name))
+ ViewModel.Tags.Any(tag => name == tag.Tag.Name)
);
}
}
diff --git a/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs b/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs
index 3fc29acbf684..aa48bf137ef3 100644
--- a/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs
+++ b/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs
@@ -25,6 +25,13 @@ public bool IsNameValid
set => SetProperty(ref isNameValid, value);
}
+ private bool canCommit = true;
+ public bool CanCommit
+ {
+ get => canCommit;
+ set => SetProperty(ref canCommit, value);
+ }
+
private string newColor;
public string NewColor
{
From a949b582ee9ac7dbad06ecf4be419821ff785507 Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Fri, 17 Feb 2023 10:26:49 +0530
Subject: [PATCH 04/35] Tabify
---
src/Files.App/Views/SettingsPages/Tags.xaml | 606 ++++++++++----------
1 file changed, 303 insertions(+), 303 deletions(-)
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml b/src/Files.App/Views/SettingsPages/Tags.xaml
index 082f2998daf4..7bb8b7aa2e3e 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml
@@ -1,321 +1,321 @@
-
-
-
-
-
-
-
-
-
-
+ x:Class="Files.App.SettingsPages.Tags"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
+ xmlns:converters1="using:CommunityToolkit.WinUI.UI.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:helpers="using:Files.App.Helpers"
+ xmlns:local="using:Files.App.UserControls.Settings"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:settingsviewmodels="using:Files.App.ViewModels.SettingsViewModels"
+ xmlns:vc="using:Files.App.ValueConverters"
+ mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 9f0c951f54f4431b25e97942d3d84d24885652d7 Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Sat, 18 Feb 2023 15:03:29 +0530
Subject: [PATCH 05/35] fix color change not updating button
---
.../TagsSettingsViewModel.cs | 1 +
src/Files.App/Views/SettingsPages/Tags.xaml | 607 +++++++++---------
.../Views/SettingsPages/Tags.xaml.cs | 16 +-
.../ViewModels/FileTags/ListedTagViewModel.cs | 9 +-
4 files changed, 325 insertions(+), 308 deletions(-)
diff --git a/src/Files.App/ViewModels/SettingsViewModels/TagsSettingsViewModel.cs b/src/Files.App/ViewModels/SettingsViewModels/TagsSettingsViewModel.cs
index b004602ab679..e8c098f01ce0 100644
--- a/src/Files.App/ViewModels/SettingsViewModels/TagsSettingsViewModel.cs
+++ b/src/Files.App/ViewModels/SettingsViewModels/TagsSettingsViewModel.cs
@@ -138,6 +138,7 @@ public bool IsNameValid
public void Reset()
{
Name = string.Empty;
+ IsNameValid = false;
Color = ColorHelpers.RandomColor();
}
}
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml b/src/Files.App/Views/SettingsPages/Tags.xaml
index 7bb8b7aa2e3e..615fa0c3363c 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml
@@ -1,321 +1,322 @@
-
-
-
-
-
-
-
-
-
-
+ x:Class="Files.App.SettingsPages.Tags"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
+ xmlns:converters1="using:CommunityToolkit.WinUI.UI.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:helpers="using:Files.App.Helpers"
+ xmlns:local="using:Files.App.UserControls.Settings"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:settingsviewmodels="using:Files.App.ViewModels.SettingsViewModels"
+ xmlns:vc="using:Files.App.ValueConverters"
+ mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml.cs b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
index 1d44eb76470b..da9b425240d9 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml.cs
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
@@ -37,11 +37,13 @@ private void EditTag_Click(object sender, RoutedEventArgs e)
if (editingTag is not null)
{
editingTag.IsEditing = false;
+ editingTag.NewName = editingTag.Tag.Name;
editingTag.NewColor = editingTag.Tag.Color;
}
editingTag = (ListedTagViewModel)((Button)sender).DataContext;
editingTag.NewColor = editingTag.Tag.Color;
+ editingTag.NewName = editingTag.Tag.Name;
editingTag.IsEditing = true;
var item = (ListViewItem)TagsList.ContainerFromItem(editingTag);
@@ -75,14 +77,21 @@ private void RenameTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
var text = ((TextBox)sender).Text;
editingTag!.IsNameValid = IsNameValid(text) || (text == editingTag!.Tag.Name);
- editingTag!.CanCommit = IsNameValid(text);
+ editingTag!.CanCommit = IsNameValid(text) && ((text != editingTag!.Tag.Name) || (editingTag!.NewColor != editingTag!.Tag.Color));
+ }
+
+ private void EditColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventArgs args)
+ {
+ if (editingTag is null) return;
+
+ editingTag!.CanCommit = IsNameValid(editingTag!.NewName) && (editingTag!.NewName != editingTag!.Tag.Name || (editingTag!.NewColor != editingTag!.Tag.Color));
}
private void NewTagTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
var text = ((TextBox)sender).Text;
ViewModel.NewTag.Name = text;
- ViewModel.NewTag.IsNameValid = IsNameValid(text);
+ ViewModel.NewTag.IsNameValid = IsNameValid(text) && !ViewModel.Tags.Any(tag => text == tag.Tag.Name);
}
private void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
@@ -121,8 +130,7 @@ private bool IsNameValid(string name)
return !(
string.IsNullOrWhiteSpace(name) ||
name.StartsWith('.') ||
- name.EndsWith('.') ||
- ViewModel.Tags.Any(tag => name == tag.Tag.Name)
+ name.EndsWith('.')
);
}
}
diff --git a/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs b/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs
index aa48bf137ef3..79531806f137 100644
--- a/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs
+++ b/src/Files.Backend/ViewModels/FileTags/ListedTagViewModel.cs
@@ -25,13 +25,20 @@ public bool IsNameValid
set => SetProperty(ref isNameValid, value);
}
- private bool canCommit = true;
+ private bool canCommit = false;
public bool CanCommit
{
get => canCommit;
set => SetProperty(ref canCommit, value);
}
+ private string newName;
+ public string NewName
+ {
+ get => newName;
+ set => SetProperty(ref newName, value);
+ }
+
private string newColor;
public string NewColor
{
From 8056161134316445e80770d0101aae6e0d77bb35 Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Sun, 19 Feb 2023 22:23:25 +0530
Subject: [PATCH 06/35] fix changing back to original color not updating button
---
src/Files.App/Views/SettingsPages/Tags.xaml | 608 +++++++++---------
.../Views/SettingsPages/Tags.xaml.cs | 5 +-
2 files changed, 308 insertions(+), 305 deletions(-)
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml b/src/Files.App/Views/SettingsPages/Tags.xaml
index 615fa0c3363c..2e59b0703f2f 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml
@@ -1,322 +1,322 @@
-
-
-
-
-
-
-
-
-
-
+ x:Class="Files.App.SettingsPages.Tags"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
+ xmlns:converters1="using:CommunityToolkit.WinUI.UI.Converters"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:helpers="using:Files.App.Helpers"
+ xmlns:local="using:Files.App.UserControls.Settings"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:settingsviewmodels="using:Files.App.ViewModels.SettingsViewModels"
+ xmlns:vc="using:Files.App.ValueConverters"
+ mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml.cs b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
index da9b425240d9..5ea57bf80760 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml.cs
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml.cs
@@ -1,5 +1,8 @@
+using CommunityToolkit.WinUI.Helpers;
using CommunityToolkit.WinUI.UI;
+using Files.App.Helpers;
using Files.Backend.ViewModels.FileTags;
+using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
@@ -84,7 +87,7 @@ private void EditColorPicker_ColorChanged(ColorPicker sender, ColorChangedEventA
{
if (editingTag is null) return;
- editingTag!.CanCommit = IsNameValid(editingTag!.NewName) && (editingTag!.NewName != editingTag!.Tag.Name || (editingTag!.NewColor != editingTag!.Tag.Color));
+ editingTag!.CanCommit = IsNameValid(editingTag!.NewName) && (editingTag!.NewName != editingTag!.Tag.Name || (CommunityToolkit.WinUI.Helpers.ColorHelper.ToHex(sender.Color) != editingTag!.Tag.Color));
}
private void NewTagTextBox_TextChanged(object sender, TextChangedEventArgs e)
From 6518deb83aeb202d5580e4deffa4d8fe0d283a5f Mon Sep 17 00:00:00 2001
From: Nikhil B <59918974+heftymouse@users.noreply.github.com>
Date: Tue, 28 Feb 2023 11:25:31 +0530
Subject: [PATCH 07/35] Switch to infobar and add tooltip
---
src/Files.App/Strings/en-US/Resources.resw | 9 ++-
src/Files.App/Views/SettingsPages/Tags.xaml | 77 ++++-----------------
2 files changed, 19 insertions(+), 67 deletions(-)
diff --git a/src/Files.App/Strings/en-US/Resources.resw b/src/Files.App/Strings/en-US/Resources.resw
index f594721d49e7..fb7ff842f1eb 100644
--- a/src/Files.App/Strings/en-US/Resources.resw
+++ b/src/Files.App/Strings/en-US/Resources.resw
@@ -2565,9 +2565,6 @@
Pictures
-
- Videos
-
Update Files
@@ -2958,4 +2955,10 @@
Invalid name
+
+ Name must not be empty or start or end with a period.
+
+
+ Videos
+
\ No newline at end of file
diff --git a/src/Files.App/Views/SettingsPages/Tags.xaml b/src/Files.App/Views/SettingsPages/Tags.xaml
index 2e59b0703f2f..4f161cb7c9b1 100644
--- a/src/Files.App/Views/SettingsPages/Tags.xaml
+++ b/src/Files.App/Views/SettingsPages/Tags.xaml
@@ -21,6 +21,7 @@
x:Key="InvertedBoolVisibilityConverter"
FalseValue="Visible"
TrueValue="Collapsed" />
+
@@ -107,38 +108,12 @@
Orientation="Horizontal"
Spacing="12">
-
-
-
-
-
-
-
-
-
+
@@ -265,38 +240,12 @@
Orientation="Horizontal"
Spacing="12"
Visibility="{x:Bind IsEditing, Converter={StaticResource BoolVisibilityConverter}, Mode=OneWay}">
-
-
-
-
-
-
-
-
-
+