Skip to content

Commit 26a1f7d

Browse files
marcelwgnyaira2marcofranzen99Lamparter
authored
Feature: Moved Settings button to the Sidebar (#16911)
Signed-off-by: Marcel W. <[email protected]> Co-authored-by: Yair <[email protected]> Co-authored-by: Marco Franzen <[email protected]> Co-authored-by: Lamparter <[email protected]>
1 parent edcac0f commit 26a1f7d

35 files changed

+224
-82
lines changed

src/Files.App/UserControls/Sidebar/ISidebarItemModel.cs renamed to src/Files.App.Controls/Sidebar/ISidebarItemModel.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using Microsoft.UI.Xaml;
5-
using Microsoft.UI.Xaml.Controls;
6-
7-
namespace Files.App.UserControls.Sidebar
4+
namespace Files.App.Controls
85
{
96
public interface ISidebarItemModel : INotifyPropertyChanged
107
{
@@ -38,5 +35,10 @@ public interface ISidebarItemModel : INotifyPropertyChanged
3835
/// The tooltip used when hovering over this item in the sidebar
3936
/// </summary>
4037
object ToolTip { get; }
38+
39+
/// <summary>
40+
/// Indicates whether the children should have an indentation or not.
41+
/// </summary>
42+
bool PaddedItem { get; }
4143
}
4244
}

src/Files.App/UserControls/Sidebar/ISidebarViewModel.cs renamed to src/Files.App.Controls/Sidebar/ISidebarViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Windows.ApplicationModel.DataTransfer;
77
using Windows.Foundation;
88

9-
namespace Files.App.UserControls.Sidebar
9+
namespace Files.App.Controls
1010
{
1111
public record ItemDroppedEventArgs(object DropTarget, DataPackageView DroppedItem, SidebarItemDropPosition dropPosition, DragEventArgs RawEvent) { }
1212
public record ItemDragOverEventArgs(object DropTarget, DataPackageView DroppedItem, SidebarItemDropPosition dropPosition, DragEventArgs RawEvent) { }

src/Files.App/UserControls/Sidebar/SidebarDisplayMode.cs renamed to src/Files.App.Controls/Sidebar/SidebarDisplayMode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
namespace Files.App.UserControls.Sidebar
4+
namespace Files.App.Controls
55
{
66
/// <summary>
77
/// The display mode of the <see cref="SidebarView"/>

src/Files.App/UserControls/Sidebar/SidebarItem.Properties.cs renamed to src/Files.App.Controls/Sidebar/SidebarItem.Properties.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using Microsoft.UI.Xaml;
5-
using Microsoft.UI.Xaml.Controls;
6-
7-
namespace Files.App.UserControls.Sidebar
4+
namespace Files.App.Controls
85
{
96
public sealed partial class SidebarItem : Control
107
{

src/Files.App/UserControls/Sidebar/SidebarItem.cs renamed to src/Files.App.Controls/Sidebar/SidebarItem.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33

44
using CommunityToolkit.WinUI;
55
using Microsoft.UI.Input;
6-
using Microsoft.UI.Xaml;
76
using Microsoft.UI.Xaml.Automation;
87
using Microsoft.UI.Xaml.Automation.Peers;
9-
using Microsoft.UI.Xaml.Controls;
10-
using Microsoft.UI.Xaml.Controls.Primitives;
118
using System.Collections.Specialized;
129
using Windows.ApplicationModel.DataTransfer;
1310

14-
namespace Files.App.UserControls.Sidebar
11+
namespace Files.App.Controls
1512
{
1613
public sealed partial class SidebarItem : Control
1714
{
@@ -21,9 +18,6 @@ public sealed partial class SidebarItem : Control
2118
public bool IsGroupHeader => Item?.Children is not null;
2219
public bool CollapseEnabled => DisplayMode != SidebarDisplayMode.Compact;
2320

24-
// TODO: Do not use localized text for comparison. This is a workaround to avoid major refactoring for now, it should be done any time soon
25-
public bool IsHomeItem => Item?.Text == "Home".GetLocalizedResource() && Owner?.MenuItemsSource is IList enumerable && enumerable.IndexOf(Item) == 0;
26-
2721
private bool hasChildSelection => selectedChildItem != null;
2822
private bool isPointerOver = false;
2923
private bool isClicking = false;
@@ -323,7 +317,7 @@ private void UpdateExpansionState(bool useAnimations = true)
323317
{
324318
if (Item?.Children is null || !CollapseEnabled)
325319
{
326-
VisualStateManager.GoToState(this, IsHomeItem ? "NoExpansionWithPadding" : "NoExpansion", useAnimations);
320+
VisualStateManager.GoToState(this, Item?.PaddedItem == true ? "NoExpansionWithPadding" : "NoExpansion", useAnimations);
327321
}
328322
else if (!HasChildren)
329323
{

src/Files.App/UserControls/Sidebar/SidebarItemAutomationPeer.cs renamed to src/Files.App.Controls/Sidebar/SidebarItemAutomationPeer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using Microsoft.UI.Xaml.Automation.Peers;
88
using Microsoft.UI.Xaml.Automation.Provider;
99

10-
namespace Files.App.UserControls.Sidebar
10+
namespace Files.App.Controls
1111
{
1212
public sealed partial class SidebarItemAutomationPeer : FrameworkElementAutomationPeer, IInvokeProvider, IExpandCollapseProvider, ISelectionItemProvider
1313
{

src/Files.App/UserControls/Sidebar/SidebarItemDropPosition.cs renamed to src/Files.App.Controls/Sidebar/SidebarItemDropPosition.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
namespace Files.App.UserControls.Sidebar
4+
namespace Files.App.Controls
55
{
66
/// <summary>
77
/// The position of the item that was dropped on the sidebar item.

src/Files.App/Styles/SidebarStyles.xaml renamed to src/Files.App.Controls/Sidebar/SidebarStyles.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
66
xmlns:controls="using:Files.App.Controls"
7-
xmlns:local="using:Files.App.UserControls.Sidebar"
8-
xmlns:usercontrols="using:Files.App.UserControls">
7+
xmlns:local="using:Files.App.Controls">
98

109
<x:Double x:Key="SidebarOpenPaneLength">300</x:Double>
1110
<x:Double x:Key="SidebarNegativeOpenPaneLength">-300</x:Double>

src/Files.App/UserControls/Sidebar/SidebarView.Properties.cs renamed to src/Files.App.Controls/Sidebar/SidebarView.Properties.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using Microsoft.UI.Xaml;
5-
6-
namespace Files.App.UserControls.Sidebar
4+
namespace Files.App.Controls
75
{
86
public sealed partial class SidebarView
97
{

src/Files.App/UserControls/Sidebar/SidebarView.xaml renamed to src/Files.App.Controls/Sidebar/SidebarView.xaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<!-- Copyright (c) Files Community. Licensed under the MIT License. -->
22
<UserControl
3-
x:Class="Files.App.UserControls.Sidebar.SidebarView"
3+
x:Class="Files.App.Controls.SidebarView"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7-
xmlns:helpers="using:Files.App.Helpers"
87
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
98
HorizontalAlignment="Stretch"
109
Loaded="SidebarView_Loaded"
@@ -118,7 +117,6 @@
118117
Visibility="{Binding ElementName=PaneRoot, Path=Visibility, Mode=OneWay}">
119118
<UserControl
120119
x:Name="SidebarResizerControl"
121-
AutomationProperties.Name="{helpers:ResourceString Name=ResizeElementControl/AutomationProperties/Name}"
122120
IsTabStop="True"
123121
KeyDown="SidebarResizerControl_KeyDown"
124122
UseSystemFocusVisuals="True" />

0 commit comments

Comments
 (0)