Skip to content
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

Feature: Added support for unblocking downloaded files #13504

Merged
merged 7 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,5 +677,19 @@ public bool IsPropertiesLoaded
get => isPropertiesLoaded;
set => SetProperty(ref isPropertiesLoaded, value);
}

private bool isDownloadedFile;
public bool IsDownloadedFile
{
get => isDownloadedFile;
set => SetProperty(ref isDownloadedFile, value);
}

private bool isUnblockFileSelected;
public bool IsUnblockFileSelected
{
get => isUnblockFileSelected;
set => SetProperty(ref isUnblockFileSelected, value);
}
}
}
3 changes: 3 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -3532,4 +3532,7 @@
<data name="ContributingArtist" xml:space="preserve">
<value>Contributing Artist</value>
</data>
<data name="UnblockDownloadedFile" xml:space="preserve">
<value>Unblock downloaded file</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public override void GetBaseProperties()
ViewModel.LoadCustomIcon = Item.LoadCustomIcon;
ViewModel.CustomIconSource = Item.CustomIconSource;
ViewModel.LoadFileIcon = Item.LoadFileIcon;
ViewModel.IsDownloadedFile = NativeFileOperationsHelper.ReadStringFromFile($"{Item.ItemPath}:Zone.Identifier") is not null;

if (!Item.IsShortcut)
return;
Expand Down
43 changes: 43 additions & 0 deletions src/Files.App/Views/Properties/GeneralPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,49 @@
</Expander.Content>
</Expander>

<!-- Security -->
<Expander
x:Name="Security"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
x:Load="{x:Bind ViewModel.IsDownloadedFile, Mode=OneWay}"
Header="{helpers:ResourceString Name=Security}"
IsExpanded="True">
<Expander.Content>
<Grid
HorizontalAlignment="Stretch"
ColumnSpacing="8"
RowSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<!-- Unblock Downloaded File -->
<TextBlock
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Center"
Text="{helpers:ResourceString Name=UnblockDownloadedFile}"
TextWrapping="WrapWholeWords" />

<CheckBox
Grid.Row="0"
Grid.Column="2"
MinWidth="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
AutomationProperties.Name="{helpers:ResourceString Name=UnblockDownloadedFile}"
IsChecked="{x:Bind ViewModel.IsUnblocking, Mode=TwoWay}" />
yaira2 marked this conversation as resolved.
Show resolved Hide resolved

</Grid>
</Expander.Content>
</Expander>

</StackPanel>
</ScrollViewer>
</vm:BasePropertiesPage>
3 changes: 3 additions & 0 deletions src/Files.App/Views/Properties/GeneralPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() =>
);
}

if (ViewModel.IsUnblocking)
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
NativeFileOperationsHelper.DeleteFileFromApp($"{item.ItemPath}:Zone.Identifier");

if (!GetNewName(out var newName))
return true;

Expand Down