-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Feature: Integrate Advanced Security page into properties window #11930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
yaira2
merged 57 commits into
files-community:main
from
0x5bfa:5bfa/integrate-securityadv
Apr 20, 2023
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
7c6a75a
First step
0x5bfa 1646d5c
Remove ununsed codes
0x5bfa 5ec6f2d
Merge branch 'main' into 5bfa/integrate-securityadv
yaira2 150127f
Cleanup MainPropertiesPage code-behind
0x5bfa a6c486f
Merge branch '5bfa/integrate-securityadv' of https://github.com/onein…
0x5bfa fd86b36
switch case to switch expression
0x5bfa e78b580
Small fix
0x5bfa 3637a50
Fix issues
0x5bfa ca1a239
Merge branch 'main' into 5bfa/integrate-securityadv
0x5bfa 47d266c
Fixed build issue
0x5bfa 10eb58c
Merge branch '5bfa/integrate-securityadv' of https://github.com/onein…
0x5bfa ccfa715
Fixed issue
0x5bfa 960d9f7
Added backward navigation functionality
0x5bfa d02be92
Fixed button style
0x5bfa c9f9c00
Fix corner radius
0x5bfa 8b94438
Merge branch 'main' into 5bfa/integrate-securityadv
0x5bfa 4027dc8
Simplify
0x5bfa dab4dbb
Merge branch '5bfa/integrate-securityadv' of https://github.com/0x5bf…
0x5bfa 9c73741
Fix unrenamed properties
0x5bfa 9b928ab
Merge branch 'main' into 5bfa/integrate-securityadv
0x5bfa 2190a83
Fix: Requested changes
0x5bfa 108163e
Merge branch '5bfa/integrate-securityadv' of https://github.com/0x5bf…
0x5bfa 76bedaf
Add alternative color
0x5bfa e74932f
Update resources
0x5bfa 36beecd
Update
0x5bfa 81efcc0
Add BaseProperties property so that main props page can access file info
0x5bfa 6284c51
Update src/Files.App/Views/Properties/SecurityPage.xaml
0x5bfa bf812d0
Fix: Requested Changes
0x5bfa b36264e
fix: requested changes 2
0x5bfa ee16980
Merge branch 'main' into 5bfa/integrate-securityadv
0x5bfa a31c40d
Add missing security functions 1
0x5bfa 1fcd456
Merge branch '5bfa/integrate-securityadv' of https://github.com/0x5bf…
0x5bfa a3ee930
Merge remote-tracking branch 'upstream/main' into 5bfa/integrate-secu…
0x5bfa d14f8ee
Update
0x5bfa fb8e87b
Merge branch 'main' into 5bfa/integrate-securityadv
yaira2 f644674
Fix: Requested Changes
0x5bfa fab9d0b
Merge branch '5bfa/integrate-securityadv' of https://github.com/0x5bf…
0x5bfa 28c2e60
Merge branch 'main' into 5bfa/integrate-securityadv
0x5bfa 501078a
Update src/Files.App/Views/Properties/GeneralPage.xaml
0x5bfa 1db6c25
Update src/Files.App/Views/Properties/GeneralPage.xaml
0x5bfa 554767b
Update src/Files.App/Views/Properties/GeneralPage.xaml
0x5bfa 827bb78
Update src/Files.App/Views/Properties/DetailsPage.xaml
0x5bfa 6004de5
Update src/Files.App/Views/Properties/ShortcutPage.xaml
0x5bfa d00db04
Update src/Files.App/Views/Properties/ShortcutPage.xaml
0x5bfa 13d2ccc
Fix: Requested changes & backward navigation issues
0x5bfa f6cb440
merge
0x5bfa ca3519f
Fix: Requested changes
0x5bfa f1156db
Fix: Requested changes
0x5bfa 5894538
Fix: Requested changes
0x5bfa 339288b
Fix: Requested changes
0x5bfa a41dfd2
Merge branch 'main' into 5bfa/integrate-securityadv
0x5bfa 82fe9c4
Fix: Revert unrelated changes
0x5bfa f533e8e
Merge branch '5bfa/integrate-securityadv' of https://github.com/0x5bf…
0x5bfa 6e9626c
Fix: Fix build errors
0x5bfa a16d569
Update FilePropertiesHelpers.cs
0x5bfa 266ac39
merge main into here
0x5bfa 8df3acf
Fix
0x5bfa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/Files.App/DataModels/NavigationViewItemButtonStyleItem.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using Files.Backend.Enums; | ||
using Microsoft.UI.Xaml; | ||
|
||
namespace Files.App.DataModels | ||
{ | ||
public class NavigationViewItemButtonStyleItem : ObservableObject | ||
{ | ||
public string? Name; | ||
|
||
public PropertiesNavigationViewItemType ItemType; | ||
|
||
private Style _OpacityIconStyle = (Style)Application.Current.Resources["ColorIconGeneralProperties"]; | ||
public Style OpacityIconStyle | ||
{ | ||
get => _OpacityIconStyle; | ||
set => SetProperty(ref _OpacityIconStyle, value); | ||
} | ||
|
||
private bool _IsSelected; | ||
public bool IsSelected | ||
{ | ||
get => _IsSelected; | ||
set => SetProperty(ref _IsSelected, value); | ||
} | ||
|
||
private bool _IsCompact; | ||
public bool IsCompact | ||
{ | ||
get => _IsCompact; | ||
set => SetProperty(ref _IsCompact, value); | ||
} | ||
} | ||
} |
139 changes: 139 additions & 0 deletions
139
src/Files.App/DataModels/PropertiesNavigationViewItemFactory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
using System.Collections.ObjectModel; | ||
using Files.App.DataModels.NavigationControlItems; | ||
using Files.App.Extensions; | ||
using Files.App.Filesystem; | ||
using Files.Backend.Enums; | ||
using Files.Backend.Helpers; | ||
using Microsoft.UI.Xaml; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Files.App.DataModels | ||
{ | ||
public static class PropertiesNavigationViewItemFactory | ||
{ | ||
public static ObservableCollection<NavigationViewItemButtonStyleItem> Initialize(object item) | ||
{ | ||
ObservableCollection<NavigationViewItemButtonStyleItem> PropertiesNavigationViewItems = new(); | ||
|
||
var generalItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "General".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.General, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconGeneralProperties"], | ||
}; | ||
var securityItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Security".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Security, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconSecurityProperties"], | ||
}; | ||
var hashesItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Hashes".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Hashes, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconHashesProperties"], | ||
}; | ||
var shortcutItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Shortcut".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Shortcut, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconShortcutProperties"], | ||
}; | ||
var libraryItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Library".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Library, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconLibraryProperties"], | ||
}; | ||
var detailsItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Details".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Details, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconDetailsProperties"], | ||
}; | ||
var customizationItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Customization".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Customization, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconCustomizationProperties"], | ||
}; | ||
var compatibilityItem = new NavigationViewItemButtonStyleItem() | ||
{ | ||
Name = "Compatibility".GetLocalizedResource(), | ||
ItemType = PropertiesNavigationViewItemType.Compatibility, | ||
OpacityIconStyle = (Style)Application.Current.Resources["ColorIconCompatibilityProperties"], | ||
}; | ||
|
||
PropertiesNavigationViewItems.Add(generalItem); | ||
PropertiesNavigationViewItems.Add(securityItem); | ||
PropertiesNavigationViewItems.Add(hashesItem); | ||
PropertiesNavigationViewItems.Add(shortcutItem); | ||
PropertiesNavigationViewItems.Add(libraryItem); | ||
PropertiesNavigationViewItems.Add(detailsItem); | ||
PropertiesNavigationViewItems.Add(customizationItem); | ||
PropertiesNavigationViewItems.Add(compatibilityItem); | ||
|
||
if (item is List<ListedItem> listedItems) | ||
{ | ||
var commonFileExt = listedItems.Select(x => x.FileExtension).Distinct().Count() == 1 ? listedItems.First().FileExtension : null; | ||
var compatibilityItemEnabled = listedItems.All(listedItem => FileExtensionHelpers.IsExecutableFile(listedItem is ShortcutItem sht ? sht.TargetPath : commonFileExt, true)); | ||
|
||
if (!compatibilityItemEnabled) | ||
PropertiesNavigationViewItems.Remove(compatibilityItem); | ||
|
||
PropertiesNavigationViewItems.Remove(libraryItem); | ||
PropertiesNavigationViewItems.Remove(shortcutItem); | ||
PropertiesNavigationViewItems.Remove(detailsItem); | ||
PropertiesNavigationViewItems.Remove(securityItem); | ||
PropertiesNavigationViewItems.Remove(customizationItem); | ||
PropertiesNavigationViewItems.Remove(hashesItem); | ||
} | ||
else if (item is ListedItem listedItem) | ||
{ | ||
var isShortcut = listedItem.IsShortcut; | ||
var isLibrary = listedItem.IsLibrary; | ||
var fileExt = listedItem.FileExtension; | ||
var isFolder = listedItem.PrimaryItemAttribute == Windows.Storage.StorageItemTypes.Folder; | ||
|
||
var securityItemEnabled = !isLibrary && !listedItem.IsRecycleBinItem; | ||
var hashItemEnabled = !(isFolder && !listedItem.IsArchive) && !isLibrary && !listedItem.IsRecycleBinItem; | ||
var detailsItemEnabled = fileExt is not null && !isShortcut && !isLibrary; | ||
var customizationItemEnabled = !isLibrary && ((isFolder && !listedItem.IsArchive) || (isShortcut && !listedItem.IsLinkItem)); | ||
var compatibilityItemEnabled = FileExtensionHelpers.IsExecutableFile(listedItem is ShortcutItem sht ? sht.TargetPath : fileExt, true); | ||
|
||
if (!securityItemEnabled) | ||
PropertiesNavigationViewItems.Remove(securityItem); | ||
|
||
if (!hashItemEnabled) | ||
PropertiesNavigationViewItems.Remove(hashesItem); | ||
|
||
if (!isShortcut) | ||
PropertiesNavigationViewItems.Remove(shortcutItem); | ||
|
||
if (!isLibrary) | ||
PropertiesNavigationViewItems.Remove(libraryItem); | ||
|
||
if (!detailsItemEnabled) | ||
PropertiesNavigationViewItems.Remove(detailsItem); | ||
|
||
if (!customizationItemEnabled) | ||
PropertiesNavigationViewItems.Remove(customizationItem); | ||
|
||
if (!compatibilityItemEnabled) | ||
PropertiesNavigationViewItems.Remove(compatibilityItem); | ||
} | ||
else if (item is DriveItem) | ||
{ | ||
PropertiesNavigationViewItems.Remove(hashesItem); | ||
PropertiesNavigationViewItems.Remove(shortcutItem); | ||
PropertiesNavigationViewItems.Remove(libraryItem); | ||
PropertiesNavigationViewItems.Remove(detailsItem); | ||
PropertiesNavigationViewItems.Remove(customizationItem); | ||
PropertiesNavigationViewItems.Remove(compatibilityItem); | ||
} | ||
|
||
return PropertiesNavigationViewItems; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Files.App/DataModels/PropertiesPageNavigationParameter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Microsoft.UI.Windowing; | ||
using Microsoft.UI.Xaml; | ||
using System.Threading; | ||
|
||
namespace Files.App.DataModels | ||
{ | ||
public class PropertiesPageNavigationParameter | ||
{ | ||
public CancellationTokenSource CancellationTokenSource; | ||
|
||
public object Parameter; | ||
|
||
public IShellPage AppInstance; | ||
|
||
public Window Window; | ||
|
||
public AppWindow AppWindow; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.