Skip to content

Commit 526b6f0

Browse files
committed
Added VaultItemInfoDialog
1 parent 9e7f0f3 commit 526b6f0

15 files changed

Lines changed: 289 additions & 21 deletions

File tree

src/Core/SecureFolderFS.Core.FileSystem/Helpers/RecycleBin/Native/NativeRecycleBinHelpers.Operational.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ public static void DeleteOrRecycle(string ciphertextPath, FileSystemSpecifics sp
6565
// Move and rename item
6666
var guid = Guid.NewGuid().ToString();
6767
var destinationPath = Path.Combine(recycleBinPath, guid);
68-
Directory.Move(ciphertextPath, destinationPath);
68+
if (storableType == StorableType.Folder)
69+
Directory.Move(ciphertextPath, destinationPath);
70+
else
71+
File.Move(ciphertextPath, destinationPath);
6972

7073
// Create the configuration file
7174
using (var configurationStream = File.Create($"{destinationPath}.json"))
@@ -117,7 +120,7 @@ public static void DeleteOrRecycle(string ciphertextPath, FileSystemSpecifics sp
117120
StorableType AlignStorableType(string path)
118121
{
119122
var type = storableType is StorableType.File or StorableType.Folder ? storableType : GetStorableType(path);
120-
if (type == StorableType.None)
123+
if (type is not (StorableType.File or StorableType.Folder))
121124
throw new FileNotFoundException("The item could not be determined.");
122125

123126
return type;

src/Platforms/SecureFolderFS.UI/Strings/en-US/Resources.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,4 +1403,16 @@
14031403
<data name="DeviceLinkSourceThisDevice" xml:space="preserve">
14041404
<value>This device</value>
14051405
</data>
1406+
<data name="FileInformation" xml:space="preserve">
1407+
<value>File information</value>
1408+
</data>
1409+
<data name="FolderInformation" xml:space="preserve">
1410+
<value>Folder information</value>
1411+
</data>
1412+
<data name="Encrypted" xml:space="preserve">
1413+
<value>Encrypted</value>
1414+
</data>
1415+
<data name="Decrypted" xml:space="preserve">
1416+
<value>Decrypted</value>
1417+
</data>
14061418
</root>

src/Platforms/SecureFolderFS.Uno/Dialogs/ChangelogDialog.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using SecureFolderFS.UI.Utils;
1111
using SecureFolderFS.Uno.Extensions;
1212

13-
// To learn more about WinUI, the WinUI project structure,D
13+
// To learn more about WinUI, the WinUI project structure,
1414
// and more about our project templates, see: http://aka.ms/winui-project-info.
1515

1616
namespace SecureFolderFS.Uno.Dialogs

src/Platforms/SecureFolderFS.Uno/Dialogs/ExplanationDialog.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using Windows.Media.Core;
1616
#endif
1717

18-
// To learn more about WinUI, the WinUI project structure,D
18+
// To learn more about WinUI, the WinUI project structure,
1919
// and more about our project templates, see: http://aka.ms/winui-project-info.
2020

2121
namespace SecureFolderFS.Uno.Dialogs

src/Platforms/SecureFolderFS.Uno/Dialogs/MigrationDialog.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using SecureFolderFS.UI.Utils;
1212
using SecureFolderFS.Uno.Extensions;
1313

14-
// To learn more about WinUI, the WinUI project structure,D
14+
// To learn more about WinUI, the WinUI project structure,
1515
// and more about our project templates, see: http://aka.ms/winui-project-info.
1616

1717
namespace SecureFolderFS.Uno.Dialogs

src/Platforms/SecureFolderFS.Uno/Dialogs/RecycleBinDialog.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using SecureFolderFS.Uno.Extensions;
1212
using WinUI.TableView;
1313

14-
// To learn more about WinUI, the WinUI project structure,D
14+
// To learn more about WinUI, the WinUI project structure,
1515
// and more about our project templates, see: http://aka.ms/winui-project-info.
1616

1717
namespace SecureFolderFS.Uno.Dialogs
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<ContentDialog
2+
x:Class="SecureFolderFS.Uno.Dialogs.VaultItemInfoDialog"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:h="using:SecureFolderFS.Uno.Helpers"
7+
xmlns:l="using:SecureFolderFS.Uno.Localization"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:ucab="using:SecureFolderFS.Uno.UserControls.ActionBlocks"
10+
Title="{x:Bind ViewModel.IsFile, Mode=OneWay, Converter={StaticResource BoolToStringConverter}, ConverterParameter='true:LOCALIZE|FileInformation:false:LOCALIZE|FolderInformation'}"
11+
CloseButtonText="{l:ResourceString Rid=Close}"
12+
DefaultButton="Close"
13+
RequestedTheme="{x:Bind h:UnoThemeHelper.Instance.CurrentElementTheme, Mode=OneWay}"
14+
Style="{ThemeResource DefaultContentDialogStyle}"
15+
mc:Ignorable="d">
16+
17+
<StackPanel Width="500" Spacing="4">
18+
<!-- Plaintext -->
19+
<ucab:ActionBlockControl Title="{l:ResourceString Rid=Decrypted}" BlockMode="Expandable">
20+
<ucab:ActionBlockControl.Icon>
21+
<FontIcon Glyph="&#xE785;" />
22+
</ucab:ActionBlockControl.Icon>
23+
<ucab:ActionBlockControl.ExpanderContent>
24+
<Grid Padding="52,0,32,0" ColumnSpacing="48">
25+
<Grid.ColumnDefinitions>
26+
<ColumnDefinition Width="Auto" />
27+
<ColumnDefinition />
28+
</Grid.ColumnDefinitions>
29+
30+
<StackPanel Grid.Column="0" Spacing="4">
31+
<TextBlock Text="{l:ResourceString Rid=Name}" />
32+
<TextBlock Text="{l:ResourceString Rid=Path}" />
33+
</StackPanel>
34+
<StackPanel Grid.Column="1" Spacing="4">
35+
<TextBlock
36+
IsTextSelectionEnabled="True"
37+
Opacity="0.6"
38+
Text="{x:Bind ViewModel.PlaintextName, Mode=OneWay}"
39+
TextTrimming="CharacterEllipsis"
40+
ToolTipService.ToolTip="{x:Bind ViewModel.PlaintextName, Mode=OneWay}" />
41+
<TextBlock
42+
IsTextSelectionEnabled="True"
43+
Opacity="0.6"
44+
Text="{x:Bind ViewModel.PlaintextPath, Mode=OneWay}"
45+
TextTrimming="CharacterEllipsis"
46+
ToolTipService.ToolTip="{x:Bind ViewModel.PlaintextPath, Mode=OneWay}" />
47+
</StackPanel>
48+
</Grid>
49+
</ucab:ActionBlockControl.ExpanderContent>
50+
</ucab:ActionBlockControl>
51+
52+
<!-- Ciphertext -->
53+
<ucab:ActionBlockControl Title="{l:ResourceString Rid=Encrypted}" BlockMode="Expandable">
54+
<ucab:ActionBlockControl.Icon>
55+
<FontIcon Glyph="&#xE72E;" />
56+
</ucab:ActionBlockControl.Icon>
57+
<ucab:ActionBlockControl.ExpanderContent>
58+
<Grid Padding="52,0,32,0" ColumnSpacing="48">
59+
<Grid.ColumnDefinitions>
60+
<ColumnDefinition Width="Auto" />
61+
<ColumnDefinition />
62+
</Grid.ColumnDefinitions>
63+
64+
<StackPanel Grid.Column="0" Spacing="4">
65+
<TextBlock Text="{l:ResourceString Rid=Name}" />
66+
<TextBlock Text="{l:ResourceString Rid=Path}" />
67+
</StackPanel>
68+
<StackPanel Grid.Column="1" Spacing="4">
69+
<TextBlock
70+
IsTextSelectionEnabled="True"
71+
Opacity="0.6"
72+
Text="{x:Bind ViewModel.CiphertextName, Mode=OneWay}"
73+
TextTrimming="CharacterEllipsis"
74+
ToolTipService.ToolTip="{x:Bind ViewModel.CiphertextName, Mode=OneWay}" />
75+
<TextBlock
76+
IsTextSelectionEnabled="True"
77+
Opacity="0.6"
78+
Text="{x:Bind ViewModel.CiphertextPath, Mode=OneWay}"
79+
TextTrimming="CharacterEllipsis"
80+
ToolTipService.ToolTip="{x:Bind ViewModel.CiphertextPath, Mode=OneWay}" />
81+
</StackPanel>
82+
</Grid>
83+
</ucab:ActionBlockControl.ExpanderContent>
84+
</ucab:ActionBlockControl>
85+
</StackPanel>
86+
</ContentDialog>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Microsoft.UI.Xaml.Controls;
4+
using SecureFolderFS.Sdk.ViewModels.Views.Overlays;
5+
using SecureFolderFS.Shared.ComponentModel;
6+
using SecureFolderFS.Shared.Extensions;
7+
using SecureFolderFS.UI.Utils;
8+
using SecureFolderFS.Uno.Extensions;
9+
10+
// To learn more about WinUI, the WinUI project structure,
11+
// and more about our project templates, see: http://aka.ms/winui-project-info.
12+
13+
namespace SecureFolderFS.Uno.Dialogs
14+
{
15+
public sealed partial class VaultItemInfoDialog : ContentDialog, IOverlayControl
16+
{
17+
public VaultItemInfoOverlayViewModel? ViewModel
18+
{
19+
get => DataContext.TryCast<VaultItemInfoOverlayViewModel>();
20+
set => DataContext = value;
21+
}
22+
23+
public VaultItemInfoDialog()
24+
{
25+
InitializeComponent();
26+
}
27+
28+
/// <inheritdoc/>
29+
public new async Task<IResult> ShowAsync() => (await base.ShowAsync()).ParseOverlayOption();
30+
31+
/// <inheritdoc/>
32+
public void SetView(IViewable viewable) => ViewModel = (VaultItemInfoOverlayViewModel)viewable;
33+
34+
/// <inheritdoc/>
35+
public Task HideAsync()
36+
{
37+
Hide();
38+
return Task.CompletedTask;
39+
}
40+
}
41+
}

src/Platforms/SecureFolderFS.Uno/Package.appxmanifest

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@
7070
<uap:InfoTip>SecureFolderFS Vault</uap:InfoTip>
7171
<uap:EditFlags OpenIsSafe="true"/>
7272
</uap:FileTypeAssociation>
73-
<uap:Protocol Name="sffs">
74-
<uap:DisplayName>SecureFolderFS</uap:DisplayName>
75-
<uap:Logo>Assets\AppIcon\AppIcon.png</uap:Logo>
76-
</uap:Protocol>
7773
</uap:Extension>
7874
</Extensions>
7975
</Application>

src/Platforms/SecureFolderFS.Uno/SecureFolderFS.Uno.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@
335335
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
336336
<SubType>Designer</SubType>
337337
</Page>
338+
<Page Update="Dialogs\VaultItemInfoDialog.xaml">
339+
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
340+
<SubType>Designer</SubType>
341+
</Page>
338342
<Page Update="Dialogs\VaultWizardDialog.xaml">
339343
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
340344
<SubType>Designer</SubType>
@@ -502,6 +506,7 @@
502506
<UpToDateCheckInput Remove="Dialogs\PreviewRecoveryDialog.xaml" />
503507
<UpToDateCheckInput Remove="Dialogs\RecoveryDialog.xaml" />
504508
<UpToDateCheckInput Remove="Dialogs\SettingsDialog.xaml" />
509+
<UpToDateCheckInput Remove="Dialogs\VaultItemInfoDialog.xaml" />
505510
<UpToDateCheckInput Remove="Dialogs\VaultWizardDialog.xaml" />
506511
<UpToDateCheckInput Remove="ResourceDictionaries\ColorResources.xaml" />
507512
<UpToDateCheckInput Remove="ResourceDictionaries\ConverterResources.xaml" />

0 commit comments

Comments
 (0)