Skip to content

Commit af07b29

Browse files
committed
Merge remote-tracking branch 'origin/folder-properties' into v0.7-changes
2 parents c483b53 + 51701eb commit af07b29

File tree

6 files changed

+43
-18
lines changed

6 files changed

+43
-18
lines changed

Files/Controls/RibbonArea.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,12 @@
981981
</AppBarButton.Icon>
982982
</AppBarButton>
983983
<AppBarButton MinWidth="40" LabelPosition="{x:Bind RibbonViewModel.ItemLabelPosition, Mode=OneWay}" Style="{StaticResource AppBarButtonRevealStyle}" CornerRadius="2" Click="{x:Bind parentPage.instanceInteraction.OpenItem_Click}" x:Name="OpenWithButton" IsEnabled="{x:Bind parentPage.HomeItems.isEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Label="Open With" Icon="OpenWith"/>
984+
<AppBarSeparator/>
985+
<AppBarButton MinWidth="40" LabelPosition="{x:Bind RibbonViewModel.ItemLabelPosition, Mode=OneWay}" Style="{StaticResource AppBarButtonRevealStyle}" CornerRadius="2" Click="{x:Bind parentPage.instanceInteraction.ShowFolderPropertiesButton_Click}" x:Name="ShowFolderPropertiesButton" IsEnabled="{x:Bind parentPage.AlwaysPresentCommands.isEnabled, Mode=OneWay}" Label="Folder Properties">
986+
<AppBarButton.Icon>
987+
<FontIcon Glyph="&#xE946;"/>
988+
</AppBarButton.Icon>
989+
</AppBarButton>
984990
</controls:RibbonPage.PageContent>
985991
</controls:RibbonPage>
986992
</Custom:TabViewItem>

Files/Filesystem/ItemViewModel.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ public class ItemViewModel : INotifyPropertyChanged
3535
public EmptyFolderTextState EmptyTextState { get; set; } = new EmptyFolderTextState();
3636
public LoadingIndicator LoadIndicator { get; set; } = new LoadingIndicator();
3737
public ReadOnlyObservableCollection<ListedItem> FilesAndFolders { get; }
38+
public ListedItem currentFolder { get => _rootFolderItem; }
3839
public CollectionViewSource viewSource;
3940
public UniversalPath Universal { get; } = new UniversalPath();
4041
private ObservableCollection<ListedItem> _filesAndFolders;
4142
private StorageFolderQueryResult _folderQueryResult;
4243
public StorageFileQueryResult _fileQueryResult;
4344
private CancellationTokenSource _cancellationTokenSource;
4445
private StorageFolder _rootFolder;
46+
private ListedItem _rootFolderItem;
4547
private QueryOptions _options;
4648
private volatile bool _filesRefreshing;
4749
private const int _step = 250;
@@ -448,6 +450,21 @@ public async void AddItemsToCollectionAsync(string path)
448450
try
449451
{
450452
_rootFolder = await StorageFolder.GetFolderFromPathAsync(Universal.path);
453+
var rootFolderProperties = await _rootFolder.GetBasicPropertiesAsync();
454+
455+
_rootFolderItem = new ListedItem(_rootFolder.FolderRelativeId)
456+
{
457+
FileName = _rootFolder.Name,
458+
FileDateReal = rootFolderProperties.DateModified,
459+
FileType = "Folder", //TODO: Take a look at folder.DisplayType
460+
FolderImg = Visibility.Visible,
461+
FileImg = null,
462+
FileIconVis = Visibility.Collapsed,
463+
FilePath = _rootFolder.Path,
464+
EmptyImgVis = Visibility.Collapsed,
465+
FileSize = null,
466+
FileSizeBytes = 0
467+
};
451468

452469
App.OccupiedInstance.RibbonArea.Back.IsEnabled = App.OccupiedInstance.ItemDisplayFrame.CanGoBack;
453470
App.OccupiedInstance.RibbonArea.Forward.IsEnabled = App.OccupiedInstance.ItemDisplayFrame.CanGoForward;

Files/GenericFileBrowser.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
<FontIcon Glyph="&#xE8A5;"/>
6565
</MenuFlyoutItem.Icon>
6666
</MenuFlyoutItem>
67+
<MenuFlyoutSeparator/>
68+
<MenuFlyoutItem Text="Properties" Click="{x:Bind AssociatedInteractions.ShowFolderPropertiesButton_Click}" x:Name="PropertiesFolder">
69+
<MenuFlyoutItem.Icon>
70+
<FontIcon Glyph="&#xE946;"/>
71+
</MenuFlyoutItem.Icon>
72+
</MenuFlyoutItem>
6773
</MenuFlyoutSubItem>
6874
</MenuFlyout>
6975

Files/Interacts/Interaction.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,13 @@ public async void ShowPropertiesButton_Click(object sender, RoutedEventArgs e)
477477
await App.propertiesDialog.ShowAsync(ContentDialogPlacement.Popup);
478478
}
479479

480+
public async void ShowFolderPropertiesButton_Click(object sender, RoutedEventArgs e)
481+
{
482+
App.propertiesDialog.accessiblePropertiesFrame.Tag = App.propertiesDialog;
483+
App.propertiesDialog.accessiblePropertiesFrame.Navigate(typeof(Properties), App.OccupiedInstance.instanceViewModel.currentFolder, new SuppressNavigationTransitionInfo());
484+
await App.propertiesDialog.ShowAsync(ContentDialogPlacement.Popup);
485+
}
486+
480487
private async void Manager_DataRequested(DataTransferManager sender, DataRequestedEventArgs args)
481488
{
482489
DataRequestDeferral dataRequestDeferral = args.Request.GetDeferral();

Files/PhotoAlbum.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
</MenuFlyoutItem.Icon>
6868
</MenuFlyoutItem>
6969
</MenuFlyoutSubItem>
70+
<MenuFlyoutSeparator/>
71+
<MenuFlyoutItem Text="Properties" Click="{x:Bind AssociatedInteractions.ShowFolderPropertiesButton_Click}" x:Name="PropertiesFolder">
72+
<MenuFlyoutItem.Icon>
73+
<FontIcon Glyph="&#xE946;"/>
74+
</MenuFlyoutItem.Icon>
75+
</MenuFlyoutItem>
7076
</MenuFlyout>
7177

7278
<MenuFlyout Opening="RightClickContextMenu_Opening" x:Key="BaseLayoutItemContextFlyout">

Files/Properties.xaml.cs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
using Files.Filesystem;
2-
using Files.Interacts;
3-
using System;
4-
using System.Collections;
5-
using System.Collections.Generic;
6-
using System.Collections.ObjectModel;
7-
using System.IO;
8-
using System.Linq;
9-
using System.Runtime.InteropServices.WindowsRuntime;
10-
using Windows.Foundation;
11-
using Windows.Foundation.Collections;
12-
using Windows.UI.Xaml;
132
using Windows.UI.Xaml.Controls;
14-
using Windows.UI.Xaml.Controls.Primitives;
15-
using Windows.UI.Xaml.Data;
16-
using Windows.UI.Xaml.Input;
17-
using Windows.UI.Xaml.Media;
183
using Windows.UI.Xaml.Navigation;
194

205
namespace Files
@@ -31,9 +16,7 @@ public Properties()
3116

3217
protected override void OnNavigatedTo(NavigationEventArgs e)
3318
{
34-
var result = e.Parameter as IEnumerable;
35-
IList<ListedItem> listedItems = result.OfType<ListedItem>().ToList();
36-
Item = listedItems[0];
19+
Item = e.Parameter as ListedItem;
3720
PropertiesDialog = Frame.Tag as ContentDialog;
3821
base.OnNavigatedTo(e);
3922
}

0 commit comments

Comments
 (0)