Skip to content

Commit e94244e

Browse files
committed
Merge branch 'main' of https://github.com/files-community/Files into main
2 parents 2783631 + c489c48 commit e94244e

9 files changed

+34
-187
lines changed

Files/Strings/en-US/Resources.resw

+1-1
Original file line numberDiff line numberDiff line change
@@ -1953,4 +1953,4 @@
19531953
<data name="BaseLayoutContextFlyoutColumn.Text" xml:space="preserve">
19541954
<value>Column View</value>
19551955
</data>
1956-
</root>
1956+
</root>

Files/Views/ColumnShellPage.xaml.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,7 @@ private async void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs
900900
{
901901
ContentPage = await GetContentOrNullAsync();
902902
NavigationToolbar.ClearSearchBoxQueryText(true);
903-
if (ItemDisplayFrame.CurrentSourcePageType == typeof(GenericFileBrowser)
904-
|| ItemDisplayFrame.CurrentSourcePageType == typeof(GridViewBrowser))
903+
if (ItemDisplayFrame.CurrentSourcePageType == typeof(ColumnViewBase))
905904
{
906905
// Reset DataGrid Rows that may be in "cut" command mode
907906
ContentPage.ResetItemOpacity();
@@ -930,7 +929,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo
930929
var alt = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Menu);
931930
var shift = args.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift);
932931
var tabInstance = CurrentPageType == typeof(GenericFileBrowser)
933-
|| CurrentPageType == typeof(GridViewBrowser);
932+
|| CurrentPageType == typeof(GridViewBrowser) || CurrentPageType == typeof(ColumnViewBrowser) || CurrentPageType == typeof(ColumnViewBase);
934933

935934
switch (c: ctrl, s: shift, a: alt, t: tabInstance, k: args.KeyboardAccelerator.Key)
936935
{
@@ -1053,7 +1052,8 @@ await FilesystemHelpers.DeleteItemsAsync(
10531052
switch (args.KeyboardAccelerator.Key)
10541053
{
10551054
case VirtualKey.F2: //F2, rename
1056-
if (CurrentPageType == typeof(GenericFileBrowser) || CurrentPageType == typeof(GridViewBrowser))
1055+
if (CurrentPageType == typeof(GenericFileBrowser) || CurrentPageType == typeof(GridViewBrowser) || CurrentPageType == typeof(ColumnViewBrowser) || CurrentPageType == typeof(ColumnViewBase))
1056+
10571057
{
10581058
if (ContentPage.IsItemSelected)
10591059
{
@@ -1340,7 +1340,7 @@ public void NavigateToPath(string navigationPath, Type sourcePageType, Navigatio
13401340
if (navArgs != null && navArgs.AssociatedTabInstance != null)
13411341
{
13421342
ItemDisplayFrame.Navigate(
1343-
sourcePageType == null ? typeof(ColumnViewBase) : sourcePageType,
1343+
sourcePageType = typeof(ColumnViewBase),
13441344
navArgs,
13451345
new SuppressNavigationTransitionInfo());
13461346
}
@@ -1355,8 +1355,7 @@ public void NavigateToPath(string navigationPath, Type sourcePageType, Navigatio
13551355
return;
13561356
}
13571357

1358-
ItemDisplayFrame.Navigate(
1359-
sourcePageType == null ? typeof(ColumnViewBase) : sourcePageType,
1358+
ItemDisplayFrame.Navigate(sourcePageType = typeof(ColumnViewBase),
13601359
new NavigationArguments()
13611360
{
13621361
NavPathParam = navigationPath,

Files/Views/LayoutModes/ColumnViewBase.xaml

+1-141
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,7 @@
1919
x:Name="PageRoot"
2020
mc:Ignorable="d">
2121
<local:BaseLayout.Resources>
22-
<Style x:Key="ListViewItemStandardContextFlyout" TargetType="ListViewItem">
23-
<Setter Property="ContextFlyout" Value="{StaticResource BaseLayoutItemContextFlyout}" />
24-
<Setter Property="Padding" Value="0"/>
25-
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
26-
<Setter Property="BorderThickness" Value="0"/>
27-
</Style>
28-
<Style x:Key="ListViewItemRecycleBinContextFlyout" TargetType="ListViewItem">
29-
<Setter Property="ContextFlyout" Value="{StaticResource BaseLayoutRecycleBinItemContextFlyout}" />
30-
<Setter Property="Padding" Value="0"/>
31-
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
32-
<Setter Property="BorderThickness" Value="0"/>
33-
</Style>
34-
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
22+
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
3523
<converters:BoolToVisibilityConverter
3624
x:Key="NegatedBoolToVisibilityConverter"
3725
FalseValue="Visible"
@@ -43,134 +31,6 @@
4331
<Setter Property="TitleBarVisibility" Value="Collapsed"></Setter>
4432
<Setter Property="BorderThickness" Value="0,0,1,0"></Setter>
4533
</Style>
46-
<!--<DataTemplate x:Name="ListViewBrowserTemplate" x:DataType="local2:ListedItem">
47-
<Grid Margin="10,0"
48-
Height="32"
49-
HorizontalAlignment="Stretch"
50-
VerticalAlignment="Stretch"
51-
Background="Transparent"
52-
IsRightTapEnabled="True"
53-
RightTapped="StackPanel_RightTapped"
54-
ToolTipService.ToolTip="{x:Bind ItemName, Mode=OneWay}">
55-
<Grid.ColumnDefinitions>
56-
<ColumnDefinition Width="24" />
57-
<ColumnDefinition Width="*" />
58-
<ColumnDefinition Width="Auto" />
59-
</Grid.ColumnDefinitions>
60-
<Grid
61-
Grid.Column="0"
62-
Width="24"
63-
Height="24"
64-
Opacity="{x:Bind Opacity, Mode=OneWay}"
65-
Tag="ItemImage">
66-
<Image
67-
x:Name="Picture"
68-
HorizontalAlignment="Stretch"
69-
VerticalAlignment="Stretch"
70-
x:Load="{x:Bind LoadFileIcon, Mode=OneWay}"
71-
x:Phase="1"
72-
Source="{x:Bind FileImage, Mode=OneWay}"
73-
Stretch="Uniform" />
74-
<Image
75-
x:Name="FolderGlyph"
76-
HorizontalAlignment="Stretch"
77-
VerticalAlignment="Stretch"
78-
x:Load="{x:Bind LoadFolderGlyph, Mode=OneWay}"
79-
x:Phase="1"
80-
Stretch="Uniform">
81-
<Image.Source>
82-
<SvgImageSource
83-
RasterizePixelHeight="256"
84-
RasterizePixelWidth="256"
85-
UriSource="{x:Bind FolderIconSourceLarge}" />
86-
</Image.Source>
87-
</Image>
88-
<Viewbox
89-
x:Name="TypeUnknownGlyph"
90-
MaxWidth="24"
91-
MaxHeight="24"
92-
HorizontalAlignment="Stretch"
93-
VerticalAlignment="Stretch"
94-
x:Load="{x:Bind LoadUnknownTypeGlyph, Mode=OneWay}"
95-
x:Phase="1">
96-
<FontIcon Glyph="&#xE7C3;" />
97-
</Viewbox>
98-
<Image
99-
x:Name="IconOverlay"
100-
Width="16"
101-
Height="16"
102-
HorizontalAlignment="Left"
103-
VerticalAlignment="Bottom"
104-
x:Load="True"
105-
x:Phase="1"
106-
Source="{x:Bind IconOverlay, Mode=OneWay}"
107-
Stretch="Uniform" />
108-
<Viewbox
109-
x:Name="WebShortcutGlyph"
110-
MaxWidth="24"
111-
MaxHeight="24"
112-
HorizontalAlignment="Stretch"
113-
VerticalAlignment="Stretch"
114-
x:Load="{x:Bind LoadWebShortcutGlyph, Mode=OneWay}"
115-
x:Phase="1">
116-
<FontIcon FontSize="20" Glyph="&#xE71B;" />
117-
</Viewbox>
118-
<Border
119-
x:Name="ShortcutGlyphElement"
120-
HorizontalAlignment="Left"
121-
VerticalAlignment="Bottom"
122-
x:Load="{x:Bind IsShortcutItem}"
123-
x:Phase="1"
124-
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
125-
BorderBrush="{ThemeResource ApplicationForegroundThemeBrush}"
126-
BorderThickness="1">
127-
<FontIcon
128-
FontFamily="{StaticResource CustomGlyph}"
129-
FontSize="14"
130-
Glyph="&#xF10A;" />
131-
</Border>
132-
</Grid>
133-
<Grid
134-
Grid.Column="1"
135-
Margin="5,0,5,0"
136-
HorizontalAlignment="Left">
137-
<TextBlock
138-
x:Name="ItemName"
139-
Grid.Column="1"
140-
HorizontalAlignment="Stretch"
141-
VerticalAlignment="Center"
142-
Text="{x:Bind ItemName, Mode=OneWay}"
143-
TextTrimming="CharacterEllipsis"
144-
TextWrapping="NoWrap" />
145-
</Grid>
146-
<Popup
147-
x:Name="EditPopup"
148-
Grid.Column="1"
149-
x:Load="False">
150-
<TextBox
151-
x:Name="ListViewTextBoxItemName"
152-
153-
Margin="0"
154-
HorizontalAlignment="Stretch"
155-
VerticalAlignment="Stretch"
156-
Text="{x:Bind ItemName, Mode=OneWay}"
157-
TextAlignment="Center"
158-
TextChanged="ListViewTextBoxItemName_TextChanged"
159-
TextWrapping="Wrap" />
160-
</Popup>
161-
<Grid Grid.Column="2">
162-
<FontIcon
163-
x:Name="CloudDriveSyncStatusGlyph"
164-
Margin="0,0,0,0"
165-
VerticalAlignment="Center" HorizontalAlignment="Center"
166-
x:Load="{x:Bind ((local3:CloudDriveSyncStatusUI)SyncStatusUI).LoadSyncStatus, Mode=OneWay}"
167-
x:Phase="2"
168-
FontSize="18"
169-
Foreground="{x:Bind ((local3:CloudDriveSyncStatusUI)SyncStatusUI).Foreground, Mode=OneWay}"
170-
Glyph="{x:Bind ((local3:CloudDriveSyncStatusUI)SyncStatusUI).Glyph, Mode=OneWay}" />
171-
</Grid>
172-
</Grid>
173-
</DataTemplate>-->
17434
</local:BaseLayout.Resources>
17535
<Grid
17636
x:Name="RootGrid"

Files/Views/LayoutModes/ColumnViewBase.xaml.cs

+14-16
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ public sealed partial class ColumnViewBase : BaseLayout
3535
private ListedItem renamingItem;
3636
private string oldItemName;
3737
private TextBlock textBlock;
38+
private ListViewItem navigatedfolder;
3839

3940
public ColumnViewBase() : base()
4041
{
4142
this.InitializeComponent();
42-
//this.DataContext = this;
43-
//base.BaseLayoutContextFlyout = BaseLayoutContextFlyout;
44-
//base.BaseLayoutItemContextFlyout = BaseLayoutItemContextFlyout;
4543
var selectionRectangle = RectangleSelection.Create(FileList, SelectionRectangle, FileList_SelectionChanged);
4644
tapDebounceTimer = DispatcherQueue.GetForCurrentThread().CreateTimer();
4745
}
@@ -65,9 +63,8 @@ private void ListViewTextBoxItemName_TextChanged(object sender, TextChangedEvent
6563
}
6664
public static event EventHandler ItemInvoked;
6765

68-
protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
69-
{
70-
base.OnNavigatedTo(eventArgs);
66+
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
67+
{ base.OnNavigatedTo(eventArgs);
7168
var param = (eventArgs.Parameter as NavigationArguments);
7269
//NavParam = param.NavPathParam;
7370
//var viewmodel = new ItemViewModel(FolderSettings);
@@ -79,6 +76,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
7976
{
8077
FileList.ItemsSource = ParentShellPageInstance.FilesystemViewModel.FilesAndFolders;
8178
ParentShellPageInstance.IsCurrentInstance = true;
79+
ColumnViewBrowser.columnparent.UpdatePathUIToWorkingDirectory(param.NavPathParam);
8280
}
8381
var parameters = (NavigationArguments)eventArgs.Parameter;
8482
if (parameters.IsLayoutSwitch)
@@ -513,6 +511,16 @@ private void FileListListItem_PointerPressed(object sender, PointerRoutedEventAr
513511
}
514512
}
515513
}
514+
private void Grid_Loaded(object sender, RoutedEventArgs e)
515+
{
516+
// This is the best way I could find to set the context flyout, as doing it in the styles isn't possible
517+
// because you can't use bindings in the setters
518+
DependencyObject item = VisualTreeHelper.GetParent(sender as Grid);
519+
while (!(item is ListViewItem))
520+
item = VisualTreeHelper.GetParent(item);
521+
var itemContainer = item as ListViewItem;
522+
itemContainer.ContextFlyout = ItemContextMenuFlyout;
523+
}
516524
private async void FileList_ChoosingItemContainer(ListViewBase sender, ChoosingItemContainerEventArgs args)
517525
{
518526
if (args.ItemContainer == null)
@@ -532,15 +540,5 @@ private async void FileList_ChoosingItemContainer(ListViewBase sender, ChoosingI
532540
await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(item, 24);
533541
}
534542
}
535-
private void Grid_Loaded(object sender, RoutedEventArgs e)
536-
{
537-
// This is the best way I could find to set the context flyout, as doing it in the styles isn't possible
538-
// because you can't use bindings in the setters
539-
DependencyObject item = VisualTreeHelper.GetParent(sender as Grid);
540-
while (!(item is ListViewItem))
541-
item = VisualTreeHelper.GetParent(item);
542-
var itemContainer = item as ListViewItem;
543-
itemContainer.ContextFlyout = ItemContextMenuFlyout;
544-
}
545543
}
546544
}

Files/Views/LayoutModes/ColumnViewBrowser.xaml

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<local:BaseLayout
1+
<local:BaseLayout
22
x:Class="Files.Views.LayoutModes.ColumnViewBrowser"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -21,18 +21,6 @@
2121
x:Name="PageRoot"
2222
mc:Ignorable="d">
2323
<local:BaseLayout.Resources>
24-
<Style x:Key="ListViewItemStandardContextFlyout" TargetType="ListViewItem">
25-
<Setter Property="ContextFlyout" Value="{StaticResource BaseLayoutItemContextFlyout}" />
26-
<Setter Property="Padding" Value="0"/>
27-
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
28-
<Setter Property="BorderThickness" Value="0"/>
29-
</Style>
30-
<Style x:Key="ListViewItemRecycleBinContextFlyout" TargetType="ListViewItem">
31-
<Setter Property="ContextFlyout" Value="{StaticResource BaseLayoutRecycleBinItemContextFlyout}" />
32-
<Setter Property="Padding" Value="0"/>
33-
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
34-
<Setter Property="BorderThickness" Value="0"/>
35-
</Style>
3624
<converters:BoolNegationConverter x:Key="BoolNegationConverter" />
3725
<converters:BoolToVisibilityConverter
3826
x:Key="NegatedBoolToVisibilityConverter"
@@ -44,6 +32,7 @@
4432
<Setter Property="Background" Value="Transparent"/>
4533
<Setter Property="TitleBarVisibility" Value="Collapsed"></Setter>
4634
<Setter Property="BorderThickness" Value="0,0,1,0"></Setter>
35+
<Setter Property="Width" Value="300"/>
4736
</Style>
4837
</local:BaseLayout.Resources>
4938
<Grid
@@ -81,8 +70,7 @@
8170
Background="Transparent"
8271
IsRightTapEnabled="True"
8372
RightTapped="StackPanel_RightTapped"
84-
ToolTipService.ToolTip="{x:Bind ItemName, Mode=OneWay}"
85-
Loaded="Grid_Loaded">
73+
ToolTipService.ToolTip="{x:Bind ItemName, Mode=OneWay}" Loaded="Grid_Loaded">
8674
<Grid.ColumnDefinitions>
8775
<ColumnDefinition Width="24" />
8876
<ColumnDefinition Width="*" />

Files/Views/LayoutModes/ColumnViewBrowser.xaml.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ public sealed partial class ColumnViewBrowser : BaseLayout
4444
private ListedItem renamingItem;
4545
private string oldItemName;
4646
private TextBlock textBlock;
47+
public static IShellPage columnparent;
48+
private NavigationArguments parameters;
49+
private ListViewItem navigatedfolder;
4750

4851
public ColumnViewBrowser() : base()
4952
{
5053
this.InitializeComponent();
5154
ColumnViewBase.ItemInvoked += ColumnViewBase_ItemInvoked;
5255
//this.DataContext = this;
53-
//base.BaseLayoutContextFlyout = BaseLayoutContextFlyout;
54-
//base.BaseLayoutItemContextFlyout = BaseLayoutItemContextFlyout;
5556
var selectionRectangle = RectangleSelection.Create(FileList, SelectionRectangle, FileList_SelectionChanged);
5657
tapDebounceTimer = DispatcherQueue.GetForCurrentThread().CreateTimer();
5758
}
@@ -123,7 +124,8 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
123124
{
124125
FileList.ItemsSource = ParentShellPageInstance.FilesystemViewModel.FilesAndFolders;
125126
}
126-
var parameters = (NavigationArguments)eventArgs.Parameter;
127+
columnparent = ParentShellPageInstance;
128+
parameters = (NavigationArguments)eventArgs.Parameter;
127129
if (parameters.IsLayoutSwitch)
128130
{
129131
ReloadItemIcons();
@@ -358,7 +360,6 @@ public override void Dispose()
358360

359361
private void FileList_SelectionChanged(object sender, SelectionChangedEventArgs e)
360362
{
361-
362363
if (e != null)
363364
{
364365
// Do not commit rename if SelectionChanged is due to selction rectangle (#3660)
@@ -421,6 +422,7 @@ private void FileList_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
421422
{
422423
if (!IsRenamingItem && !ParentShellPageInstance.NavigationToolbar.IsEditModeEnabled)
423424
{
425+
424426
if (App.InteractionViewModel.IsQuickLookEnabled)
425427
{
426428
QuickLookHelpers.ToggleQuickLook(ParentShellPageInstance);

Files/Views/LayoutModes/GenericFileBrowser.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,4 +421,4 @@
421421
StrokeThickness="1" />
422422
</Canvas>
423423
</Grid>
424-
</local:BaseLayout>
424+
</local:BaseLayout>

Files/Views/LayoutModes/GridViewBrowser.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
x:Key="NegatedBoolToVisibilityConverter"
3232
FalseValue="Visible"
3333
TrueValue="Collapsed" />
34-
34+
3535
<converters1:BoolToSelectionMode x:Key="BoolToSelectionModeConverter" />
3636

3737
<DataTemplate x:Name="GridViewBrowserTemplate" x:DataType="local2:ListedItem">

Files/Views/LayoutModes/GridViewBrowser.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private void StackPanel_RightTapped(object sender, RightTappedRoutedEventArgs e)
176176
var parentContainer = DependencyObjectHelpers.FindParent<GridViewItem>(e.OriginalSource as DependencyObject);
177177
if (!parentContainer.IsSelected)
178178
{
179-
SetSelectedItemOnUi(FileList.ItemFromContainer(parentContainer) as ListedItem);
179+
SetSelectedItemOnUi(FileList.ItemFromContainer(parentContainer) as ListedItem);
180180
}
181181
}
182182

0 commit comments

Comments
 (0)