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

Update upstream #1

Merged
merged 27 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3605169
Fixed an issue where opening the properties window would crash the ap…
winston-de Dec 16, 2020
8dc6c39
Fixed a couple of screen reader issues (#2602)
yaira2 Dec 16, 2020
0596b83
📓 Updated HUN (#2613)
KristofKekesi Dec 16, 2020
77de776
Renamed list view to details view (#2617)
yaira2 Dec 16, 2020
64cb324
Increaseed CoreDispatcherPriority of adding drive sidebar items to "N…
lukeblevins Dec 16, 2020
27a3aec
Updated it-IT (#2618)
gave92 Dec 16, 2020
94ca1d7
A small fix for very annoying Exception (#2619)
d2dyno1 Dec 16, 2020
e6dd11f
Updated fr-FR (#2579)
boscorelly Dec 16, 2020
08d2295
Translation update [es-ES] (#2620)
Dec 16, 2020
916a853
Cleanup: Moved duplicated code to the BaseLayout (#2621)
tsvietOK Dec 17, 2020
4a337ba
Check for updates from Files (#2508)
Thomas1664 Dec 17, 2020
654fe56
Added the option to hide columns in the details layout (#2622)
yaira2 Dec 17, 2020
73dba2b
Use documented NavigationView adaptive behavior and always set titleb…
lukeblevins Dec 17, 2020
ee2ae70
CodeMaid (#2630)
yaira2 Dec 17, 2020
dbcb98d
Fixed an issue where the properties dialog would sometimes show the p…
gave92 Dec 18, 2020
d0150fc
SidebarControl: Adapt pane width to AppSettings SidebarWidth (#2631)
tsvietOK Dec 18, 2020
2d8c3de
📓 Updated HUN (#2634)
KristofKekesi Dec 18, 2020
cec9096
Updated polish translation (#2635)
KSYMEK Dec 18, 2020
d0491a1
Set focus on file list when changing folder (#2636)
gave92 Dec 19, 2020
947c00b
Load file icons from storagefile if fulltrustprocess fails (#2637)
gave92 Dec 19, 2020
a469ccf
Added an option to show system files (#2638)
gave92 Dec 19, 2020
447aa95
Fixed some issues with undo/redo (#2632)
gave92 Dec 19, 2020
4398e82
Added more file types to the new file menu (#2644)
gave92 Dec 20, 2020
d77c162
Fixed crash on app launch (#2648)
gave92 Dec 20, 2020
a53cc5e
Switched the color of the selection rectangle to use the system accen…
yaira2 Dec 20, 2020
c122bd3
Fixed an issue where changing a setting wouldn't save the setting cor…
yaira2 Dec 20, 2020
090b7f5
Updated priconfig (#2645)
yaira2 Dec 21, 2020
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
8 changes: 3 additions & 5 deletions Files.Launcher/DragDropForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FilesFullTrust
Expand Down Expand Up @@ -45,7 +42,8 @@ public DragDropForm(string dropPath, string dropText, System.Threading.Cancellat
this.Size = new System.Drawing.Size(lpRect.Width, lpRect.Height);
this.Location = new System.Drawing.Point(lpRect.Location.X, lpRect.Location.Y);

token.Register(() => {
token.Register(() =>
{
if (this.IsHandleCreated)
{
// If another window is created, close this one
Expand Down Expand Up @@ -127,4 +125,4 @@ protected override CreateParams CreateParams
}
}
}
}
}
6 changes: 5 additions & 1 deletion Files.Launcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,13 @@ await Win32API.StartSTATask(() =>
}
using var shi = new ShellItem(fileToDeletePath);
op.QueueDeleteOperation(shi);
op.PostDeleteItem += async (s, e) =>
{
await args.Request.SendResponseAsync(new ValueSet() {
{ "Success", e.Result.Succeeded } });
};
op.PerformOperations();
}
//ShellFileOperations.Delete(fileToDeletePath, ShellFileOperations.OperationFlags.AllowUndo | ShellFileOperations.OperationFlags.NoUI);
break;

case "ParseLink":
Expand Down
4 changes: 2 additions & 2 deletions Files.Package/Files.Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
<AppxBundlePlatforms>x86|x64|arm|arm64</AppxBundlePlatforms>
<DisableXbfLineInfo>False</DisableXbfLineInfo>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundleAutoResourcePackageQualifiers>Scale|DXFeatureLevel</AppxBundleAutoResourcePackageQualifiers>
<AppxDefaultResourceQualifiers>Language=en-US;de-DE;es-ES;fr-FR;he-IL;hi-IN;hu-HU;it-IT;ja-JP;nl-NL;or-IN;pl-PL;pt-BR;ru-RU;ta;tr-TR;uk-UA;zh-Hans;zh-Hant</AppxDefaultResourceQualifiers>
<UapAppxPackageBuildMode>StoreUpload</UapAppxPackageBuildMode>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<EntryPointProjectUniqueName>..\Files\Files.csproj</EntryPointProjectUniqueName>
Expand Down Expand Up @@ -142,8 +144,6 @@
<Content Include="Assets\Wide310x150Logo.scale-150.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
<Content Include="Assets\Wide310x150Logo.scale-400.png" />
<Content Include="priconfig.default.xml" />
<Content Include="priconfig.packaging.xml" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
</Project>
2 changes: 1 addition & 1 deletion Files.Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
<Identity Name="FilesDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.21.3.0" />
<Identity Name="FilesDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.22.1.0" />
<Properties>
<DisplayName>Files - Dev</DisplayName>
<PublisherDisplayName>Yair A</PublisherDisplayName>
Expand Down
4 changes: 0 additions & 4 deletions Files.Package/priconfig.default.xml

This file was deleted.

5 changes: 0 additions & 5 deletions Files.Package/priconfig.packaging.xml

This file was deleted.

168 changes: 135 additions & 33 deletions Files/BaseLayout.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Files.Common;
using Files.DataModels;
using Files.Filesystem;
using Files.Helpers;
using Files.UserControls;
Expand All @@ -9,9 +10,9 @@
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -136,6 +137,8 @@ internal set

public ListedItem SelectedItem { get; private set; }

private List<ShellNewEntry> cachedNewContextMenuEntries { get; set; }

public BaseLayout()
{
SelectedItemsPropertiesViewModel = new SelectedItemsPropertiesViewModel(this);
Expand All @@ -151,23 +154,49 @@ public BaseLayout()
}
}

public abstract void FocusFileList();

public abstract void SelectAllItems();

public abstract void InvertSelection();
public virtual void InvertSelection()
{
List<ListedItem> newSelectedItems = GetAllItems()
.Cast<ListedItem>()
.Except(SelectedItems)
.ToList();

SetSelectedItemsOnUi(newSelectedItems);
}

public abstract void ClearSelection();

public abstract void SetDragModeForItems();

public abstract void ScrollIntoView(ListedItem item);

public abstract int GetSelectedIndex();
protected abstract void AddSelectedItem(ListedItem item);

protected abstract IEnumerable GetAllItems();

public abstract void SetSelectedItemOnUi(ListedItem selectedItem);
public virtual void SetSelectedItemOnUi(ListedItem selectedItem)
{
ClearSelection();
AddSelectedItem(selectedItem);
}

public abstract void SetSelectedItemsOnUi(List<ListedItem> selectedItems);
public virtual void SetSelectedItemsOnUi(List<ListedItem> selectedItems)
{
ClearSelection();
AddSelectedItemsOnUi(selectedItems);
}

public abstract void AddSelectedItemsOnUi(List<ListedItem> selectedItems);
public virtual void AddSelectedItemsOnUi(List<ListedItem> selectedItems)
{
foreach (ListedItem selectedItem in selectedItems)
{
AddSelectedItem(selectedItem);
}
}

private void ClearShellContextMenus(MenuFlyout menuFlyout)
{
Expand All @@ -176,6 +205,7 @@ private void ClearShellContextMenus(MenuFlyout menuFlyout)
{
menuFlyout.Items.RemoveAt(menuFlyout.Items.IndexOf(contextMenuItems[i]));
}

if (menuFlyout.Items[0] is MenuFlyoutSeparator flyoutSeperator)
{
menuFlyout.Items.RemoveAt(menuFlyout.Items.IndexOf(flyoutSeperator));
Expand Down Expand Up @@ -219,9 +249,31 @@ public virtual void SetShellContextmenu(MenuFlyout menuFlyout, bool shiftPressed

public abstract void StartRenameItem();

public abstract void ResetItemOpacity();
public virtual void ResetItemOpacity()
{
IEnumerable items = GetAllItems();
if (items == null)
{
return;
}

foreach (ListedItem listedItem in items)
{
if (listedItem.IsHiddenItem)
{
listedItem.Opacity = 0.4;
}
else
{
listedItem.Opacity = 1;
}
}
}

public abstract void SetItemOpacity(ListedItem item);
public virtual void SetItemOpacity(ListedItem item)
{
item.Opacity = 0.4;
}

protected abstract ListedItem GetItemFromElement(object element);

Expand Down Expand Up @@ -301,6 +353,10 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)

ParentShellPageInstance.InstanceViewModel.IsPageTypeNotHome = true; // show controls that were hidden on the home page
ParentShellPageInstance.Clipboard_ContentChanged(null, null);

cachedNewContextMenuEntries = await RegistryHelper.GetNewContextMenuEntries();

FocusFileList(); // Set focus on layout specific file list control
}

protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
Expand All @@ -314,10 +370,17 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)

private void UnloadMenuFlyoutItemByName(string nameToUnload)
{
var menuItem = this.FindName(nameToUnload) as DependencyObject;
if (menuItem != null) // Prevent crash if the MenuFlyoutItem is missing
if (FindName(nameToUnload) is MenuFlyoutItemBase menuItem) // Prevent crash if the MenuFlyoutItem is missing
{
menuItem.Visibility = Visibility.Collapsed;
}
}

private void LoadMenuFlyoutItemByName(string nameToUnload)
{
if (FindName(nameToUnload) is MenuFlyoutItemBase menuItem) // Prevent crash if the MenuFlyoutItem is missing
{
(menuItem as MenuFlyoutItemBase).Visibility = Visibility.Collapsed;
menuItem.Visibility = Visibility.Visible;
}
}

Expand Down Expand Up @@ -451,6 +514,48 @@ public void RightClickContextMenu_Opening(object sender, object e)
ClearSelection();
var shiftPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down);
SetShellContextmenu(BaseLayoutContextFlyout, shiftPressed, false);
var newItemMenu = (MenuFlyoutSubItem)BaseLayoutContextFlyout.Items.SingleOrDefault(x => x.Name == "NewEmptySpace");
if (newItemMenu == null || cachedNewContextMenuEntries == null)
{
return;
}
if (!newItemMenu.Items.Any(x => (x.Tag as string) == "CreateNewFile"))
{
var separatorIndex = newItemMenu.Items.IndexOf(newItemMenu.Items.Single(x => x.Name == "NewMenuFileFolderSeparator"));
foreach (var newEntry in Enumerable.Reverse(cachedNewContextMenuEntries))
{
MenuFlyoutItem menuLayoutItem;
if (newEntry.Icon != null)
{
var image = new BitmapImage();
#pragma warning disable CS4014
image.SetSourceAsync(newEntry.Icon);
#pragma warning restore CS4014
menuLayoutItem = new MenuFlyoutItemWithImage()
{
Text = newEntry.Name,
BitmapIcon = image,
Tag = "CreateNewFile"
};
}
else
{
menuLayoutItem = new MenuFlyoutItem()
{
Text = newEntry.Name,
Icon = new FontIcon()
{
FontFamily = App.Current.Resources["FluentUIGlyphs"] as Windows.UI.Xaml.Media.FontFamily,
Glyph = "\xea00"
},
Tag = "CreateNewFile"
};
}
menuLayoutItem.Command = ParentShellPageInstance.InteractionOperations.CreateNewFile;
menuLayoutItem.CommandParameter = newEntry;
newItemMenu.Items.Insert(separatorIndex + 1, menuLayoutItem);
}
}
}

public void RightClickItemContextMenu_Opening(object sender, object e)
Expand Down Expand Up @@ -485,7 +590,7 @@ public void RightClickItemContextMenu_Opening(object sender, object e)
{
if (SelectedItem.IsShortcutItem)
{
(this.FindName("OpenItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("OpenItem");
UnloadMenuFlyoutItemByName("OpenItemWithAppPicker");
UnloadMenuFlyoutItemByName("RunAsAdmin");
UnloadMenuFlyoutItemByName("RunAsAnotherUser");
Expand All @@ -497,42 +602,42 @@ public void RightClickItemContextMenu_Opening(object sender, object e)
UnloadMenuFlyoutItemByName("OpenItemWithAppPicker");
UnloadMenuFlyoutItemByName("RunAsAdmin");
UnloadMenuFlyoutItemByName("RunAsAnotherUser");
(this.FindName("CreateShortcut") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("CreateShortcut");
}
else if (SelectedItem.FileExtension.Equals(".exe", StringComparison.OrdinalIgnoreCase)
|| SelectedItem.FileExtension.Equals(".bat", StringComparison.OrdinalIgnoreCase))
{
(this.FindName("OpenItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("OpenItem");
UnloadMenuFlyoutItemByName("OpenItemWithAppPicker");
(this.FindName("RunAsAdmin") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("RunAsAnotherUser") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("CreateShortcut") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("RunAsAdmin");
LoadMenuFlyoutItemByName("RunAsAnotherUser");
LoadMenuFlyoutItemByName("CreateShortcut");
}
else if (SelectedItem.FileExtension.Equals(".msi", StringComparison.OrdinalIgnoreCase))
{
UnloadMenuFlyoutItemByName("OpenItem");
UnloadMenuFlyoutItemByName("OpenItemWithAppPicker");
UnloadMenuFlyoutItemByName("RunAsAdmin");
(this.FindName("RunAsAnotherUser") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("CreateShortcut") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("RunAsAnotherUser");
LoadMenuFlyoutItemByName("CreateShortcut");
}
else if (SelectedItem.FileExtension.Equals(".appx", StringComparison.OrdinalIgnoreCase)
|| SelectedItem.FileExtension.Equals(".msix", StringComparison.OrdinalIgnoreCase)
|| SelectedItem.FileExtension.Equals(".appxbundle", StringComparison.OrdinalIgnoreCase)
|| SelectedItem.FileExtension.Equals(".msixbundle", StringComparison.OrdinalIgnoreCase))
{
(this.FindName("OpenItemWithAppPicker") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("OpenItemWithAppPicker");
UnloadMenuFlyoutItemByName("RunAsAdmin");
UnloadMenuFlyoutItemByName("RunAsAnotherUser");
(this.FindName("CreateShortcut") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("CreateShortcut");
}
else
{
(this.FindName("OpenItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("OpenItemWithAppPicker") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("OpenItem");
LoadMenuFlyoutItemByName("OpenItemWithAppPicker");
UnloadMenuFlyoutItemByName("RunAsAdmin");
UnloadMenuFlyoutItemByName("RunAsAnotherUser");
(this.FindName("CreateShortcut") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("CreateShortcut");
}
}
}
Expand All @@ -555,23 +660,20 @@ public void RightClickItemContextMenu_Opening(object sender, object e)
}
else if (SelectedItems.Count == 1)
{
(this.FindName("SidebarPinItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("CreateShortcut") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("OpenItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("SidebarPinItem");
LoadMenuFlyoutItemByName("CreateShortcut");
LoadMenuFlyoutItemByName("OpenItem");
}
else
{
(this.FindName("SidebarPinItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
LoadMenuFlyoutItemByName("SidebarPinItem");
UnloadMenuFlyoutItemByName("CreateShortcut");
}

if (SelectedItems.Count <= 5 && SelectedItems.Count > 0)
{
(this.FindName("OpenInNewTab") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
(this.FindName("OpenInNewWindowItem") as MenuFlyoutItemBase).Visibility = Visibility.Visible;
//this.FindName("SidebarPinItem");
//this.FindName("OpenInNewTab");
//this.FindName("OpenInNewWindowItem");
LoadMenuFlyoutItemByName("OpenInNewTab");
LoadMenuFlyoutItemByName("OpenInNewWindowItem");
}
else if (SelectedItems.Count > 5)
{
Expand Down
4 changes: 2 additions & 2 deletions Files/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public static class GridViewBrowser
}

public static class GenericFileBrowser
{
{
}
}
}
}
}
Loading