Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b109f36
More advanced options for the Filesystem dialog
d2dyno1 Apr 8, 2021
f7bac8b
Updated UI
d2dyno1 Apr 9, 2021
9fa9470
Updated strings
d2dyno1 Apr 9, 2021
9e9ed07
Code improvements
d2dyno1 Apr 9, 2021
ea3d2bc
Improved xaml and added strings
d2dyno1 Apr 10, 2021
584ae54
Fix conflicts
d2dyno1 Apr 12, 2021
836f72f
Fix build
d2dyno1 Apr 12, 2021
aaa65d2
Quick fix
d2dyno1 Apr 12, 2021
4620ef3
Moved operation options out of the scrollviewer
d2dyno1 Apr 12, 2021
824c735
Some UI Changes
d2dyno1 Apr 12, 2021
a87d655
Changed to what Yair wanted
d2dyno1 Apr 12, 2021
32d54b9
Strings fix
d2dyno1 Apr 12, 2021
f514997
Merge branch 'main' into pr/4519
yaira2 Apr 15, 2021
3cc010b
Update Resources.resw
yaira2 Apr 15, 2021
c37556f
Revert "Update Resources.resw"
yaira2 Apr 15, 2021
510811f
Updated design
yaira2 Apr 15, 2021
7241499
Added hacky tweak
yaira2 Apr 15, 2021
312cd8e
Revert
yaira2 Apr 15, 2021
3d76364
Some fixes
d2dyno1 Apr 15, 2021
9384cfe
Added checkmark
d2dyno1 Apr 15, 2021
8e41432
Added action resolve text
d2dyno1 Apr 15, 2021
0158a33
Added strings
d2dyno1 Apr 15, 2021
f3af4d5
Fix alignment
d2dyno1 Apr 15, 2021
43ae36d
Some changes + partially fixed list view issue
d2dyno1 Apr 15, 2021
bff0d88
Updated design
yaira2 Apr 15, 2021
0f19aea
Fixed icon size
yaira2 Apr 15, 2021
4b6c1f2
Some more changes!
d2dyno1 Apr 15, 2021
1559e70
fix conflicts
d2dyno1 Apr 15, 2021
be8f8e2
quick fix
d2dyno1 Apr 15, 2021
e474f44
Fixed item alignment
yaira2 Apr 15, 2021
f23e676
Quick fixes
d2dyno1 Apr 15, 2021
9fcf821
Fix conflicts
d2dyno1 Apr 15, 2021
a053f43
Killed some bugs + moved tooltip
d2dyno1 Apr 15, 2021
ca6fd2a
re-added selection effect
d2dyno1 Apr 15, 2021
e8edc66
Updated strings
yaira2 Apr 16, 2021
0cc336e
Fixed ListView width
yaira2 Apr 16, 2021
3a66620
Added strings
d2dyno1 Apr 16, 2021
a952cce
Some fixes
d2dyno1 Apr 16, 2021
a941417
Improved displaying paths
d2dyno1 Apr 16, 2021
47640f6
Changed DestinationPath to SourcePath
d2dyno1 Apr 16, 2021
7342c60
Several important fixes
d2dyno1 Apr 16, 2021
64d69e7
Updated strings to match the concept
d2dyno1 Apr 16, 2021
635def0
Fix strings
d2dyno1 Apr 16, 2021
20a2909
Revert to ConflictingItemsDialog
d2dyno1 Apr 16, 2021
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
22 changes: 12 additions & 10 deletions Files/DataModels/FilesystemItemsOperationDataModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Files.Enums;
using Files.ViewModels.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using Windows.UI.Xaml;
Expand Down Expand Up @@ -52,7 +53,7 @@ public FilesystemItemsOperationDataModel(FilesystemOperationType operationType,
this.ConflictingItems = conflictingItems;
}

public List<FilesystemOperationItemViewModel> ToItems()
public List<FilesystemOperationItemViewModel> ToItems(Action updatePrimaryButtonEnabled, Action optionGenerateNewName, Action optionReplaceExisting, Action optionSkip)
{
List<FilesystemOperationItemViewModel> items = new List<FilesystemOperationItemViewModel>();

Expand All @@ -61,31 +62,32 @@ public List<FilesystemOperationItemViewModel> ToItems()
// Add conflicting items first
foreach (var item in ConflictingItems)
{
items.Add(new FilesystemOperationItemViewModel()
items.Add(new FilesystemOperationItemViewModel(updatePrimaryButtonEnabled, optionGenerateNewName, optionReplaceExisting, optionSkip)
{
IsConflict = true,
OperationIconGlyph = GetOperationIconGlyph(item.OperationType),
SourcePath = item.SourcePath,
PlusIconVisibility = Visibility.Collapsed,
DestinationPath = item.DestinationPath,
IsConflicting = true,
ConflictResolveOption = FileNameConflictResolveOptionType.GenerateNewName,
ExclamationMarkVisibility = Visibility.Visible,
ItemOperation = item.OperationType
ItemOperation = item.OperationType,
ActionTaken = false
});
}

// Then add non-conflicting items
foreach (var item in nonConflictingItems)
{
items.Add(new FilesystemOperationItemViewModel()
items.Add(new FilesystemOperationItemViewModel(updatePrimaryButtonEnabled, optionGenerateNewName, optionReplaceExisting, optionSkip)
{
IsConflict = false,
OperationIconGlyph = GetOperationIconGlyph(item.OperationType),
SourcePath = item.SourcePath,
ArrowIconVisibility = item.OperationType == FilesystemOperationType.Delete ? Visibility.Collapsed : Visibility.Visible,
PlusIconVisibility = item.OperationType == FilesystemOperationType.Delete ? Visibility.Collapsed : Visibility.Visible,
DestinationPath = item.DestinationPath,
IsConflicting = false,
ConflictResolveOption = FileNameConflictResolveOptionType.NotAConflict,
ExclamationMarkVisibility = Visibility.Collapsed,
ItemOperation = item.OperationType
ItemOperation = item.OperationType,
ActionTaken = true
});
}

Expand Down
412 changes: 254 additions & 158 deletions Files/Dialogs/FilesystemOperationDialog.xaml

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion Files/Dialogs/FilesystemOperationDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
using Files.ViewModels.Dialogs;
using System.Collections.Generic;
using Windows.UI.Xaml.Controls;

// The Content Dialog item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace Files.Dialogs
{
public sealed partial class FilesystemOperationDialog : ContentDialog
public sealed partial class FilesystemOperationDialog : ContentDialog, IFilesystemOperationDialogView
{
public FilesystemOperationDialogViewModel ViewModel
{
get => (FilesystemOperationDialogViewModel)DataContext;
set => DataContext = value;
}

public IList<object> SelectedItems => DetailsGrid.SelectedItems;

public FilesystemOperationDialog(FilesystemOperationDialogViewModel viewModel)
{
this.InitializeComponent();

ViewModel = viewModel;
ViewModel.View = this;
}
}

public interface IFilesystemOperationDialogView
{
IList<object> SelectedItems { get; }
}
}
10 changes: 5 additions & 5 deletions Files/Enums/FileNameConflictResolveOptionType.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace Files.Enums
{
public enum FileNameConflictResolveOptionType
public enum FileNameConflictResolveOptionType : uint
{
None = 0,
GenerateNewName = 1,
ReplaceExisting = 2,
Skip = 4
GenerateNewName = 0,
ReplaceExisting = 1,
Skip = 2,
NotAConflict = 4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ not when file name has changed
for (int i = 0; i < source.Count(); i++)
{
incomingItems.Add(new FilesystemItemsOperationItemModel(operationType, source.ElementAt(i).Path ?? source.ElementAt(i).Item.Path, destination.ElementAt(i)));
collisions.Add(incomingItems.ElementAt(i).SourcePath, FileNameConflictResolveOptionType.None);
collisions.Add(incomingItems.ElementAt(i).SourcePath, FileNameConflictResolveOptionType.GenerateNewName);

if (destination.Count() > 0 && StorageItemHelpers.Exists(destination.ElementAt(i))) // Same item names in both directories
{
Expand All @@ -915,7 +915,7 @@ not when file name has changed

if (mustResolveConflicts) // If there were conflicts, result buttons are different
{
if (result != ContentDialogResult.Primary && result != ContentDialogResult.Secondary) // Operation was cancelled
if (result != ContentDialogResult.Primary) // Operation was cancelled
{
return (new List<FileNameConflictResolveOptionType>(), true);
}
Expand Down
3 changes: 0 additions & 3 deletions Files/Helpers/EnumConversionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public static NameCollisionOption Convert(this FileNameConflictResolveOptionType
{
switch (option)
{
case FileNameConflictResolveOptionType.None:
return NameCollisionOption.GenerateUniqueName;

case FileNameConflictResolveOptionType.GenerateNewName:
return NameCollisionOption.GenerateUniqueName;

Expand Down
59 changes: 49 additions & 10 deletions Files/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -2034,23 +2034,20 @@
<data name="DeleteItemsDialogSubtitleMultiple" xml:space="preserve">
<value>{0} items will be deleted</value>
</data>
<data name="ConflictingItemsDialogCloseButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="ConflictingItemsDialogPrimaryButtonText" xml:space="preserve">
<value>Generate new name</value>
<value>Continue</value>
</data>
<data name="ConflictingItemsDialogSecondaryButtonText" xml:space="preserve">
<value>Replace existing</value>
<value>Cancel</value>
</data>
<data name="ConflictingItemsDialogSubtitleMultiple" xml:space="preserve">
<value>There are {0} conflicting file names, and {1} outgoing item(s)</value>
<data name="ConflictingItemsDialogSubtitleMultipleConflictsMultipleNonConflicts" xml:space="preserve">
<value>There are {0} conflicting file names, and {1} outgoing item(s).</value>
</data>
<data name="ConflictingItemsDialogTitle" xml:space="preserve">
<value>Conflicting file name(s)</value>
</data>
<data name="ConflictingItemsDialogSubtitleSingle" xml:space="preserve">
<value>There is one conflicting file name, and {0} outgoing item(s)</value>
<data name="ConflictingItemsDialogSubtitleSingleConflictMultipleNonConflicts" xml:space="preserve">
<value>There is one conflicting file name, and {0} outgoing item(s).</value>
</data>
<data name="CopyItemsDialogSubtitleSingle" xml:space="preserve">
<value>One item will be copied</value>
Expand Down Expand Up @@ -2094,9 +2091,27 @@
<data name="NavToolbarManageWidgetsFlyoutHeader.Text" xml:space="preserve">
<value>Manage Widgets</value>
</data>
<data name="SettingsAppearanceOpenThemesFolderButton.Content" xml:space="preserve">
<data name="SettingsAppearanceOpenThemesFolderButton.Content" xml:space="preserve">
<value>Open themes folder</value>
</data>
<data name="ConflictingItemsDialogItemOptionGenerateNewName.Text" xml:space="preserve">
<value>Generate new name</value>
</data>
<data name="ConflictingItemsDialogItemOptionReplaceExisting.Text" xml:space="preserve">
<value>Replace existing</value>
</data>
<data name="ConflictingItemsDialogItemOptionSkip.Text" xml:space="preserve">
<value>Skip</value>
</data>
<data name="ConflictingItemsDialogOptionGenerateNewName.Text" xml:space="preserve">
<value>Generate new name</value>
</data>
<data name="ConflictingItemsDialogOptionReplaceExisting.Text" xml:space="preserve">
<value>Replace existing</value>
</data>
<data name="ConflictingItemsDialogOptionSkip.Text" xml:space="preserve">
<value>Skip</value>
</data>
<data name="SettingsUseNewDetailsView.Header" xml:space="preserve">
<value>Use new details view</value>
</data>
Expand All @@ -2109,4 +2124,28 @@
<data name="FileBrowserSortOption_FileType.Text" xml:space="preserve">
<value>Type</value>
</data>
<data name="FileOperationsDialogDetailsExpander.Header" xml:space="preserve">
<value>Details</value>
</data>
<data name="ConflictingItemsDialogTakenActionGenerateNewName" xml:space="preserve">
<value>Generate new name</value>
</data>
<data name="ConflictingItemsDialogTakenActionReplaceExisting" xml:space="preserve">
<value>Replace existing</value>
</data>
<data name="ConflictingItemsDialogTakenActionSkip" xml:space="preserve">
<value>Skip</value>
</data>
<data name="ConflictingItemsDialogItemDefaultOption.Content" xml:space="preserve">
<value>Generate new name</value>
</data>
<data name="ConflictingItemsDialogUndoOption.Text" xml:space="preserve">
<value>Undo</value>
</data>
<data name="ConflictingItemsDialogSubtitleMultipleConflictsNoNonConflicts" xml:space="preserve">
<value>There are {0} conflicting file names.</value>
</data>
<data name="ConflictingItemsDialogSubtitleSingleConflictNoNonConflicts" xml:space="preserve">
<value>There is one conflicting file name.</value>
</data>
</root>
Loading