Skip to content

Commit 16171ff

Browse files
lukeblevinstsvietOKjeffsieu
authored
v0.7.6 with fixes (#612)
* Fix new folder/file creation looses focus with each letter (#607) * Fix Download folder location (#610) Get other default folders locations same way * Don't create folder or file if dialog was canceled (#608) * Add Invert Selection, icons to status bar, fix folder navigation and remove space before .dll (#604) * Remove space before .dll * Add Invert Selection, fix folder navigation crash Also fixes critical bug where a folder is deleted if it's moved into itself and the user presses skip * Add multiligual resources for new string * Various fixes for v0.7.6 (#611) * Prevent crash on opening new tab from folder * Prevent opening multiple new tabs from blocking the UI * Remove TabView Transition Animations * Fix Item Thumbnails not Loading * Ensure file type property is loaded Co-authored-by: Vladyslav <[email protected]> Co-authored-by: Jeff Sieu <[email protected]>
1 parent 6c00418 commit 16171ff

24 files changed

+244
-85
lines changed

Files/BaseLayout.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ public BaseLayout()
126126

127127
protected abstract void SetSelectedItemsOnUi(List<ListedItem> selectedItems);
128128

129+
public abstract void FocusSelectedItems();
130+
129131
protected abstract ListedItem GetItemFromElement(object element);
130132

131133
private void AppSettings_LayoutModeChangeRequested(object sender, EventArgs e)
@@ -275,10 +277,6 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
275277

276278
protected virtual void Page_CharacterReceived(CoreWindow sender, CharacterReceivedEventArgs args)
277279
{
278-
var focusedElement = FocusManager.GetFocusedElement(XamlRoot) as FrameworkElement;
279-
if (focusedElement is TextBox)
280-
return;
281-
282280
char letterPressed = Convert.ToChar(args.KeyCode);
283281
App.CurrentInstance.InteractionOperations.PushJumpChar(letterPressed);
284282
}
@@ -321,6 +319,11 @@ protected async void Item_DragStarting(object sender, DragStartingEventArgs e)
321319
selectedStorageItems.Add(await StorageFolder.GetFolderFromPathAsync(item.ItemPath));
322320
}
323321

322+
if (selectedStorageItems.Count == 0) {
323+
e.Cancel = true;
324+
return;
325+
}
326+
324327
e.Data.SetStorageItems(selectedStorageItems);
325328
e.DragUI.SetContentFromDataPackage();
326329
}
@@ -354,7 +357,7 @@ protected async void Item_Drop(object sender, DragEventArgs e)
354357
protected void InitializeDrag(UIElement element)
355358
{
356359
ListedItem item = GetItemFromElement(element);
357-
if(item != null)
360+
if (item != null)
358361
{
359362
element.AllowDrop = false;
360363
element.DragStarting -= Item_DragStarting;

Files/Dialogs/AddItemDialog.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ public static async void CreateFile(AddItemType fileType)
5757
StorageFolder folderToCreateItem = await StorageFolder.GetFolderFromPathAsync(currentPath);
5858
RenameDialog renameDialog = new RenameDialog();
5959

60-
await renameDialog.ShowAsync();
60+
var renameResult = await renameDialog.ShowAsync();
61+
if (renameResult == ContentDialogResult.Secondary)
62+
{
63+
return;
64+
}
65+
6166
var userInput = renameDialog.storedRenameInput;
6267

6368
if (fileType == AddItemType.Folder)

Files/Dialogs/RenameDialog.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
mc:Ignorable="d"
99
xmlns:Windows10version1903="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 8)"
10-
CornerRadius="4" Grid.RowSpan="4" DefaultButton="Primary" Title="Enter an item name" BorderThickness="0" SecondaryButtonClick="NameDialog_SecondaryButtonClick" PrimaryButtonClick="NameDialog_PrimaryButtonClick" x:Name="NameDialog" PrimaryButtonText="Set Name" SecondaryButtonText="Cancel" x:Uid="RenameDialog">
10+
CornerRadius="4" Grid.RowSpan="4" DefaultButton="Primary" Title="Enter an item name" BorderThickness="0" PrimaryButtonClick="NameDialog_PrimaryButtonClick" x:Name="NameDialog" PrimaryButtonText="Set Name" SecondaryButtonText="Cancel" x:Uid="RenameDialog">
1111

1212
<Grid MinWidth="300">
1313
<TextBox x:Name="RenameInput" x:Uid="RenameDialogInputText" PlaceholderText="Enter an item name without an extension" Height="35"/>

Files/Dialogs/RenameDialog.xaml.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,5 @@ private void NameDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogBu
3232
{
3333
storedRenameInput = inputBox.Text;
3434
}
35-
36-
private void NameDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
37-
{
38-
storedRenameInput = null;
39-
}
40-
4135
}
4236
}

Files/Helpers/NaturalStringComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal static class SafeNativeMethods
2121
public static readonly String LOCALE_NAME_INVARIANT = String.Empty;
2222
public static readonly String LOCALE_NAME_SYSTEM_DEFAULT = "!sys-default-locale";
2323

24-
[DllImport("api-ms-win-core-string-l1-1-0 .dll", CharSet = CharSet.Unicode)]
24+
[DllImport("api-ms-win-core-string-l1-1-0.dll", CharSet = CharSet.Unicode)]
2525
public static extern Int32 CompareStringEx(
2626
String localeName,
2727
Int32 flags,

Files/Interacts/Interaction.cs

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,16 @@ public async void OpenInNewWindowItem_Click(object sender, RoutedEventArgs e)
105105
}
106106
}
107107

108-
public void OpenDirectoryInNewTab_Click(object sender, RoutedEventArgs e)
108+
public async void OpenDirectoryInNewTab_Click(object sender, RoutedEventArgs e)
109109
{
110110
var CurrentSourceType = App.CurrentInstance.CurrentPageType;
111-
if (CurrentSourceType == typeof(GenericFileBrowser))
112-
{
113-
var items = (CurrentInstance.ContentPage as BaseLayout).SelectedItems;
114-
foreach (ListedItem listedItem in items)
115-
{
116-
instanceTabsView.AddNewTab(typeof(ModernShellPage), listedItem.ItemPath);
117-
}
118-
119-
}
120-
else if (CurrentSourceType == typeof(PhotoAlbum))
111+
var items = (CurrentInstance.ContentPage as BaseLayout).SelectedItems;
112+
foreach (ListedItem listedItem in items)
121113
{
122-
var items = (CurrentInstance.ContentPage as BaseLayout).SelectedItems;
123-
foreach (ListedItem listedItem in items)
114+
await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
124115
{
125116
instanceTabsView.AddNewTab(typeof(ModernShellPage), listedItem.ItemPath);
126-
}
117+
});
127118
}
128119
}
129120

@@ -943,7 +934,7 @@ public async Task PasteItems(DataPackageView packageView, string destinationPath
943934

944935
if (acceptedOperation == DataPackageOperation.Move)
945936
{
946-
foreach (IStorageItem item in itemsToPaste)
937+
foreach (IStorageItem item in pastedItems)
947938
{
948939
if (item.IsOfType(StorageItemTypes.File))
949940
{
@@ -965,6 +956,7 @@ public async Task PasteItems(DataPackageView packageView, string destinationPath
965956
List<string> pastedItemPaths = pastedItems.Select(item => item.Path).ToList();
966957
List<ListedItem> copiedItems = CurrentInstance.ViewModel.FilesAndFolders.Where(listedItem => pastedItemPaths.Contains(listedItem.ItemPath)).ToList();
967958
CurrentInstance.ContentPage.SelectedItems = copiedItems;
959+
CurrentInstance.ContentPage.FocusSelectedItems();
968960
}
969961
packageView.ReportOperationCompleted(acceptedOperation);
970962
}
@@ -1087,34 +1079,21 @@ await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal
10871079

10881080
public void SelectAllItems()
10891081
{
1090-
if (App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser))
1091-
{
1092-
var CurrentInstance = App.CurrentInstance;
1093-
foreach (ListedItem li in (CurrentInstance.ContentPage as GenericFileBrowser).AllView.ItemsSource)
1094-
{
1095-
if (!(CurrentInstance.ContentPage as GenericFileBrowser).SelectedItems.Contains(li))
1096-
{
1097-
(CurrentInstance.ContentPage as GenericFileBrowser).AllView.SelectedItems.Add(li);
1098-
}
1099-
}
1100-
}
1101-
else if (App.CurrentInstance.CurrentPageType == typeof(PhotoAlbum))
1102-
{
1103-
(CurrentInstance.ContentPage as PhotoAlbum).FileList.SelectAll();
1104-
}
1082+
CurrentInstance.ContentPage.SelectedItems = App.CurrentInstance.ViewModel.FilesAndFolders.ToList();
1083+
}
1084+
1085+
public void InvertAllItems()
1086+
{
1087+
List<ListedItem> oldSelectedItems = CurrentInstance.ContentPage.SelectedItems;
1088+
List<ListedItem> newSelectedItems = CurrentInstance.ViewModel.FilesAndFolders.ToList();
1089+
foreach (ListedItem listedItem in oldSelectedItems)
1090+
newSelectedItems.Remove(listedItem);
1091+
CurrentInstance.ContentPage.SelectedItems = newSelectedItems;
11051092
}
11061093

11071094
public void ClearAllItems()
11081095
{
1109-
if (App.CurrentInstance.CurrentPageType == typeof(GenericFileBrowser))
1110-
{
1111-
var CurrentInstance = App.CurrentInstance;
1112-
(CurrentInstance.ContentPage as GenericFileBrowser).AllView.SelectedItems.Clear();
1113-
}
1114-
else if (App.CurrentInstance.CurrentPageType == typeof(PhotoAlbum))
1115-
{
1116-
(CurrentInstance.ContentPage as PhotoAlbum).FileList.SelectedItems.Clear();
1117-
}
1096+
CurrentInstance.ContentPage.SelectedItems = new List<ListedItem>();
11181097
}
11191098

11201099
public void ToggleQuickLook_Click(object sender, RoutedEventArgs e)

Files/MultilingualResources/Files.de-DE.xlf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,10 @@
578578
<source>Settings</source>
579579
<target state="new">Settings</target>
580580
</trans-unit>
581+
<trans-unit id="StatusBarControlInvertSelection.Text" translate="yes" xml:space="preserve">
582+
<source>Invert Selection</source>
583+
<target state="new">Invert Selection</target>
584+
</trans-unit>
581585
</group>
582586
</body>
583587
</file>

Files/MultilingualResources/Files.es-ES.xlf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,11 @@
574574
<source>Settings</source>
575575
<target state="translated">Ajustes</target>
576576
</trans-unit>
577+
<trans-unit id="StatusBarControlInvertSelection.Text" translate="yes" xml:space="preserve">
578+
<source>Invert Selection</source>
579+
<target state="new">Invert Selection</target>
580+
</trans-unit>
577581
</group>
578582
</body>
579583
</file>
580-
</xliff>
584+
</xliff>

Files/MultilingualResources/Files.fr-FR.xlf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,10 @@
576576
<source>Settings</source>
577577
<target state="new">Settings</target>
578578
</trans-unit>
579+
<trans-unit id="StatusBarControlInvertSelection.Text" translate="yes" xml:space="preserve">
580+
<source>Invert Selection</source>
581+
<target state="new">Invert Selection</target>
582+
</trans-unit>
579583
</group>
580584
</body>
581585
</file>

Files/MultilingualResources/Files.nl-NL.xlf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,10 @@
576576
<source>Settings</source>
577577
<target state="new">Settings</target>
578578
</trans-unit>
579+
<trans-unit id="StatusBarControlInvertSelection.Text" translate="yes" xml:space="preserve">
580+
<source>Invert Selection</source>
581+
<target state="new">Invert Selection</target>
582+
</trans-unit>
579583
</group>
580584
</body>
581585
</file>

0 commit comments

Comments
 (0)